!--a11y-->
Actions for an Enhancement Based on Existing SAP Database Tables 
Purpose
We assume that the customer wants to append his own fields to SAP tables involved in a BAPI and/or include additional existing fields from these tables in the BAPI after the fact.
Process Flow
In this case, the following steps are required at most:
An example is available under
|
|
The naming convention for BAPI table extensions is <namespace>BAPI_TE_<table_name>. | ||
|
|
Each table should only have one table extension. Therefore, if several BAPIs use the same table, they will have to share the table extension. | ||
|
Exception: |
If a BAPI has two or more parameters that refer to the same database table, then a separate BAPI table extension is created for each of these BAPI parameters. The naming convention in this case is <namespace>BAPI_TE<table_name><consecutive_number>. In our example, our table extensions would be named YBAPI_TE_STRAVELAG1, YBAPI_TE_STRAVELAG2, and so on. | ||
|
|
The structure of the BAPI table extension must contain all the identified key fields of the table to which the BAPI table extension relates. The table extension does not initially contain any other fields except the key fields. | ||
|
First add all existing fields from the corresponding table to the APPEND structure. | ||||
|
Then add the INCLUDE that contains the new customer fields to the same APPEND structure. Please note that you have to use the same INCLUDE in both the database table and in the corresponding BAPI table extension. |

Read the documentation about
Business Add-Ins.
The part for implementation can be described in pseudo-coding as follows:
|
FOR every extendable table X | ||||
|
REPEAT | ||||
|
Fill ExtensionIn-VALUEPART1 with key values. | ||||
|
UNTIL table X is processed | ||||
|
END FOR | ||||
|
Exception: |
It is not possible to give the container a key value in Create() BAPIs with internal number assignment, as these values are generated in the BAPI itself. In this case, you should give the container an initial key value. The BAPI developer has already anticipated the assignment of the key generated in the BAPI to the BAPI table extension. |
A detailed programming example on filling the ExtensionIn parameter and calling the enhanced BAPI is available in the
Examples.