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: 

BAPI_PO_CHANGE doesn't change MATNR

former_member470288
Participant
0 Kudos
782

Hi experts,

I'm using BAPI_PO_CHANGE to modify the material in several PO but it doesn't work. If I modify it using ME22N it works fine, but I need to do it massively and so I can't use ME22N.

The code I'm using is:

MOVE gwa_data-ebelp TO gwa_poitem-po_item.

CONCATENATE lv_matnr 'N' INTO gwa_poitem-material. "lv_matnr is the old material

APPEND gwa_poitem TO gt_poitem.


MOVE gwa_data-ebelp TO gwa_poitemx-po_item.
MOVE 'X' TO gwa_poitemx-po_itemx.
MOVE 'X' TO gwa_poitemx-material.
APPEND gwa_poitemx TO gt_poitemx.


CALL FUNCTION 'BAPI_PO_CHANGE'
         EXPORTING
           purchaseorder = gwa_data-ebeln
         TABLES
           return = gt_return
           poitem = gt_poitem
           poitemx = gt_poitemx.


The messages I get are:


But nothing is changed in the PO.

Thanks for your help.

Carles

1 ACCEPTED SOLUTION

former_member620069
Participant
0 Kudos
487

Hi Carles,

I think you didn't call the Transaction  commit work in your code.

Regards,

Srini.

4 REPLIES 4

former_member620069
Participant
0 Kudos
488

Hi Carles,

I think you didn't call the Transaction  commit work in your code.

Regards,

Srini.

0 Kudos
487

Hi, Srini.

You're correct, it was that. I'm so ashamed...

Thanks!!

Carles

Former Member
0 Kudos
487

Hii Carles,

Usr commit bapi  BAPI_TRANSACTION_COMMIT  it will help

Regards

Gaurav

PeterJonker
Active Contributor
0 Kudos
487

Did you check note 1908567 ?

https://websmp230.sap-ag.de/sap(bD1ubCZjPTAwMQ==)/bc/bsp/sno/ui_entry/entry.htm?param=69765F6D6F6465...

In another post about this issue the user solved it by filling the poitem and poitemx tables with the fields to be changed ONLY.

Before he had the same problem as you have, but he used BAPI_PO_GETDETAIL to get the details, used them to fill poitem and changed only the value then called PO_CHANGE at got the error.

See also:

http://scn.sap.com/thread/1265520

Maybe you can try this out as well (if applicable for your situation)

Peter

Oooops I see now it has been solved.