Customer Enhancement of BAPIs

Use

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:

  • Creating the extension parameter in 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 individual entries in this table is determined by the structure BAPIPAREX. This structure contains multiple data entry fields (VALUEPART1, VALUEPART2, ...) as well as a field for the name of a help structure created by the customer (STRUCTURE). The data is written to the fields entry by entry, which is why a help structure is needed to interpret the data. BAPI table extensions are particularly suitable if a customer wants to extend an SAP database table with additional fields. 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 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:

  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.

      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.

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

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