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

ParameterTypeDescriptionRequired
SALESDOCUMENTINBAPIVBELN-VBELNExternal sales document number—
CONTRACT_HEADER_INBAPISDHD1Contract header dataYes
CONTRACT_HEADER_INXBAPISDHD1XContract header change flags (X structure)—
SENDERBAPI_SENDERLogical sender system (ALE)—
BEHAVE_WHEN_ERRORBAPIFLAG-BAPIFLAGError handling behavior—
TESTRUNBAPIFLAG-BAPIFLAGTest run (no update)—
CONVERTBAPIFLAG-BAPIFLAGConvert partner roles and document types to internal format—
LOGIC_SWITCHBAPISDLSSD logic switch (pricing, ATP control)—

Exporting parameters

ParameterTypeDescription
SALESDOCUMENTBAPIVBELN-VBELNContract number created

Tables parameters

ParameterTypeDescriptionRequired
RETURNBAPIRET2Return messages—
CONTRACT_ITEMS_INBAPISDITMContract item data—
CONTRACT_ITEMS_INXBAPISDITMXContract item change flags (X structure)—
CONTRACT_PARTNERSBAPIPARNRContract partnersYes
CONTRACT_CONDITIONS_INBAPICONDPricing conditions—
CONTRACT_CONDITIONS_INXBAPICONDXCondition change flags (X structure)—
CONTRACT_TEXTBAPISDTEXTTexts—
CONTRACT_KEYSBAPISDKEYReference keys of created objects—
PARTNERADDRESSESBAPIADDR1Partner addresses—
EXTENSIONINBAPIPAREXCustomer enhancement fields (EXTENSIONIN)—
CONTRACT_DATA_INBAPICTRContract data (validity, dates)—
CONTRACT_DATA_INXBAPICTRXContract 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.

Request a custom report