This action might not be possible to undo. Are you sure you want to continue?
What is BADI?
BADI - Business Add-Ins Business Add-Ins are a new SAP enhancement technique based on ABAP Objects. Each Business Add-In has :
– at least one Business Add-In definition – a Business Add-In interface – a Business Add-In class that implements the interface
BADI - Views
Each BADI has two different Views. Definition view: an application programmer predefines exit points in a source that allow specific partners and customers to attach additional software to standard SAP source code without having to modify the original object. Implementation view: the users of Business AddIns can customize the logic they need or use a standard logic if one is available.
To define / create New BADIs for our application Programs (TCode SE18)
When a BAdI Definition is created, BADI class gets automatically created with the suffix ‘CL_EX_’ after the first character of the BAdI name. An interface is created automatically with the suffix ‘IF_EX_’ after the first character of the BAdI name
Calling BADI in Application Program
REPORT ZBADI_DEMO CLASS cl_exithandler DEFINITION LOAD DATA : l_badi_instance TYPE REF TO IF_EX_BADI_DEMO Selectio screen declaration START-OF-SELECTION CALL METHOD CL_EXITHANDLER=>GET_INSTANCE EXPORTING EXIT_NAME = ‘ZBADI_DEMO’ NULL_INSTANCE_ACCEPTED = ‘ X’ CHANGING INSTANCE = l_badi_instance EXCEPTIONS OTHERS = 1.
CALL METHOD l_badi_instance ->calculate_rates “method in the badi EXPORTING exp_par1 = <value> exp_par2 = <value> IMPORTING imp_par = <value>
To Implement the defined BADI and to enable our enhancement (TCode SE19)
Enter implementation short text and choose Interface tab, select method to add code
Add Code in the method and activate it. Run the transaction to check the logic added.
How to Search for BADI’s
Search for String “CL_EXITHANDLER=>GET_INSTANCE” In application Hierarchy of BADI Definition For new Dimension products – all BADIs are listed in the IMG (TCode: SPRO)