Enhancements Using BAdIs
BAdIs are created in Enhancement Builder as a part of the enhancement concept of ABAP Workbench. These BAdIs, together with their calling points in ABAP programs, form explicit enhancement options of these programs are are assigned to enhancement spots.
If BAdIs and their calling points are defined in a system, enhancements can be made in follow-on systems by creating BAdI implementations in these systems. A BAdI consists mainly of a BAdI implementation class whose instances enhance the functions of an ABAP program at runtime in the form of an object plug-in. In the enhancement concept, a BAdI implementation is an enhancement implementation element and is administrated by enhancement implementations.
A BAdI consists mainly of a BAdI interface that contains the declaration of BAdI methods, and a set of filters. The filters enable certain BAdI implementations to be selected for use. The following settings can be made in the definition of a BAdI, in addition to the selection of the BAdI interface:
- Whether a BAdI is intended for single or multiple use. If a BAdI is intended for single use, only a single BAdI implementation can be used in one internal session, and one BAdI implementation must be available for each use.
- A fallback BAdI implementation class can be specified to be used if no BAdI implementation matches the filter conditions.
- A BAdI can be defined as context-free or context-dependent. This setting controls the instantiation of the object plug-ins. In context-free BAdIs, it is possible to define whether an object plug-in can be generated only once or multiple times within an internal session. For context-dependent BAdIs, the object plug-ins are associated with a context object.
Unlike earlier BAdIs, the new BAdIs are supported directly by the ABAP runtime environment with the following ABAP statements:
The BAdIs of the enhancement concept are also freely switchable using switches from Switch Framework.
- For a BAdI intended for single use, it is best to always enter a fallback implementation class and to implement it in the same system as the BAdI.
- See also Enhancements with BAdIs.