BADI is another way of implementing enhancements to the standard programs without 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 without 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 T-code for BADI definition, SE19 is the T-code for BADI implementation.
Advantages of BADI
The main advantage of using BADI’s is, we can create multiple implementations for a single BADI definition.
Whereas with the exits, we can create a single implementation I.e. a single project for an enhancement.
We cannot create another project (implementation) for enhancement which is already used. That is why we go for BADI’s.
Types of BADI
Single implementation BADI.
Multiple implementations BADI.
Custom BADI (Rarely used)
Single implementation BADI: – A BADI which has only one implementation (single class) is called single implementation BADI.
Multiple implementations BADI: – A BADI which has multiple implementations is called multiple implementations 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.
Properties of BADI
Within SAP: Usage limited to SAP – This indicator defines that the BADI definition is only designated for internal SAP usage. Creation of BADI implementations by the customer is therefore not possible.
Multiple Use: Multiple use for BADI definitions means that there can be several active BADI implementations. When there is a call, they are all called up – however, in an unpredictable sequence. If you have multiple-use BADI definitions, the sequence must not play any role therefore. A typical example is the execution of checks before a save.
Filter-Dependent: Filter dependence for BADI definitions means that each interface method automatically has an importing parameter FLT_VAL assigned to it. This parameter must be filled with a filter value as current parameter when it is called. A BADI definition should be marked as filter-dependent whenever the characteristic of the BADI implementation should match the characteristics of the filter type – that is, whenever the implementation of different filter values should be different or should only exist at all for certain filter values. Typical filter types are line of industry or country.