Note 366265 – How should I fill the BAPI parameters

All QuestionsCategory: TutorialsNote 366265 – How should I fill the BAPI parameters
Profile photo of SAP guruSAP guru Staff asked 10 months ago

During tests or writing documentation for the development there is a need to find and run on standard Bapi in ABAP.
You can search in Google or manual refer to the official documentation for SAP.
There is a SAP Note, which describes the parameters for the SAP SD Bapi – Note 366265 – How should I fill the BAPI parameters.

Let’s look at except of this Sap Note. Full text you can find on SAP service portal.

Header
Version / Date 12 / 2007-07-18
Priority Recommendations/additional info
Category Consulting
Primary Component SD-SLS-GF-IF Sales Documents BAPI’s
Secondary Components

Summary

Symptom

There are always questions and unclarities about how to fill the parameters of the BAPIs.
This note should collect and document these questions and their answers.

Other terms

BAPI_CUSTOMERINQUIRY_CHANGE, BAPI_CUSTOMERQUOTATION_CHANGE,
BAPI_SALESORDER_CHANGE, BAPI_CUSTOMERCONTRACT_CHANGE,
BAPI_CUSTOMERRETURN_CHANGE, SD_SALESDOCUMENT_CHANGE,
BAPI_INQUIRY_CREATEFROMDATA2, BAPI_QUOTATION_CREATEFROMDATA2,
BAPI_SALESORDER_CREATEFROMDAT2, BAPI_CONTRACT_CREATEFROMDATA,
BAPI_CUSTOMERRETURN_CREATE, SD_SALESDOCUMENT_CHANGE

Reason and Prerequisites

*

Solution

    1. You should use the CHANGE BAPI to add a new item:
      a) BAPISDITM, here you enter the item data
    • ITM_NUMBER
    • PO_ITM_NO required entry during configuration
    • MATERIAL
      b) BAPISCHDL, here you enter the schedule lines
    • ITM_NUMBER
    • SCHED_LINE
    • REQ_DATE
    • REQ_QTY
      c) BAPIPARNR, here you enter alternative item partners
    • PARTN_ROLE
    • PARTN_NUMB
    • ITM_NUMBER

potential data for the configuration, below you find the fields that you must fill as a minimum:

      d) BAPICUCFG, configuration: Reference data
    • POSEX External Item Number
    • CONFIG_ID   External configuration ID (temporary)
    • ROOT_ID Instance number in the configuration
      e) BAPICUCFG, configuration: Instances
    • CONFIG_ID   External configuration ID (temporary)
    • INST_ID    Instance number in the configuration
    • OBJ_TYPE Object type
    • CLASS_TYPE Class type
    • OBJ_KEY     Object key
    • QUANTITY    Instance quantity
      f) BAPICUVAL   configuration: Characteristic values
    • CONFIG_ID   External configuration ID (temporary)
    • INST_ID    Instance number in the configuration
    • CHARC Characteristic name
    • VALUE       Value of a characteristic
    2. Configuration data when you create or change data. The characteristic value assignment must be entered completely here. Also refer to the information about the configuration in Note 93091.

 

    3. Item changes
      a) Deleting an item

BAPISDITM, here you enter the item number.

BAPISDITMX, here you specify the item number and the update flag ‘D’ here.

Since this is a document change, you must specify the update flag on header level ‘U’ (BAPISDH1X-UPDATEFLAG).

      b) Create an item that has several schedule lines.

You must specify the checkbox list for the schedule lines (BAPISCHDLX) here.

BAPISDITM     Communication fields: Sales document item

    • ITM_NUMBER    Sales document item
    • MATERIAL      Material number

BAPISCHDL     Sales and distribution document schedule line

    • ITM_NUMBER    Sales document item
    • SCHED_LINE    Schedule line number
    • REQ_DATE      Schedule line date
    • REQ_QTY       Order quantity of customers in sales unit

BAPISCHDLX:   Checkbox list for a sales and distribution document schedule line

    • ITM_NUMBER    Sales document item
    • SCHED_LINE    Schedule line number
    • UPDATEFLAG    Update indicator
    • REQ_DATE      Checkbox
    • REQ_QTY       Checkbox
    4. Document addresses

There are two options to enter document addresses in the BAPI

      a) Partner table (BAPIPARNR, BAPIPARNR), where the most important address fields are defined. When you enter the address, you should always enter the language key and the country code as well.
      b) Address table (BAPIADDR1), as an alternative you can also use this address table to enter the address.

You then have to use the address link (BAPIADDR1-ADDR_NO) to define the connection to the partner table (BAPIPARNR-ADDR_LINK/BAPIPARTNR-ADDR_LINK):

If you want to change an address in the sales document, you always have to enter the address completely.