Register Login

BAPIs in Sales and Distribution

Updated May 18, 2018

I. General information:

In Release 3.1G, the BAPIs for the business object BUS2032 were delivered for the first time, but were not yet released.

This applies to the following BAPIs:

1. BAPI_CUSTOMERORDER_CREATE
2. BAPI_CUSTOMERORDER_SIMULATE
3. BAPI_CUSTOMERORDER_GET_STATUS
4. BAPI_CUSTOMERORDER_GETLIST

The BAPIs were renamed as follows to ensure that the names of the methods are correct:

1. BAPI_SALESORDER_CREATEFROMDATA
2. BAPI_SALESORDER_SIMULATE
3. BAPI_SALESORDER_GETSTATUS
4. BAPI_SALESORDER_GETLIST

The BAPI BAPI_SALESORDER_CREATEFROMDATA can also create quotations and inquiries. As a result, this method can be used by several business objects. This is contradictory to the BAPI principles.

As of Release 4.0A, the following BAPIs are available for creating sales documents:

- BAPI_SALESORDER_CREATEFROMDAT1 Create sales order BUS2032
- BAPI_QUOTATION_CREATEFROMDATA Create customer quotation BUS2031
- BAPI_INQUIRY_CREATEFROMDATA Create customer inquiry BUS2030

For other sales business objects, separate BAPIs do not yet exist. For these, you can use BAPI_SALESDOCU_CREATEFROMDATA.
It is not released, but you can use it productively (live) like the BAPIs listed in section IV), and it is supported.

Example: Creating returns BUS2102; to do this, fill the parameter
BUSINESS_OBJECT with 'BUS2102'.

You can use BAPI_SALESDOCU_CREATEFROMDATA to create the following sales document categories:

  • BUS2034   Contracts
  • BUS2094   Credit memo request
  • BUS2096   Debit memo request
  • BUS2102   Returns
  • BUS2103   Subsequent delivery free of charge

The use of BAPI_SALESDOCU_CREATEFROMDATA is intended for Release 4.0. As of Release 4.5B, you should no longer use BAPI_SALESDOCU_CREATEFROMDATA. Instead, use the RFC-enabled function module SD_SALESDOCUMENT_CREATE. See section IV.) for more information. Miscellaneous information is available further below.

II.) Configuration:

How do I have to fill the configuration tables of the BAPIs?

The BAPIs use the same communication structures as IDoc processing. It is described in detail in the general SAP documentation.

This documentation is available on the DOCU CD under:

  1. Logistics - General
  2. Variant configuration
  3. IDoc processing, EDI for configurable materials

Use the field POSEX (PO_ITM_NO) to define the connection between the sales order item and the configuration (BAPICUFG-POSEX). (ORDER_ITEMS_IN-PO_ITM_NO = ORDER_CFGS_REF-POSEX)

As of Release 4.5B, there are BAPIs for changing sales documents. How do I have to fill the parameters to change a configuration?

The following entries are required:

  • SALESDOCUMENT  Document number of document to be changed
  • HEADER_INX-UPDATEFLAG U for update of the document
  • ITEM_IN-ITM_NUMBER Item number
  • ITEM_IN-PO_ITM_NO POSEX
  • ITEM_INX-ITM_NUMER Item number
  • ITEM_INX-UPDATEFLAG U update of the document item
  • The configuration tables CFGS_REF, CFGS_INST, CFGS_PART_OF, and​ CFGS_VALUE have to be filled as when you create, that is, the complete configuration data of the item to be changed has to be specified.

III.) Input data:

To create a sales document, you must enter at least the following data:

a) Header

  • Order type
  • Sales organization
  • Distribution channel
  • Division

b) Item: -

  • Material number, with leading zeros
  • Quantity

c) Partner

  • SP, sold-to party
  • Customer number, with leading zeros

IV.) Miscellaneous:

In Release 4.5B, the following BAPIs were developed:

- BAPI_SALESORDER_CREATEFROMDAT2
- BAPI_CONTRACT_CREATEFROMDATA
- BAPI_INQUIRY_CREATEFROMDATA2
- BAPI_QUOTATION_CREATEFROMDATA2
- BAPISDORDER_GETDETAILEDLIST
- BAPI_SALESORDER_CHANGE
- BAPI_CUSTOMERCONTRACT_CHANGE
- BAPI_CUSTOMERINQUIRY_CHANGE
- BAPI_CUSTOMERQUOTATION_CHANGE

Even though these BAPIs are not yet released, you can use them productively (live). Incompatible changes to these BAPIs are made only in urgent and justified exceptional cases.

For other sales business objects, there are no separate BAPIs. For these, you can use the RFC-enabled function modules SD_SALESDOCUMENT_CREATE and SD_SALESDOCUMENT_CHANGE. You can also use both of these function modules productively (live). However, since they are not released, they may not be fully supported by SAP. This would have to be checked in the individual cases.

Which advantages do these new BAPIs have:

- Upload of header and item texts possible
- Upload of n conditions
- Upload of n schedule lines
- Connection to the Central Address Management (CAM) address (Note 195768)

Requested delivery quantities and the requested delivery date are schedule line data that has to be entered in the relevant input table (BAPISCHDL).

If an error occurs in BAPI_SALESORDER_SIMULATE during processing, processing is ended and the output table ORDER_ITEMS_OUT remains initial. If the parameter BEHAVE_WHEN_ERROR is set to "P", the function module SD_SALESDOCUMENT_CREATE does not return a result if an error occurs.

You can use a CREATE BAPI to create a sales and distribution document. You can use a CHANGE BAPI to change the document. Changing a document with a CREATE BAPI is not supported.


×