10-11-2007 12:53 PM
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
10-11-2007 12:57 PM
HI,
Here are the sample code
http://www.sap-img.com/abap/bapi-to-copy-materials-from-one-plant-to-another.htm
http://www.sap-img.com/abap/sample-abap-code-on-bapi-po-change.htm
Regards
Sudheer
10-11-2007 1:02 PM
Hi.
Sorry but this is not helpful. I have read the example but it is not handling the partners which is my problem.
Any other ideas?
/Niklas
10-11-2007 3:22 PM