03-05-2009 3:45 AM
Hi Experts,
Can someone tell me what are the parameters that are to be passed to the BAPI_PO_CREATE1
to update NETPR field at item level.
I am trying to update the 'PBXX' cond type but failed.
Following is sample piece of code of my code for items.
t_po_items-po_item = lv_itmno.
t_po_items-material = wa_outdisp-matnr.
t_po_items-plant = p_werks.
t_po_items-quantity = wa_outdisp-menge.
t_po_items-po_unit = wa_outdisp-meins.
t_po_items-net_price = wa_outdisp-netpr.
APPEND t_po_items.
CLEAR t_po_items.
t_po_itemsx-po_item = lv_itmno.
t_po_itemsx-po_itemx = 'X'.
t_po_itemsx-material = 'X'.
t_po_itemsx-plant = 'X'.
t_po_itemsx-quantity = 'X'.
t_po_itemsx-net_price = 'X'.
t_po_itemsx-price_unit = 'X'.
t_po_itemsx-calctype = 'X'.
APPEND t_po_itemsx.
CLEAR : t_po_itemsx.
t_po_itmcon-ITM_NUMBER = lv_itmno.
t_po_itmcon-COND_ST_NO = '1' .
t_po_itmcon-cond_COUNT = '2'.
t_po_itmcon-COND_TYPE = 'PBXX' .
t_po_itmconx-condorigin = 'A'.
t_po_itmcon-cond_value = wa_outdisp-netpr.
t_po_itmconx-condclass = 'B'.
t_po_itmcon-CURRENCY = 'USD'.
t_po_itmcon-COND_UNIT = wa_outdisp-meins.
t_po_itmcon-CHANGE_ID = 'U'.
APPEND t_po_itmcon.
t_po_itmconx-ITM_NUMBER = lv_itmno.
t_po_itmconx-COND_ST_NO = lv_cnt .
t_po_itmconx-cond_COUNT = 'X'.
t_po_itmconx-condorigin = 'A'.
t_po_itmconx-COND_TYPE = 'X' .
t_po_itmconx-condclass = 'x'.
t_po_itmconx-cond_value = 'X'.
t_po_itmconx-CURRENCY = 'X'.
t_po_itmconx-COND_UNIT = 'X'.
t_po_itmconx-CHANGE_ID = 'X'.
APPEND t_po_itmconx.
CLEAR : t_po_itmconx, wa_outdisp.
endloop.
PO header
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = l_po_header
poheaderx = l_po_headerx
NO_PRICE_FROM_PO = 'X'
IMPORTING
exppurchaseorder = l_purchaseorder
TABLES
return = t_return
poitem = t_po_items
poitemx = t_po_itemsx
pocond = t_po_itmcon
pocondx = t_po_itmconx.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
Can some help me.
Thanks
Dan
03-06-2009 5:21 PM
Dan,
Code seems to be fine but in POC conditions you need to verify the step number, condition count with that of the Cond type., Access Seq ..etc in the SPRO .. Ask your Func Guy..
t_po_itmcon-COND_ST_NO = '1' .
t_po_itmcon-cond_COUNT = '2'.
t_po_itmcon-COND_TYPE = 'PBXX' .
t_po_itmconx-condorigin = 'A'.
Give a try
03-05-2009 4:34 AM
http://abap.wikiprog.com/wiki/BAPI_PO_CREATE1
see whether this could help you.
03-05-2009 6:40 AM
Hi,
Ur code is correct i think.
i used previously like this...
PARAMETERS: x_test AS CHECKBOX DEFAULT 'X'.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = gw_header
poheaderx = gw_headerx
testrun = x_test
no_price_from_po = 'X'
IMPORTING
exppurchaseorder = l_ebeln
EXPHEADER =
EXPPOEXPIMPHEADER =
TABLES
return = gt_return
poitem = gt_poitem
poitemx = gt_poitemx
poschedule = gt_poschedule
poschedulex = gt_poschedulex
poaccount = gt_poaccount
poaccountx = gt_poaccountx
polimits = gt_polimits
poservices = gt_poservices
posrvaccessvalues = gt_posrvaccessvalues.
IF x_test = space.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
use this parameter n try....
testrun = x_test
Regards,
Kiran
03-05-2009 3:01 PM
03-06-2009 5:21 PM
Dan,
Code seems to be fine but in POC conditions you need to verify the step number, condition count with that of the Cond type., Access Seq ..etc in the SPRO .. Ask your Func Guy..
t_po_itmcon-COND_ST_NO = '1' .
t_po_itmcon-cond_COUNT = '2'.
t_po_itmcon-COND_TYPE = 'PBXX' .
t_po_itmconx-condorigin = 'A'.
Give a try