‎2009 Aug 19 1:20 PM
Hi All,
I have to update purchase orders by using BAPI_PO_CHANGE........can anyone tell how do i come to know the fields present in poitem and poitemx gets populated in zprogram?
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = purchaseorder
TABLES
return = return
poitem = i_item
poitemx = i_itemx.
‎2009 Aug 19 5:22 PM
‎2009 Aug 19 1:56 PM
if you have item data in some txt file, use upload function module and convert the data to internal table then process the bapi..
‎2009 Aug 19 5:22 PM
‎2009 Aug 19 6:13 PM
Hi.
You must flag the fields you want to change. Check this example:
DATA: ls_poheader TYPE bapimepoheader,
ls_poheaderx TYPE bapimepoheaderx,
lt_bapiret TYPE TABLE OF bapiret2.
DATA: lv_ebeln TYPE ebeln.
lv_ebeln = input-ebeln.
CLEAR: ls_poheader, ls_poheaderx.
ls_poheader-ref_1 = input-mt_transf_fcc_entreposto-rota_basis.
ls_poheaderx-ref_1 = 'X'.
ls_poheader-our_ref = input-mt_transf_fcc_entreposto-doc_fcc.
ls_poheaderx-our_ref = 'X'.
ls_poheader-sales_pers = input-mt_transf_fcc_entreposto-doc_basis.
ls_poheaderx-sales_pers = 'X'.
REFRESH: lt_bapiret.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = lv_ebeln
poheader = ls_poheader
poheaderx = ls_poheaderx
TABLES
return = lt_bapiret.
PO_ITEMS and PO_ITEMSX both work same way.
Regards,
Valter Oliveira
‎2009 Aug 20 5:11 AM
Hi Valter,
Thanx for example.....but can you please explain the significance of " input-mt_transf_fcc_entreposto-rota_basis" which is not declared in the report.
one more thing please tell me where i am going wrong......
DATA: purchaseorder LIKE bapimepoheader-po_number.
DATA: i_item TYPE TABLE OF bapimepoitem,
ls_item TYPE bapimepoitem,
i_itemx TYPE TABLE OF bapimepoitemx,
ls_itemx TYPE bapimepoitemx.
PERFORM select_orders.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = purchaseorder
TABLES
poitem = i_item
poitemx = i_itemx
FORM select_orders .
LOOP AT gt_ekpo INTO ls_ekpo.
purchaseorder = ls_ekpo-ebeln.
ls_item-po_item = ls_ekpo-ebelp.
ls_itemx-po_item = ls_ekpo-ebelp.
ls_itemx-po_itemx = 'X'.
ENDLOOP.
ENDFORM. " SELECT_ORDERS
thanks in advance
Edited by: Nitin2009 on Aug 20, 2009 6:12 AM
‎2009 Aug 20 10:24 AM
Hi again.
Field input-mt_transf_fcc_entreposto-rota_basis and the other two fields are just char fields. I posted it as an example. Those fields must match the type of the ones of the bapi header.
From your code I suspect that you want to change the item number? I think you cannot change the po_item. As an example for changing the item text field, see this code:
LOOP AT gt_ekpo INTO ls_ekpo.
purchaseorder = ls_ekpo-ebeln.
ls_item-po_item = ls_ekpo-ebelp.
ls_item-SHORT_TEXT = 'test for BAPI_PO_CHANGE'.
ls_itemx-po_item = ls_ekpo-ebelp.
ls_itemx-SHORT_TEXT = 'X'.
ENDLOOP.
Regards,
Valter Oliveira.