‎2009 Feb 04 1:12 PM
Hi All,
I am uploading the data for txn ME21N through BAPI_PO_CREATE1.
Whenever i m testing this bapi it is giving PO no. but Codition types are not getting update neither on header level nor on item level.
Header Condition type and Condition value ,I am giving in Structures POCONDHEADER, POCONDHEADERX and Item Condition type and Condition value , i am giving in structures POCOND,POCONDX.
Thanx in Advance.
Regards,
Shiv Kant
‎2009 Feb 06 11:23 AM
Take a look in this example:
ADD 10 TO v_item.
e_poheader-comp_code = t_cabec-bukrs.
e_poheader-doc_type = 'EC'.
e_poheader-vendor = t_cabec-lifnr.
e_poheader-creat_date = sy-datum.
e_poheader-created_by = sy-uname.
e_poheader-item_intvl = '0010'.
e_poheader-langu = sy-langu.
e_poheader-langu_iso = sy-langu.
e_poheader-incoterms1 = t_cabec-inco1.
e_poheader-incoterms2 = t_cabec-inco2.
e_poheader-currency = t_cabec-waers.
e_poheader-purch_org = v_ekorg.
e_poheader-pur_group = t_saida3-ekgrp.
e_poheader-pmnttrms = t_cabec-zterm.
e_poheader-telephone = t_cabec-telf1.
e_poheader-sales_pers = t_cabec-verkf.
e_poheaderx-comp_code = 'X'.
e_poheaderx-doc_type = 'X'.
e_poheaderx-vendor = 'X'.
e_poheaderx-creat_date = 'X'.
e_poheaderx-created_by = 'X'.
e_poheaderx-item_intvl = 'X'.
e_poheaderx-langu = 'X'.
e_poheaderx-langu_iso = 'X'.
e_poheaderx-incoterms1 = 'X'.
e_poheaderx-incoterms2 = 'X'.
e_poheaderx-currency = 'X'.
e_poheaderx-purch_org = 'X'.
e_poheaderx-pur_group = 'X'.
e_poheaderx-pmnttrms = 'X'.
e_poheaderx-telephone = 'X'.
e_poheaderx-sales_pers = 'X'.
IF t_saida3-elem_pep IS NOT INITIAL.
MOVE 'P' TO t_saida3-knttp.
ELSEIF t_saida3-aufnr IS NOT INITIAL.
MOVE 'F' TO t_saida3-knttp.
ELSEIF t_saida3-kostl IS NOT INITIAL.
MOVE 'K' TO t_saida3-knttp.
ENDIF.
t_poitem-po_item = v_item.
t_poitem-plant = s_werks.
t_poitem-short_text = t_saida3-txz01.
t_poitem-quantity = t_saida3-menge.
t_poitem-po_unit = t_saida3-meins.
t_poitem-acctasscat = t_saida3-knttp.
t_poitem-matl_group = t_saida3-matkl.
t_poitem-tax_code = t_saida3-mwskz.
t_poitem-order_reason = t_saida3-bsgru.
t_poitem-indus3 = t_saida3-j_1bindus3.
t_poitem-matl_usage = t_saida3-j_1bmatuse.
t_poitem-mat_origin = t_saida-j_1bmatorg.
t_poitem-item_cat = t_saida-epstp.
t_poitem-net_price = t_saida3-netpr.
t_poitem-price_unit = t_saida3-peinh.
t_poitem-bras_nbm = t_saida3-j_1bnbmco1.
t_poitem-PREQ_NAME = t_saida3-requisitante.
APPEND t_poitem.
t_poitemx-po_item = v_item.
t_poitemx-plant = 'X'.
t_poitemx-short_text = 'X'.
t_poitemx-quantity = 'X'.
t_poitemx-po_unit = 'X'.
t_poitemx-acctasscat = 'X'.
t_poitemx-matl_group = 'X'.
t_poitemx-tax_code = 'X'.
t_poitemx-order_reason = 'X'.
t_poitemx-indus3 = 'X'.
t_poitemx-matl_usage = 'X'.
t_poitemx-mat_origin = 'X'.
t_poitemx-item_cat = 'X'.
t_poitemx-net_price = 'X'.
t_poitemx-price_unit = 'X'.
t_poitemx-bras_nbm = 'X'.
t_poitemx-preq_name = 'X'.
APPEND t_poitemx.
t_schedule-po_item = v_item.
t_schedule-del_datcat_ext = '1'.
t_schedule-delivery_date = v_data.
t_schedule-del_datcat_ext = 'D'.
t_schedule-quantity = t_saida3-menge.
APPEND t_schedule.
t_schedulx-po_item = v_item.
t_schedulx-del_datcat_ext = 'X'.
t_schedulx-delivery_date = 'X'.
t_schedulx-del_datcat_ext = 'X'.
t_schedulx-quantity = 'X'.
APPEND t_schedulx.
t_account-po_item = v_item.
t_account-gl_account = t_saida3-saknr.
t_account-wbs_element = t_saida3-elem_pep.
t_account-costcenter = t_saida3-kostl.
t_account-orderid = t_saida3-aufnr.
t_account-gr_rcpt = t_saida3-recebedor.
t_account-unload_pt = t_saida3-pdescarga.
APPEND t_account.
t_accountx-po_item = v_item.
t_accountx-gl_account = 'X'.
t_accountx-wbs_element = 'X'.
t_accountx-costcenter = 'X'.
t_accountx-orderid = 'X'.
t_accountx-gr_rcpt = 'X'.
t_accountx-unload_pt = 'X'.
APPEND t_accountx.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = e_poheader
poheaderx = e_poheaderx
testrun = ' '
IMPORTING
exppurchaseorder = v_pedido
TABLES
return = t_bapiret2
poitem = t_poitem
poitemx = t_poitemx
poschedule = t_schedule
poschedulex = t_schedulx
poaccount = t_account
poaccountx = t_accountx
potextitem = t_textitem
potextheader = t_textheader.
‎2009 Feb 06 11:23 AM
Take a look in this example:
ADD 10 TO v_item.
e_poheader-comp_code = t_cabec-bukrs.
e_poheader-doc_type = 'EC'.
e_poheader-vendor = t_cabec-lifnr.
e_poheader-creat_date = sy-datum.
e_poheader-created_by = sy-uname.
e_poheader-item_intvl = '0010'.
e_poheader-langu = sy-langu.
e_poheader-langu_iso = sy-langu.
e_poheader-incoterms1 = t_cabec-inco1.
e_poheader-incoterms2 = t_cabec-inco2.
e_poheader-currency = t_cabec-waers.
e_poheader-purch_org = v_ekorg.
e_poheader-pur_group = t_saida3-ekgrp.
e_poheader-pmnttrms = t_cabec-zterm.
e_poheader-telephone = t_cabec-telf1.
e_poheader-sales_pers = t_cabec-verkf.
e_poheaderx-comp_code = 'X'.
e_poheaderx-doc_type = 'X'.
e_poheaderx-vendor = 'X'.
e_poheaderx-creat_date = 'X'.
e_poheaderx-created_by = 'X'.
e_poheaderx-item_intvl = 'X'.
e_poheaderx-langu = 'X'.
e_poheaderx-langu_iso = 'X'.
e_poheaderx-incoterms1 = 'X'.
e_poheaderx-incoterms2 = 'X'.
e_poheaderx-currency = 'X'.
e_poheaderx-purch_org = 'X'.
e_poheaderx-pur_group = 'X'.
e_poheaderx-pmnttrms = 'X'.
e_poheaderx-telephone = 'X'.
e_poheaderx-sales_pers = 'X'.
IF t_saida3-elem_pep IS NOT INITIAL.
MOVE 'P' TO t_saida3-knttp.
ELSEIF t_saida3-aufnr IS NOT INITIAL.
MOVE 'F' TO t_saida3-knttp.
ELSEIF t_saida3-kostl IS NOT INITIAL.
MOVE 'K' TO t_saida3-knttp.
ENDIF.
t_poitem-po_item = v_item.
t_poitem-plant = s_werks.
t_poitem-short_text = t_saida3-txz01.
t_poitem-quantity = t_saida3-menge.
t_poitem-po_unit = t_saida3-meins.
t_poitem-acctasscat = t_saida3-knttp.
t_poitem-matl_group = t_saida3-matkl.
t_poitem-tax_code = t_saida3-mwskz.
t_poitem-order_reason = t_saida3-bsgru.
t_poitem-indus3 = t_saida3-j_1bindus3.
t_poitem-matl_usage = t_saida3-j_1bmatuse.
t_poitem-mat_origin = t_saida-j_1bmatorg.
t_poitem-item_cat = t_saida-epstp.
t_poitem-net_price = t_saida3-netpr.
t_poitem-price_unit = t_saida3-peinh.
t_poitem-bras_nbm = t_saida3-j_1bnbmco1.
t_poitem-PREQ_NAME = t_saida3-requisitante.
APPEND t_poitem.
t_poitemx-po_item = v_item.
t_poitemx-plant = 'X'.
t_poitemx-short_text = 'X'.
t_poitemx-quantity = 'X'.
t_poitemx-po_unit = 'X'.
t_poitemx-acctasscat = 'X'.
t_poitemx-matl_group = 'X'.
t_poitemx-tax_code = 'X'.
t_poitemx-order_reason = 'X'.
t_poitemx-indus3 = 'X'.
t_poitemx-matl_usage = 'X'.
t_poitemx-mat_origin = 'X'.
t_poitemx-item_cat = 'X'.
t_poitemx-net_price = 'X'.
t_poitemx-price_unit = 'X'.
t_poitemx-bras_nbm = 'X'.
t_poitemx-preq_name = 'X'.
APPEND t_poitemx.
t_schedule-po_item = v_item.
t_schedule-del_datcat_ext = '1'.
t_schedule-delivery_date = v_data.
t_schedule-del_datcat_ext = 'D'.
t_schedule-quantity = t_saida3-menge.
APPEND t_schedule.
t_schedulx-po_item = v_item.
t_schedulx-del_datcat_ext = 'X'.
t_schedulx-delivery_date = 'X'.
t_schedulx-del_datcat_ext = 'X'.
t_schedulx-quantity = 'X'.
APPEND t_schedulx.
t_account-po_item = v_item.
t_account-gl_account = t_saida3-saknr.
t_account-wbs_element = t_saida3-elem_pep.
t_account-costcenter = t_saida3-kostl.
t_account-orderid = t_saida3-aufnr.
t_account-gr_rcpt = t_saida3-recebedor.
t_account-unload_pt = t_saida3-pdescarga.
APPEND t_account.
t_accountx-po_item = v_item.
t_accountx-gl_account = 'X'.
t_accountx-wbs_element = 'X'.
t_accountx-costcenter = 'X'.
t_accountx-orderid = 'X'.
t_accountx-gr_rcpt = 'X'.
t_accountx-unload_pt = 'X'.
APPEND t_accountx.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = e_poheader
poheaderx = e_poheaderx
testrun = ' '
IMPORTING
exppurchaseorder = v_pedido
TABLES
return = t_bapiret2
poitem = t_poitem
poitemx = t_poitemx
poschedule = t_schedule
poschedulex = t_schedulx
poaccount = t_account
poaccountx = t_accountx
potextitem = t_textitem
potextheader = t_textheader.
‎2009 Feb 06 12:34 PM
Hi Shiv,
https://forums.sdn.sap.com/click.jspa?searchID=21955998&messageID=6495363
check with this link.
regards,
Neelima