Skip to Content
0
Former Member
Jan 05, 2012 at 01:43 PM

BAPI_PO_CHANGE updating all items even after sending perticular item number

328 Views

Hi

I am using BAPI_PO_CHANGE to update my PO item condition price.

I am trying to pass a perticular line item and its respective condition priceses.. but strangely, this bapi is updating all the items.

Can any one tell me what is the wrong i am doing here.

Here is my code.

CALL FUNCTION 'BAPI_PO_GETDETAIL1'

EXPORTING

purchaseorder = '4500002167'

IMPORTING

poheader = ls_header

TABLES

return = lt_return

poitem = lt_item

poschedule = lt_seh

pocond = lt_cond.

DELETE lt_item WHERE po_item <> '00020'.

DELETE lt_seh WHERE po_item <> '00020'.

DELETE lt_cond WHERE itm_number <> '000020'.

LOOP AT lt_item INTO ls_item.

ls_item-calctype = 'C'. "Set Calculation type for that item as 'C'

APPEND ls_item TO poitem.

item_header-calctype = 'X'. "Set update flag

item_header-po_item = ls_item-po_item.

item_header-Po_ItemX = 'X'.

APPEND item_header.

ENDLOOP.

LOOP AT lt_cond INTO ls_cond.

ls_cond-cond_updat = 'X'.

ls_cond-change_id = 'U'.

APPEND ls_cond TO pocond.

condxx-ITM_NUMBER = ls_cond-itm_number.

condxx-cond_updat = 'X'.

condxx-change_id = 'X'.

APPEND condxx TO condxx.

ENDLOOP.

CALL FUNCTION 'BAPI_PO_CHANGE'

EXPORTING

purchaseorder = '4500002167'

TABLES

return = return

poitem = poitem

poitemx = item_header

pocond = pocond

pocondx = condxx.

Call Function 'BAPI_TRANSACTION_COMMIT'.