Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Purpose:

 

We often try modifying/coping/repairing a standard BAPI to transfer user-specific data to BAPI instead of customer enhancement concept. This is an example where we can pass customer data into SAP through BAPI and populate the same in the Sales Order screen.

 

 

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.

 

Technical Information:

  • Use EXTENSIONIN parameter to transfer user-specific enhancements to a BAPI.
  • Say, the customer wants to maintain two additional fields (Reference Document, Reference Date) in the item level for Sales Orders.
  • Add these two fields in VBAP (Sales order item table) using include structure.
   

                                Structure Name: ZCUST

                                Fields: REFDOC, CHAR 10

                                           REFDAT, CHAR 8

  • Define a ZCUSTX checkbox structure as BAPI uses checkbox structure to update fields. It should be structured like this:

                                Structure Name: ZCUSTX

                                Fields: REFDOC, CHAR 1

                                            REFDAT, CHAR 1

  • Define the above customer structures in the structures VBAPKOZ und VBAPKOZX using INCLUDE or APPEND.
  • Add the customer structures to the BAPE_VBAP and BAPE_VBAPX BAPI structures using the APPEND technique.
   
  • Adjust the following structures for customer enhancements to table VBAK:

          a) VBAKKOZ

          b) VBAKKOZX

          c) BAPE_VBAK

 

          d) BAPE_VBAKX

 

  • Adjust the following structures for customer enhancements to table VBEK:

          a) VBEPKOZ

          b) VBEPKOZX

          c) BAPE_VBEP

          d) BAPE_VBEPX

 

  • Generally, the data should be added to the BAPI interface in the internal communication structures (VBAKKOM, and so on). There, you can process the data in the SD tables (VBAK, and so on).
  • If the EXTENSIONIN parameter contains customer data, you must complete at least the key fields in the relevant standard parameters.
  • 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.
       

For example:


You want to change customer field VBAP-REFDOC & VBAP-REFDAT for item 30 to "XYZ" in order 2200.

The following entries are expected:


Import:     BAPIVBELN-VBELN       = '0000002200'    "Document number
                BAPISDHD1X-UPDATEFLAG = 'U'             "UPDKZ for doc header
Tables:     BAPISDITM-ITM_NUMBER  = '000030'      "Item number
                BAPISDITMX-ITM_NUMBER = '000030'     "Item number
                BAPISDITMX-UPDATEFLAG = 'U'              "UPDKZ for item

You must complete the EXTENSION table as follows:

STRUCTURE                          VALUEPART1       1234561234567890123
BAPE_VBAP                       0000002200000030  REF100    20071029
BAPE_VBAPX                     0000002200000030  XX

You DO have to count out the character length of each field in the database table (like VBAP) to find where to put your stuff.

 

Showing the above customer fields in the Item Screen (Additional Data B) of Sales Order transaction

1. As there is no standard User Exit / BADI for populating data to the additional data B screen in Sales Order Data Item, We have to go for an Access Key get registered from SAP for

       Program: SAPMV45A

       Screen  : 8459

2. Using Screen Painter (T.Code SE51), add the required fields to the screen.                       

3. Save and activate it, so that the fields populated through the BAPI will appear on the screen.

Advantages:

1. Easy way of populating customer-own data in standard system

2. Changes to BAPI interface not required

3. No extra coding required, only tables need to be appended.

4. SAP changes to the BAPI activated automatically

5. Customer exits or Business Add-Ins (BAdIs), which are implemented using the enhancement concept, do not have to be reprogrammed.

Disadvantages:

1. Only fields of data type Char is allowed

2. As this is a new concept from version 4.5B, All the BAPIs do not have this facility of enhancement.

3. All BAPIs do not have this Extension Structure.