SD
BAPI
RFC
Used the same way in S/4HANA
BAPI_CONTRACT_CREATEFROMDATA Create Customer Contract
Creates a sales contract (for example a quantity, value or service contract) with header, items, partners, conditions and contract data, like VA41. It is used in contract migration and in interfaces from contract management tools. Pass validity dates in CONTRACT_DATA_IN with its X structure, check RETURN and call BAPI_TRANSACTION_COMMIT afterwards only when RETURN contains no message of type E or A.
- Function group
- 2034
- Remote-enabled (RFC)
- Yes
- Type
- BAPI
Importing parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| SALESDOCUMENTIN | BAPIVBELN-VBELN | External sales document number | — |
| CONTRACT_HEADER_IN | BAPISDHD1 | Contract header data | Yes |
| CONTRACT_HEADER_INX | BAPISDHD1X | Contract 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 | Contract number created |
Tables parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| RETURN | BAPIRET2 | Return messages | — |
| CONTRACT_ITEMS_IN | BAPISDITM | Contract item data | — |
| CONTRACT_ITEMS_INX | BAPISDITMX | Contract item change flags (X structure) | — |
| CONTRACT_PARTNERS | BAPIPARNR | Contract partners | Yes |
| CONTRACT_CONDITIONS_IN | BAPICOND | Pricing conditions | — |
| CONTRACT_CONDITIONS_INX | BAPICONDX | Condition change flags (X structure) | — |
| CONTRACT_TEXT | BAPISDTEXT | Texts | — |
| CONTRACT_KEYS | BAPISDKEY | Reference keys of created objects | — |
| PARTNERADDRESSES | BAPIADDR1 | Partner addresses | — |
| EXTENSIONIN | BAPIPAREX | Customer enhancement fields (EXTENSIONIN) | — |
| CONTRACT_DATA_IN | BAPICTR | Contract data (validity, dates) | — |
| CONTRACT_DATA_INX | BAPICTRX | Contract data change flags (X structure) | — |
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_CONTRACT_CREATEFROMDATA'
EXPORTING
contract_header_in = lv_contract_header_in
IMPORTING
salesdocument = lv_salesdocument
TABLES
return = lt_return
contract_items_in = lt_contract_items_in
contract_items_inx = lt_contract_items_inx
contract_partners = lt_contract_partners
contract_conditions_in = lt_contract_conditions_in
contract_conditions_inx = lt_contract_conditions_inx
contract_text = lt_contract_text
contract_keys = lt_contract_keys
partneraddresses = lt_partneraddresses
extensionin = lt_extensionin.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.