Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
196

Material to be Update in J_2IRG1BAL Automatically Development using J1ID Transaction using Enhancement framework.

By Sagar Dev

PURPOSE:

When we declare Material in J1ID Transaction as RG1 Material then we have to update this material in TableJ_2IRG1BAL manually.

So we have developed one program when we update material in J1ID transaction as RG1 Material program will automatically update that material in table J_2IRG1BAL in the background.

Step by step Solution:

Find the enhancement point in the include ‘LJ1I5O02’.

Go to transaction “SE38”.


Enter a name for the PROGRAM and click on ‘DISPLAY’.

 

  1. To find the enhancement point, go to Program -->  Enhance (Or)

      Click on the “Enhance” .

  1. Go to Edit --> Enhancement Operations --> Show Implicit Enhancement Options.

Now, we will observe commas like below.

  1. Go to Implicit enhancement option at the beginning of the form ‘CHECK_DOCUMENT_TYPE’ and Right click --> Enhancement Implementation --> Create.

Now it will ask for Enhancement Type. ZJ1ID_J_2IRG1BALDescription And ok
We have to implement the code and it will looks like this. ENHANCEMENT ZJ1ID_J_2IRG1BAL.    "active version

  1. ENDENHANCEMENT.

Here you can write the custom code for modifying the functionality.

ENHANCEMENT ZJ1ID_J_2IRG1BAL.    "active version
DATA: lv_exgrp TYPE j_1iexgrps-j_1iexcgrp,
lv_rgbal
TYPE j_2irg1bal,
wa      
TYPE j_2irg1bal.

CLEAR: wa,lv_exgrp,lv_rgbal.

IF fcode EQ 'EDIT' AND view_action = 'U' AND view_name EQ 'J_1IMTCHID'.
"For Exices Group.
SELECT SINGLE j_1iexcgrp FROM j_1iexgrps CLIENT SPECIFIED INTO lv_exgrp
WHERE mandt     EQ sy-mandt
AND j_1iwerks EQ j_1imtchid-werks.
"Here we are cheking that record is present in j_2irg1bal table or not.
SELECT SINGLE * FROM j_2irg1bal CLIENT SPECIFIED INTO lv_rgbal
WHERE mandt EQ sy-mandt
AND exgrp EQ lv_exgrp
AND matnr EQ j_1imtchid-matnr
AND werks EQ j_1imtchid-werks.
CASE j_1imtchid-j_1icapind.
WHEN 'F'.
"if Record is Not presented in j_2irg1bal table then append it into j_2irg1bal table.
IF lv_rgbal IS INITIAL.
"Here we insert that record in j_2irg1bal table.
wa
-mandt  = sy-mandt.
wa
-exgrp  = lv_exgrp.
wa
-datum  = sy-datum.
wa
-matnr  = j_1imtchid-matnr.
wa
-form   = 'P'.
wa
-werks  = j_1imtchid-werks.
INSERT INTO j_2irg1bal VALUES wa.
ENDIF.
WHEN OTHERS.
"If Record is exits in j_2irg1bal table then delete it because it is not releavet for RG1 Register
IF NOT lv_rgbal IS INITIAL.
"Here we Delete that record from j_2irg1bal table.
DELETE j_2irg1bal FROM lv_rgbal.
ENDIF.
ENDCASE.
ENDIF.
ENDENHANCEMENT.

Activate the code and enhancement.

Output:

Check in Go to Transaction ‘J1ID’ .


Select Material and Chapter-ID Combination and Click On .

Click on .

Put on the Material No, Plant, Chapter ID and Select Material Type Only ‘RG1’.

Please Check Table ‘J_2IRG1BAL’.

Thanks & Regards,

Sagar Dev