Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Updating PO header partner with BAPI_PO_CHANGE

Hi everyone!

I want to update a partner on the PO header. This seems like a rather simple thing to do since there is BAPIs availeble but still I cannot get this to work so I hope that you guys can help me.

What I do is the following:

* Get all partners
  CALL FUNCTION 'BAPI_PO_GETDETAIL1'
    EXPORTING
      purchaseorder = '0060008482'
    IMPORTING
      poheader      = ls_pohead
    TABLES
      return        = lt_return
      popartner     = lt_popart.

* Change the CR partner number from 0000109093 to 91.
  READ TABLE lt_popart WITH KEY partnerdesc = 'CR' ASSIGNING <lw_popart>.
  <lw_popart>-buspartno = '0000109091'.

* Delete all other partners except for the one we want to update
  DELETE lt_popart WHERE partnerdesc <> 'CR'.

* Save changes
  CALL FUNCTION 'BAPI_PO_CHANGE'
    EXPORTING
      purchaseorder = '0060008482'
    TABLES
      return        = lt_return
      popartner     = lt_popart.

* Commit
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

When I check lt_return I get a S022 message saying: "No data changed".

I have been trying to mix around with this for several hours now and I am getting very tired of not getting it to work. When I check the BAPI documentation it says that partners are changable. And I can do this change in ME22n.

What am I doing wrong? Any ideas?

Best Regards

Niklas

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question