Enhancing the BAPI by Including Additional Customer Database Tables


The customer enhancement concept makes it possible for customers to process tables they have defined themselves in a BAPI.

Implementation Considerations

To enable the customers to implement this type of enhancement, at least the following precautions must be implemented in the BAPI:

  1. Extension parameters at the BAPI interface
    Depending on the requirements made of the BAPI in question, the interface of the BAPI function module must contain one extension parameter for the data import (ExtensionIn) and/or one extension parameter for the data export (ExtensionOut).
  1. Business Add-Ins (BAdIs)
    For this case, as well, each BAPI function module must contain a maximum of two extra BAdIs in addition to the exits provided by the application. The customer can perform data verification or other processing in these BAdIs.

The extension parameters at the BAPI interface and the BAdIs are mandatory. In contrast, the order in which the data from the new customer tables is passed to or taken from the extension containers is entirely up to the customer.
As a result, the use of BAPI table extensions is not absolutely necessary for the types of enhancement described above. We do recommend, however, defining help structures for the new tables, as they allow the extension containers to be filled and evaluated with more certainty.


In the example below, BAPI TravelAgency.CreateFromData is used to illustrate which components are involved in this type of enhancement. In this example, the customer has created her own table, YSTRAVELAG, in addition to the underlying SAP tables for the BAPI, and uses this table to store additional data for object TravelAgency.

The Defined Customer Table

The customer table YSTRAVELAG has the following structure:

The Corresponding Help Structure

To simplify the filling and analysis of the extension parameters, each customer table should have a data structure containing the fields from the corresponding customer table that will be taken into account in the BAPI. In the process, make sure to observe the following:

  • The individual fields of this data structure should have the same names and data types as the corresponding fields in the customer table.
  • In particular, the data structure must contain all the key fields of the customer table, to enable unique identification of the data records.
  • The name of the data structure should following the naming convention <namespace>BAPI_<table_name> to allow a unique allocation to the database table.

The following diagram shows how help structure YBAPI_YSTRAVELAG should appear for this example:


Creating the help structure is optional, and only makes it easier to fill and evaluate the extension container. As an alternative, you can use other help structures or none at all.

Extension Parameters and BAPIs

As mentioned above, the two extension parameters (ExtensionIn and ExtensionOut) in the BAPI interface are used to pass on the enhancements to the BAPI function module or forward them from the function module to the calling program in container format.

In contrast to an enhancement using BAPI table extensions, there are no guidelines in this case for arranging the data in the extension containers.

If the help structure is used in the form described above, then the data structure in these containers is the same as the structure described under Appending Customer Fields (apart from one exception). The only difference is that field STRUCTURE of structure BAPIPAREX passes on the name of the corresponding help structure instead of the name of the BAPI table extension.

Continuing the above example, the extension container could look like this if help structure YBAPI_YSTRAVELAG was used:

The values "BOEING747", "LUFTHANSA", and "456 SEATS" in the first data record would be written to the fields of customer table YSTRAVELAG specified in YBAPI_YSTRAVELAG. The table line in which the values will be inserted is identified by key "4711".

The check and further processing of the data from the import container and the filling of the export container take place subsequently in BAdIs supplied by the BAPI developer.