Application Development and Automation 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: 
Read only

CALL FUNCTION 'BAPI_PO_CHANGE'

Former Member
0 Likes
818

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.

1 ACCEPTED SOLUTION
Read only

alex_m
Active Contributor
0 Likes
756

Your question not clear..

5 REPLIES 5
Read only

Former Member
0 Likes
756

if you have item data in some txt file, use upload function module and convert the data to internal table then process the bapi..

Read only

alex_m
Active Contributor
0 Likes
757

Your question not clear..

Read only

0 Likes
756

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

Read only

Former Member
0 Likes
756

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

Read only

0 Likes
756

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.