Skip to Content
0
Former Member
Jul 02, 2008 at 02:01 PM

Bapi BAPI_CONTRACT_CREATE return Error

1165 Views

When i create mm contract use bapi BAPI_CONTRACT_CREATE,i get return error like this:

1 E BAPI 001 No instance of object type PurchasingContract has been created. External reference: # 1

2 E 06 026 Please enter material number or account assignment category

3 E 06 079 Unit of measure not defined for language EN

4 E ME 083 Enter Order Unit

But,i confirm the Unit already defined for language EN.

So i can't understand the error.

Can anybody help me?

*----


report ztest_yangxg16.

data: gs_header type bapimeoutheader,

gs_headerx type bapimeoutheaderx,

gs_purchasingdocument type bapimeoutheader-number.

data: gt_return like bapiret2 occurs 0 with header line,

gt_item like bapimeoutitem occurs 0 with header line,

gt_itemx like bapimeoutitemx occurs 0 with header line,

gt_account like bapimeoutaccount occurs 0 with header line,

gt_accountprofitsegment like bapimeoutprofitsegment occurs 0 with header line,

gt_accountx like bapimeoutaccountx occurs 0 with header line,

gt_delivery_address like bapimeoutaddrdelivery occurs 0 with header line,

gt_item_cond_validity like bapimeoutvalidity occurs 0 with header line,

gt_item_cond_validityx like bapimeoutvalidityx occurs 0 with header line,

gt_item_condition like bapimeoutcondition occurs 0 with header line,

gt_item_conditionx like bapimeoutconditionx occurs 0 with header line,

gt_item_cond_scale_value like bapimeoutitemscaleval occurs 0 with header line,

gt_item_cond_scale_quan like bapimeoutitemscalequan occurs 0 with header line,

gt_item_text like bapimeoutitemtext occurs 0 with header line,

gt_header_text like bapimeouttext occurs 0 with header line,

gt_head_cond_validity like bapimeoutheadvalidity occurs 0 with header line,

gt_head_cond_validityx like bapimeoutheadvalidityx occurs 0 with header line,

gt_head_condition like bapimeoutheadercond occurs 0 with header line,

gt_head_conditionx like bapimeoutheadercondx occurs 0 with header line,

gt_head_cond_scale_val like bapimeoutscalevalue occurs 0 with header line,

gt_head_cond_scale_quan like bapimeoutscale occurs 0 with header line,

gt_partner like bapimeoutpartner occurs 0 with header line,

gt_partnerx like bapimeoutpartnerx occurs 0 with header line,

gt_extensionin like bapiparex occurs 0 with header line,

gt_extensionout like bapiparex occurs 0 with header line.

*header

gs_header-comp_code = '1000'.

gs_header-doc_type = 'ZMK'.

gs_header-vendor = '0000002100'.

gs_header-pmnttrms = '1026'.

gs_header-purch_org = '1000'.

gs_header-pur_group = '177'.

gs_header-currency = 'USD'.

gs_header-vper_start = '20080701'.

gs_header-vper_end = '20080711'.

gs_header-incoterms1 = 'FOB'.

gs_header-incoterms2 = 'dalian'.

gs_header-dscnt1_to = '35'.

gs_headerx-comp_code = 'X'.

gs_headerx-doc_type = 'X'.

gs_headerx-vendor = 'X'.

gs_headerx-pmnttrms = 'X'.

gs_headerx-purch_org = 'X'.

gs_headerx-pur_group = 'X'.

gs_headerx-currency = 'X'.

gs_headerx-vper_start = 'X'.

gs_headerx-vper_end = 'X'.

gs_headerx-incoterms1 = 'X'.

gs_headerx-incoterms2 = 'X'.

gs_headerx-dscnt1_to = 'X'.

*ITEM

gt_item-item_no = 1.

gt_item-material = 'WANGLTEST'.

gt_item-plant = '1001'.

*gt_item-STGE_LOC = ''.

gt_item-matl_group = '111020201'.

gt_item-target_qty = 3.

gt_item-po_unit = 'PC'.

gt_item-po_unit_iso = 'PC'.

gt_item-orderpr_un = 'PC'.

gt_item-orderpr_un_iso = 'PC'.

gt_item-conf_ctrl = '0001'.

gt_item-net_price = '100'.

append gt_item.

clear gt_item.

gt_itemx-item_no = 'X'.

gt_itemx-material = 'X'.

gt_itemx-plant = 'X'.

*gt_itemx-STGE_LOC = 'X'.

gt_itemx-matl_group = 'X'.

gt_itemx-target_qty = 'X'.

gt_itemx-po_unit = 'X'.

gt_itemx-po_unit_iso = 'X'.

gt_itemx-orderpr_un_iso = 'X'.

gt_itemx-orderpr_un = 'X'.

gt_itemx-conf_ctrl = 'X'.

gt_itemx-net_price = 'X'.

append gt_itemx.

clear gt_itemx.

call function 'BAPI_CONTRACT_CREATE'

exporting

header = gs_header

headerx = gs_headerx

  • VENDOR_ADDRESS =

  • TESTRUN =

  • TECHNICAL_DATA =

importing

purchasingdocument = gs_purchasingdocument

  • EXP_HEADER =

tables

return = gt_return

item = gt_item

itemx = gt_itemx

.

if gs_purchasingdocument is initial.

call function 'BAPI_TRANSACTION_COMMIT'.

write: / gs_purchasingdocument.

else.

call function 'BAPI_TRANSACTION_ROLLBACK'.

write: / ' fail'.

endif.