Customer Enhancement of BAPIs


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.

Customers can use only fields of data type CHAR and similar data types in BAPI table extensions.

For more guidelines on table extensions, see Appending Customer Fields.

  • 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.

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: Business Add-Ins.


In detail, the customer enhancement concept for BAPIs supports the following types of enhancement:

  1. 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:
    1. 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.

    2. 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.

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.

  1. Enhancing the BAPIs by including additional customer database tables
    The enhancement concept also allows customers to process their own tables in a BAPI.

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.

  1. 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.

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 Tables

Enhancing the BAPI by Including Additional Customer Database Tables

Enhancing the BAPI with Import Data that Does Not Affect the Database Level

Actions by the BAPI Developer

Actions by the Customer

Use with the Standardized BAPIs