1 Reply Latest reply: Jul 16, 2010 9:12 AM by Lars N RSS

Update price in PO using BAPI_PO_CHANGE

Lars N
Currently Being Moderated

I have changed the price for a given material via tcode MEK2, and want afterwards to update the price on the PO.

 

The code looks like this:

        ls_poitem-po_item     = wt_wbs_elements-ebelp.
        ls_poitem-calctype    = 'C'.
        APPEND ls_poitem TO lt_poitem.

        ls_poitemx-po_item    = wt_wbs_elements-ebelp.
        ls_poitemx-po_itemx   = 'X'.
        ls_poitemx-calctype   = 'X'.
        APPEND ls_poitemx TO lt_poitemx.

        ls_pocond-cond_type   = 'YTPM'.
        ls_pocond-itm_number  = wt_wbs_elements-ebelp.
        ls_pocond-change_id   = 'U'.           "update
        APPEND ls_pocond TO lt_pocond.

        ls_pocondx-cond_type  = 'YTPM'.
        ls_pocondx-itm_number = wt_wbs_elements-ebelp.
        ls_pocondx-cond_value = 'X'.
        ls_pocondx-change_id  = 'X' .
        APPEND ls_pocondx TO lt_pocondx.

      CALL FUNCTION 'BAPI_PO_CHANGE'
        EXPORTING
          purchaseorder = wt_wbs_elements-ebeln
        TABLES
          return        = lt_return
          poitem        = lt_poitem
          poitemx       = lt_poitemx
          pocond        = lt_pocond
          pocondx       = lt_pocondx.

 

It seems that the PO order is updated with the new price, so that's great.

 

The problem is, even that nothing is updated I got the message -that the PO is updated.

 

Return table contain following entries:

 

S 06                   023 Standard PO 4500002304 changed

W 06                   261 No message generated for output of purchasing document

I V1                   204 Condition YTPM cannot be processed manually

 

Can anybody help?

  • Re: Update price in PO using BAPI_PO_CHANGE
    Lars N
    Currently Being Moderated

    During some test, I have found out - if I set the value 'X' in NO_MESSAGE_REQ (Import parameters), then I will not get the message S 06 "Standard PO 4500002304 changed".

     

    But my problem is then, even that the price is updated, I don't get the message that the PO is changed.

     

    So my case is:

    If i set a X in NO_MESSAGE_REQ I don't get the wrong message about update, when the PO isn't updated - but I don't either get the message that the PO is updated, when it's acutally is updated.

     

    Please help.

Actions