Step-by-Step Guide to create Custom BADIs

This article will help you to create Custom BADIs in on your own with few steps.

Custom BADI:

In Standard BADIs the developer will handle only the implementation part. The definition and BADI trigger part is already handled by SAP.

But in case of Custom BADI the definition, trigger and implementation must be handled by developer.



Step-by-Step Guide to create Custom BADIs

Steps to create and implement Custom BADI

1) Creation of custom enhancement spot (SE18).



2) Create a custom BADI definition in custom enhancement spot.





3) Enter custom interface name starting with Z* (ZIF_EX_CBADI1) and click on enter to create new interface.



4) Create any simple method in interface


5) Activate interface and go back to enhancement spot




6) Create custom enhancement implementation (SE19). 
    - Goto SE19 tcode and create implementation for ZCBADI1.



As this BADI is created in newer version (after ERP 6.0) we must create BADI implementation in new BADI section using enhancement spot name.


After entering the enhancement implementation name and clicking on OK now the GUI will ask for BADI implementation name. BADI definition contains the BADI created in enhancement spot. 

For classic BADIs we create BADI implementation directly using the BADI name. After 6.0 version as the BADIs are moved to enhancement spots we must create the BADI implementation from enhancement spot.

7) Provide BADI implementation name, implementation class (Naming convention should be like custom implementation class created for standard BADI ZCL_IM_* ) and select the BADI definition name. Click on OK 






    Double click on MD1 method to add logic.

8) Create custom BADI implementation in same custom enhancement implementation (SE19).


Multiple implementations for the same BADI can be created if it is multiple use BADI. We can do BADI implementations from SE18 also by just right click on the BADI definition and click on create BADI implementation.





Trigger custom BADI from report program.
  • Create a custom program and call BADI methods. 
  • Create object using GET BADI statement with object referring to BADI 
  • Call BADI method using CALL BADI statement.

Important:

We can’t directly create custom BADI using BADI name. The BADI definition can only be created as a part of Enhancement spot.





Post a Comment

Previous Post Next Post