BADI Introduction
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.
BADI Definition To define / create New BADIs for our application Programs (TCode SE18)
BADI Definition
Cont…
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
BADI Definition
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 = exp_par2 = IMPORTING imp_par =
Cont…
BADI Implementation To Implement the defined BADI and to enable our enhancement (TCode SE19)
BADI Implementation
Cont…
Enter implementation short text and choose Interface tab, select method to add code
BADI Implementation
Cont…
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)