Thursday, February 3, 2011

BADI implementation for transaction CS01

Aim: To create a BADI implementation for CS01 transaction, that does not allow user to create alternative BOMs for already created BOM.

Hint: If an alternative BOM is created the field STALT from MAST table will be increased by 1. We can control future creation of BOM using this field. Or if the particular material for which we are creating BOM has an entry in MAST then we should not allow to create again. So the Badi can be approached in two ways. But I use the former method in this example you try the latter method.

Step1:

Keep a break point in “CALL METHOD cl_exithandler=>get_class_name_by_interface” line inside the get_instance method of the class cl_exithandler in Class builder (SE24).

Step2:

Now execute CS01 transaction, you will see the debugger that you set in SE24 transaction. Double click on the changing parameter “EXIT_NAME”. Press F8 sequentially and make a note of the exit names.

Step3:

After you see CS01 just continue with the BOM creation and in mean time note all the Exit names that you come through in the debugger.

Continue with BOM creation as follows.




Step4:

Click on save to find final set of BADI’s.

The BADI’s triggered is as follows.

Before SCREEN1

BOM_IPPE

IPPE_DOCID

IPPE_ENG_CHECK_EXT

W_RETAIL_SYSTEM_IDENT

Before SCREEN2

ECM_BOM_DECO

ECM_DOC_DECO

ECM_IPPE_DECO

ECM_MAT_DECO

ECM_055_DECO

ECM_060_DECO

ECM_061_DECO

ECM_062_DECO

ECM_ROUT_DECO

ECM_075_DECO

ECM_077_DECO

ECM_079_DECO

After clicking save:

BOM_UPDATE

BOM_EXIT

EHSS_SPEC_CHECKS

Step 5 :

Search for the “STALT” field inside any of the methods inside the BADI classes.

Shortcut : I know it’s the time killing process so I suggest you an easier way to find the specific class and method. Goto se19 in create implementation block under classic BADI enter the BADI names one by one and find out weather implementation can be created or not. After doing this you will have very less BADI’s now go to SE24 and add cl_ex_(BADI NAME) and check for methods that have the parameter STALT.

Step 6:

After finding the BADI and method in which you want to implement the code. Goto SE19 and create implementation for that particular BADI.

Step 7:

Enter implementation short text

Step 8 :

Click on interface tab.

Step 9 :

Double click on the method in which you want to write code as decided. You will see the following.

Step 10 :

Write the following code in the method.

method IF_EX_BOM_UPDATE~CHANGE_AT_SAVE.

if I_STLAL > 1.
message 'Alternative BOM cannot be created for this particaular material' type 'W'.
endif.

LEAVE PROGRAM.

endmethod.

Step 11 :

Save and activate the code and come back.

Step 12 :

Activate the Implementation and go to CS01 and try to create BOM for second time.




No comments:

Tutorials on SAP-ABAP

Adobe Interactive Forms Tutorials

Business Server Pages (BSP)

Userexits/BADIs

Web Dynpro for ABAP (Step by step procedure for web dynpro,Tutorials on Web Dynpro,)

ALV Tutorials

Blog Archive

goodsites