Customer Enhancement of BAPIs
Purpose
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.
Implementation Considerations
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:
-
Extension parameters at the BAPI interface
Depending on the requirements made of the BAPI in question, the BAPI developer creates one extension parameter for the data import ( ExtensionIn ) and/or one extension parameter for the data export ( ExtensionOut ) in the interface of the BAPI function module. These extension parameters serve as a container in which all the customer enhancements are passed to the BAPI. The extension parameters are always based on the BAPIPAREX structure.
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: Enhancing the BAPI Based on Existing SAP Database Tables , Enhancing the BAPI by Including Additional, Customer Database Tables , and Enhancing the BAPI with Import Data that is Not at Database Level .
-
Business Add-Ins (BAdIs)
Each BAPI function module must contain a maximum of two extra BAdIs in addition to the exits provided by the application. The first BAdI must enable customers to check all the data that is transferred to the BAPI. In particular, the content of the ExtensionIn parameter should be checked before its contents are processed further in the BAPI. The second BAdI is provided whenever the customer is allowed to perform additional processing activities (such as writing to additional tables, reading additional values, or selecting data by additional criteria). If the customer has enhanced the export parameter of the BAPI, the second BAdI should be used to fill the ExtensionOut parameter.
Features
In detail, the customer enhancement concept for BAPIs supports the following types of enhancement:
-
Enhancement to the BAPI based on existing SAP database tables
The customer can consider values in the BAPI that are contained in the underlying SAP database tables, but are not included in the supplied BAPI interface. We differentiate between two different applications:
-
Appending customer fields to SAP tables
In this case, the customer has appended additional customer fields to the SAP tables used by the BAPI. As a result, the enhancement concept must allow these additional values to be passed on to the BAPI, processed in the BAPI, and/or returned by the BAPI.
-
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
If the SAP developer did not add all the table fields of the underlying database tables to the BAPI interface, customers can subsequently add these fields to the BAPI.
-
Enhancing the BAPIs by including additional customer database tables
The enhancement concept also allows customers to process their own tables in a BAPI.
-
Enhancing the BAPI with import data that does not affect the database level
In addition to the enhancement of BAPIs with values that affect database tables, customers can also pass values on to the BAPI that are only required at runtime.
|
Important: |
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 Tables
Enhancing the BAPI by Including Additional Customer Database Tables
Enhancing the BAPI with Import Data that Does Not Affect the Database Level