A BAdI is an object-oriented enhancement option, a hook for an object plug-in and thus the most sophisticated enhancement type. The main characteristic of a BAdI is that it provides a mechanism to change the functionality of a well-defined business function (e.g. a BAPI) without making changes to the delivered source code. Future upgrades of the original business function can be applied without losing the customer-specific enhancements or the need to merge the changes.
When defining a BAdI, you determine its interface - the methods offered by the BAdI. BAdI implementations are classes that implement the BAdI interface. Typically, these implementations are created in another development layer; for example, as objects owned by the customer that is in the customer name space, while the BAdI definition and the call of the BAdI methods belong to the SAP namespace. Calling a BAdI method resembles a dynamic method call with a specified interface. Which methods are actually called is determined by the active BAdI implementation. In contrast to a dynamic method call, the relevant BAdI implementations are selected at compile time.
The BAdI technology is not limited to SAP applications. BAdI calls can be integrated in customer applications, which in turn can then be enhanced by other customer applications.
The new BAdI concept takes advantage of SAP's extensive experience in offering customers different ways to enhance the standard SAP system. The new BAdIs add some major improvements to the classic BAdIs such as better performance. The new BAdIs are integrated in the kernel and are switchable.
The reimplementation of BAdIs has two main goals:
The new ABAP language elements and their additions ensure that these additional options can be easily used in ABAP programs.
Within the Enhancement Framework, a new BAdI is always meant when the term BAdI is used. If there is an explicit reference to the previous BAdI concept, such BAdIs are referred to as classic BAdIs.
The following examples explain some of the most common problems that BAdIs solve:
The solution is a BAdI which is a type of enhancement with a well-defined interface; BAdIs are more robust to changes than source code plug-ins.
The solution is to create a BAdI definition in the core and the different countries can add their own implementations.
The solution is to create an internal BAdI and add the different parts in different implementations. The BAdI and its implementations may belong to different software layers.
The solution is to include BAdI calls in the standard software. The customer can add the implementations of these objects later.
The solution is to put the country-specific parts in BAdI implementations. These implementations can be overwritten later for the respective countries without modifying the original program that contains the BAdI calls.
It is possible to use the BAdI infrastructure to build a high-performance registry. In that case, the filter is used as selection criteria for the registry.
More information:
BAdIs - Migration of Classic BAdIs