Implementing SAP BADI
Implementing SAP BADI
Implementation of BADI in SAP ABAP is neither easy nor difficult but if you have some experience to find the appropriate method of BADI. Then you can simply implement the BADI ,Finding a BADI is somewhat difficult ,we have to find right parameters that are import and export parameters of BADI method .for that there are three methods to find a BADI.
Here , i am creating BADI implementation for CS01 transaction, that does not allow user to create alternative BOMs for already created BOM. Now let us learn the how to implement BADI.
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:
Our required BADI is BOM_UPDATE in which we have to write our code.
Step 5 :
Search for the “STALT” field inside any of the methods inside the BADI classes.
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.
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.
Finally ,we have learnt ,how to implement SAP BADI ,steps for implementing BADI.
Finally ,we have learnt ,how to implement SAP BADI ,steps for implementing BADI.
Comments
Post a Comment