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: 
Read only

BAPI_PO_CHANGE work?

Former Member
0 Likes
1,609

hi everybody. I'm trying to use the bapi BAPI_PO_CHANGE, but I no have luck to make it work. I need to enter in the purchase order, select one o several item, in the item selected I need to mark the check "Closed" in every item. and then close the item.

can you help me??? thanks for your time!!!

Oscar

7 REPLIES 7
Read only

ferry_lianto
Active Contributor
0 Likes
1,179

Hi Occar,

Please check this link for sample code.

http://www.sap-img.com/abap/sample-abap-code-on-bapi-po-change.htm

Hope this will help.

Regards,

Ferry Lianto

Read only

0 Likes
1,179

Hi Ferry, thanks for the link. I have seen this before, and i try to run it, and didn't work, because the table zvtls_sap, is not especified. Thanks

Read only

Former Member
0 Likes
1,179

Do you want to mark the 'Delivery Complete Indicator'? If so, pass 'X' to NO_MORE_GR field of the item. If not, can you please explain 'CLOSE'?

Read only

0 Likes
1,179

Hi Srinivas. the check that I said is in the sub windows Item, Tab Quantities/dates, under the label "Open quantity". The help of this check is: Purchase requisition closed Thanks

Read only

0 Likes
1,179

"Open quantity" is a calculated value. I am assuming you are talking about looking at a PO in ME23N. It is the difference between the line quantity and the sum of all the GRs for the PO line item minus any GR reversals. When you set the indicator 'Delivery Complete' that means there are no more deliveries expected.

System will not allow you to change this value. You have to change the item quantity to match the sum of the GRs minus any GR reversals. Then this will become 0. Instead, if you change your check to go against the delivery complete indicator, you can close the purchase requisition when this indicator is set to 'X'.

Read only

Former Member
0 Likes
1,179

Hi

Have ypu filled structures with x on the end ??

(example for POITEM - structer POITEMX) have to be fiiled.

Only the field in poitem marked with X in poitemx will be changed.

Read only

0 Likes
1,179

my code is like this:

CALL FUNCTION 'BAPI_PO_GETDETAIL'

EXPORTING

purchaseorder = ebeln

items = 'X'

history = 'X'

extensions = 'X'

IMPORTING

po_header = po_header

TABLES

po_items = po_items

po_item_history = po_item_history

return = retorno_get

extensionout = extensionout.

MOVE-CORRESPONDING po_header TO poheader.

LOOP AT po_items.

CLEAR: poitem, poitemx.

MOVE-CORRESPONDING po_items TO poitem.

poitem-no_more_gr = 'X'.

poitem-final_inv = 'X'.

poitem-deliv_compl = 'X'.

poitem-delete_ind = 'X'.

APPEND poitem.

poitemx-po_item = poitem-po_item.

poitemx-no_more_gr = 'X'.

poitemx-po_itemx = 'X'.

poitemx-final_inv = 'X'.

poitemx-deliv_compl = 'X'.

poitemx-delete_ind = 'X'.

APPEND poitemx.

ENDLOOP.

CLEAR: poitem, poitemx,

poheader, poheaderx.

CALL FUNCTION 'BAPI_PO_CHANGE'

EXPORTING

purchaseorder = ebeln

poheader = poheader

poheaderx = poheaderx

  • POADDRVENDOR =

testrun = p_test

memory_uncomplete = 'X'

  • MEMORY_COMPLETE =

  • POEXPIMPHEADER =

  • POEXPIMPHEADERX =

  • VERSIONS =

  • NO_MESSAGING =

  • NO_MESSAGE_REQ =

  • NO_AUTHORITY =

  • NO_PRICE_FROM_PO =

IMPORTING

expheader = expheader

  • EXPPOEXPIMPHEADER =

TABLES

return = retorno

poitem = poitem

poitemx = poitemx

  • POADDRDELIVERY =

  • POSCHEDULE =

  • POSCHEDULEX =

  • POACCOUNT =

  • POACCOUNTPROFITSEGMENT =

  • POACCOUNTX =

  • POCONDHEADER =

  • POCONDHEADERX =

  • POCOND =

  • POCONDX =

  • POLIMITS =

  • POCONTRACTLIMITS =

  • POSERVICES =

  • POSRVACCESSVALUES =

  • POSERVICESTEXT =

extensionin = extensionin

extensionout = extensionout

  • POEXPIMPITEM =

  • POEXPIMPITEMX =

  • POTEXTHEADER =

  • POTEXTITEM =

  • ALLVERSIONS =

  • POPARTNER =

.

IF p_test <> 'X'.

COMMIT WORK AND WAIT.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'

IMPORTING

return = retorno.

ENDIF.