Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with BAPI_CONTRACT_CREATE

Former Member
0 Kudos

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.

1 REPLY 1

Former Member
0 Kudos

Able to find out the reason for errors. Following is the issue which I got from one of the SDN posts(link provided below)

The main reason was that the Currency field in the Header strucutre was not filled. On filling the same, the error gets disappeared and it reappears if is removed. I never thought that could be the reason.

Thanks.