Working with BADI’s in SAP ABAP

What is BADI?

BADI stands for Business Add-in. BADI’s are an enhancement concept which uses ABAP objects. Totally an object-oriented method to enhance classes, interfaces, methods.

You need to first define a BADI to enhance a SAP application program. The developer needs to create an interface for the BADI. An Adapter class is created from this that will implement the interface. Developers need to create an instance of the adapter class in the SAP Application program and create method calls as required.

Working with BADIs

Business add-ins are the enhancements to standard SAP’s version. They can be inserted to accommodate the business requirements.  Here are the steps in working with a custom BADI inside SAP.

Defining BADI

1. Go to SE18 and create the BADI definition. Provide an appropriate description and the interface will be automatically created.
2. Double click on the interface and create the required methods inside the methods tab and add required parameters.
3.  Activate the BADI Definition.

Implementing BADI

1. Go to SE18, type in the BADI which has already been defined either the one previously created or the one which exists in the system.
2. Click on Menu: Implementation -> Create and provide an implementation name.
3. Double click on the method name and write the required code.

Here is what is usually happening where ever the BADI is called inside the ABAP program.

( Exporting exit_name = ''
               null_instance_accepted = 'X'
  Changing instance   = oref_badi_instance )
"Call to Methods defined in the badi definition