Ads

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.


Implementing SAP 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).
Implementing SAP BADI





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.

Implementing SAP BADI


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.
Implementing SAP BADI

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.




Implementing SAP BADI
Implementing SAP BADI



Enter implementation short text

Implementing SAP BADI


Step 8 :

Click on interface tab.

Implementing SAP BADI


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

Implementing SAP BADI


Step 10 :Write the following code in the method.
Implementing SAP BADI



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.

Implementing SAP BADI


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.

Comments

Popular posts from this blog

BADI Interview Questions in SAP ABAP

Sample SAP ABAP Programming Examples for Practice

Module Pool Programming Interview Questions and Answers in SAP ABAP

Step by Step tutorial on BDC Session Method Program in SAP ABAP

SAP ABAP Interview Questions and Answers for 10 Years Experienced