SD
BAPI
RFC
Used the same way in S/4HANA
BAPI_SALESORDER_CREATEFROMDAT2 Create Sales Order
Creates a sales order from header, item, partner, schedule line and condition data, running the same checks as VA01. Developers use it in order upload programs, EDI or web shop interfaces. Fill ORDER_HEADER_INX and ORDER_ITEMS_INX for the fields you pass, use TESTRUN to validate first, and call BAPI_TRANSACTION_COMMIT afterwards only when RETURN contains no message of type E or A.
- Function group
- 2032
- Remote-enabled (RFC)
- Yes
- Type
- BAPI
Importing parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| SALESDOCUMENTIN | BAPIVBELN-VBELN | External sales document number | — |
| ORDER_HEADER_IN | BAPISDHD1 | Order header data | Yes |
| ORDER_HEADER_INX | BAPISDHD1X | Order header change flags (X structure) | — |
| SENDER | BAPI_SENDER | Logical sender system (ALE) | — |
| BEHAVE_WHEN_ERROR | BAPIFLAG-BAPIFLAG | Error handling behavior | — |
| TESTRUN | BAPIFLAG-BAPIFLAG | Test run (no update) | — |
| CONVERT | BAPIFLAG-BAPIFLAG | Convert partner roles and document types to internal format | — |
| LOGIC_SWITCH | BAPISDLS | SD logic switch (pricing, ATP control) | — |
Exporting parameters
| Parameter | Type | Description |
|---|---|---|
| SALESDOCUMENT | BAPIVBELN-VBELN | Sales order number created |
Tables parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| RETURN | BAPIRET2 | Return messages | — |
| ORDER_ITEMS_IN | BAPISDITM | Order item data | — |
| ORDER_ITEMS_INX | BAPISDITMX | Order item change flags (X structure) | — |
| ORDER_PARTNERS | BAPIPARNR | Order partners | Yes |
| ORDER_SCHEDULES_IN | BAPISCHDL | Schedule lines | — |
| ORDER_SCHEDULES_INX | BAPISCHDLX | Schedule line change flags (X structure) | — |
| ORDER_CONDITIONS_IN | BAPICOND | Pricing conditions | — |
| ORDER_CONDITIONS_INX | BAPICONDX | Condition change flags (X structure) | — |
| ORDER_TEXT | BAPISDTEXT | Texts | — |
| ORDER_KEYS | BAPISDKEY | Reference keys of created objects | — |
| PARTNERADDRESSES | BAPIADDR1 | Partner addresses | — |
| EXTENSIONIN | BAPIPAREX | Customer enhancement fields (EXTENSIONIN) | — |
Call template (ABAP)
A skeleton generated from the interface. It lists mandatory importing parameters, exporting parameters and tables; declare the variables with suitable types in your own program.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = lv_order_header_in
IMPORTING
salesdocument = lv_salesdocument
TABLES
return = lt_return
order_items_in = lt_order_items_in
order_items_inx = lt_order_items_inx
order_partners = lt_order_partners
order_schedules_in = lt_order_schedules_in
order_schedules_inx = lt_order_schedules_inx
order_conditions_in = lt_order_conditions_in
order_conditions_inx = lt_order_conditions_inx
order_text = lt_order_text
order_keys = lt_order_keys.Related tables
Can't find the report you need?
We also build anything that is not in the catalog. Describe it briefly and we will suggest the right solution.