You should use the customer enhancement concept whenever it is important for you to automatically activate subsequent SAP changes to the BAPI, but these SAP changes should not affect the customer enhancements.
To meet these two requirements, it is essential that you do not change the BAPI parameters. Instead, customer enhancements are passed to the BAPI in a container, and can be processed within the BAPI function module. Accordingly, the following minimum precautions must be taken for every BAPI that can potentially be enhanced:
The data is transferred in one table. The format of the data records in this table is determined by the BAPIPAREX structure. This structure contains multiple data record fields (VALUEPART1, VALUEPART2, ...) and one field for the name of the help structure (STRUCTURE). Since the data for each data record is written to the corresponding data record fields in parts one after the other, a help structure is required for interpreting the data.
If customers want to add fields to an SAP database table, we recommend that they use BAPI Table Extensions as help structures. A BAPI table extension can either have been created by SAP or by the customer. For examples of help structures or BAPI table extensions, see the following documentation about customer enhancements:
Customers can use only fields of data type CHAR and similar data types in BAPI table extensions.
For more guidelines on table extensions, see
Up to now, customer exits have been used for customer enhancements to BAPIs. As of Release 4.6C we recommend that you use BAdIs.
For more information about BAdIs, see the documentation in the SAP Library:
In detail, the customer enhancement concept for BAPIs supports the following types of enhancement:
New fields are appended to a standard SAP table, and they are subject to the detail parameter of a GetDetail() BAPI. When this GetDetail() BAPI is called, the export container (ExtensionOut) can be used to return the additional detailed information. The customer can fill the ExtensionOut in a BAdI.
This type of BAPI enhancement necessitates a separate concept, since, although the customer can make enhancements to the database table using APPEND or INCLUDE, the APPEND technique is prohibited with the associated BAPI structures for reasons of compatibility.Using existing database fields
In a GetDetail() BAPI, the SAP table with the detailed values contains more fields than the corresponding detail parameter in the BAPI. If customers want to return some of the values contained in these fields, they can use the export container (ExtensionOut), which they filled previously in the BAdI.
You can also combine both methods, appending customer fields to a database table and add existing fields to the BAPI. This option is described in detail under Combination of Appending Customer Fields and Adding Existing Database Fields.
The customer uses separate tables to hold additional values for an object created by a Create() BAPI. These values can be passed on to the BAPI using the import container (ExtensionIn) and written to the customer tables within a BAdI in the BAPI.
The customer wants to add an additional selection criterion to a GetList() BAPI. To do this, the customer can use the ExtensionIn parameter to pass on the selection criteria and use the BAdI to make the selection.
Since the extension parameters are defined in the BAPI and supported in the BAdIs, customers can automatically use all three types of enhancement for the BAPI. If the customer requires additional support for implementing certain types of enhancement, then additional precautions, which are described in the next chapter, are required.
See also:Enhancing the BAPI Based on Existing SAP Database TablesEnhancing the BAPI by Including Additional Customer Database Tables Enhancing the BAPI with Import Data that Does Not Affect the Database LevelActions by the BAPI DeveloperActions by the CustomerUse with the Standardized BAPIs