Implementing a Classic BAdI

A list of the classic Business Add-Ins available in your system can be found either in the SAP Reference Implementation Guide (IMG) or in the component hierarchy. BAdI definitions are included in the IMG so that the customer/partner can create suitable, company-specific implementations.

In the SAP Reference IMG, BAdI implementations - in addition to BAdI definitions - can be provided. This would be suitable in cases where you can see in advance which functions are required by the customer. Using a BAdI implementation, the customer/partner can simply switch the delivered implementations on or off, as required. In the SAP Reference IMG, choose  Execute in front of the name of the BAdI implementation. The icon serves as a switch for activating and deactivating the implementation.

Starting from the name and the documentation of the enhancement, you can create an implementation. During the implementation, the system creates a class that implements the enhancement’s interface. The implementation is a separate transport object and lies within the namespace of the person or organization implementing it.

For the example given here, you are to create an implementation for the string conversion. You need to program the interface method in such a way that, when the add-in is called from the application program, the string is actually converted in the way the add-in user wants it.

To create an implementation, proceed as follows:


       1.      In the SAP menu, choose ABAP Workbench ® Utilities ® Business Add-Ins (transaction SE19) or double-click the corresponding activity in the Implementation Guide (IMG).

       2.      Enter a name for the implementation and then click the Create pushbutton.

       3.      Enter the name of the add-in you want to create an implementation for in the dialog box that appears.

       4.      Enter a short text describing your implementation on the following screen.

       5.      Choose the Interface tab.

       6.      Choose ABAP Code as the implementation type.

Besides ABAP Code, there is also the Formula option. If you choose Formula, the content of a method is determined using the Formula Builder. For more information on this, refer to the section Implementing Methods Using the Formula Builder.

       7.      Navigate to the Class Builder by double-clicking the method. You must first enter a package before the Class Builder is displayed.

       8.      Insert the desired source code for the implementation between the method if_ex_businessaddin~method. and endmethod.statements that already exist. 

Relating to our example, you could enter the statement translate parameter to upper case.

       9.      Save your entries and return to the Change Implementation screen.

   10.      Choose Activate. You may now use this implementation when the application program is executed.

Several implementations may exist for a Business Add-In that is not used on a multiple basis. However, only one implementation can be active at any one time.

What is also important is that you must declare the instance generation of the implementing class (Attributes tab) as public and not as private, protected, or even abstract. If you do this, the system will return short dumps at runtime.


See also:

Calling Implementations Through Filter Mechanisms