BAdi’S (Business Add-ins)

BAdi’S :
It is another way of  implementing enhancements to the standard programs with out modifying the original code.
BAdi’s are implemented using oo programming technique
Technically a BAdi is nothing but an interface.
Each BAdi consists of the method with out implementation called as BAdi definition.
We need to create classes to write the abap code by implementing the methods called as BAdi implementation.
Se18 is the tcode for  BAdi definition.
Se19 is the tcode for  BAdi implementation.
The interface name for a BAdi will be as below.
Ex:- IF_EX_<BAdi NAME>
The class name for a BAdi will be as below.
 Advantages of  BAdi’s:
The main advantage of using BAdi’s is , we can create multiple implementations for a single BAdi  definition.
Where as with the exits, we can create a  single implementation.
i.e  A single project for a enhancement.
We cannot create another project (implementation) for enhancement which is already used. That is  why we go for BAdi’s.
Types of BAdi’S:
Single implementation BAdi.
Multiple implementation BAdi.
Filter BAdi.
Custom BAdi (Not used/Rarely used)

Single implementation BAdi:-
A BAdi which has only one implementation (single class) is called single implementation BAdi.

Multiple implementation BAdi:-
A BAdi which has multiple implementations is called multiple implementation BAdi.
By default all the implementations will be executed.
We cannot control the sequence of execution of multiple implementations

Filter BAdi:-
It is type of BAdi which has a filter value so that only those implementations which satisfy the filter value are executed.
The remaining implementations are not executed this type of  BAdi is called a filter BAdi.
The filter value will be DE generally .
Examples of filter values are land1,bukrs,werks

Properties of BAdi’S: 
If  WITH IN SAP checkbox is selected then this BAdi is only used by sap.
If multiple use checkbox is selected then it is a multiple implementation BAdi.
If multiple use checkbox is not selected then it is a single implementation BAdi.
If filter dependent checkbox is selected then it is filter dependent BAdi.
We need to specify the filter type such as land1,bukrs,werks.for the filter BAdi.

Finding the BAdi for a TCODE.

There are 2 ways for finding a  BAdi.
1)Using class CL_EXITHANDLER
2)Using SE84 Tcode

Using class CL_EXITHANDLER :
CL_EXITHANDLER  is the class and GET_INSTANCE  is the method to find the list of the BAdi’s for transaction.
Steps :
Go to se24.
Give the class name as CL_EXITHANDLER.
Click on display.
Double click on the method GET_INSTANCE  and  Put a break point on the below  method GET_CLASS_NAME_BY_INTERFACE

Second method using se84

Find the package name for a transaction code
Go to se84.
Expand enhancement folder.
Expand business add ins folder.
Double click on the definition.
Give the package name.
Click on execute.
Ex:- give the package name as VA.
Click on execute.
The  list of BAdi’s  are displayed.
Next Post »