Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem with BAPI_CONTRACT_CREATE

Dear Experts,

I am unable to create contract using the fn mod BAPI_CONTRACTE_CREATE.I am getting following errors.

I am unable to trace out why I am getting the first error.

Not sure why I am getting these errors though I have net price filled correctly in my file.

1) No instance of object type PurchasingContract has been created. External reference: # 1

2) Enter Net Price

3) Please check the price

*Header

wa_contract_header-vendor = wa_contract-vendor.

wa_contract_header-doc_type = wa_contract-agree_type .

wa_contract_header-creat_date = l_date.

wa_contract_header-purch_org = wa_contract-pur_org.

wa_contract_header-pur_group = wa_contract-pur_grp.

wa_contract_header-vper_start = l_date1.

wa_contract_header-vper_end = l_date2.

*Header_X

wa_contract_header_x-vendor = cns_x.

wa_contract_header_x-doc_type = cns_x.

wa_contract_header_x-creat_date = cns_x.

wa_contract_header_x-purch_org = cns_x.

wa_contract_header_x-pur_group = cns_x.

wa_contract_header_x-vper_start = cns_x.

wa_contract_header_x-vper_end = cns_x.

*Item

wa_contract_detail-item_no = l_count.

wa_contract_detail-material = wa_contract-material.

wa_contract_detail-plant = wa_contract-plant.

wa_contract_detail-stge_loc = wa_contract-sto_loc.

wa_contract_detail-po_unit = wa_contract-uom.

wa_contract_detail-net_price = wa_contract-net_price.

wa_contract_detail-target_qty = wa_contract-qty.

APPEND wa_contract_detail TO it_contract_detail.

*Item_X

wa_contract_detail_x-item_no = l_count.

wa_contract_detail_x-agmt_item = cns_x.

wa_contract_detail_x-item_nox = cns_x.

wa_contract_detail_x-material = cns_x.

wa_contract_detail_x-plant = cns_x.

wa_contract_detail_x-stge_loc = cns_x.

wa_contract_detail_x-po_unit = cns_x.

wa_contract_detail_x-net_price = cns_x.

wa_contract_detail_x-target_qty = cns_x.

APPEND wa_contract_detail_x TO it_contract_detail_x.

*Account

wa_contract_account-item_no = l_COUNT.

APPEND wa_contract_account TO it_contract_account.

*Account_X

wa_contract_account_x-item_no = l_COUNT.

APPEND wa_contract_account_x TO it_contract_account_x

CALL FUNCTION 'BAPI_CONTRACT_CREATE'

EXPORTING

header = wa_contract_header

headerx = wa_contract_header_x

IMPORTING

purchasingdocument = v_ebeln

exp_header = wa_headerout

TABLES

return = it_return

item = it_contract_detail

itemx = it_contract_detail_x

account = it_contract_account

accountx = it_contract_account_x.

Any inputs are appreciated.

Thanks.

Former Member
Not what you were looking for? View more on this topic or Ask a question