2006 Dec 23 12:02 AM
HI,
I am using this bapi to set the delivery completed and final invoice indicator for a single PO.
But iam unable to change it, is there any thing wrong in the program code, i meant in passing the parameters.
Please help me out.
REPORT ZCLOSEPO .
data: ls_POITEM like BAPIMEPOITEM occurs 0 with header line,
ls_POITEMX like BAPIMEPOITEMX occurs 0 with header line,
ls_t_return like BAPIRET2 occurs 0 with header line,
ls_purchaseorder like BAPIMEPOHEADER,
ls_poheader like BAPIMEPOHEADER,
ls_poheaderx like BAPIMEPOHEADERX.
DATA : l_msgty TYPE c,
l_msgid(2) TYPE c,
l_msgno(3) TYPE c,
l_msgtx(100) TYPE c,
l_errflag TYPE c.
clear: ls_t_return,
ls_poitem,
ls_poitemx.
ls_purchaseorder-PO_NUMBER = '0000404026'.
ls_poheader-PO_NUMBER = '0000404026'.
ls_poheaderx-PO_NUMBER = '0000404026'.
ls_poitem-PO_ITEM = '00010'.
ls_poitem-NO_MORE_GR = 'X'.
ls_poitem-final_inv = 'X'.
ls_poitem-MATERIAL = '989888'.
APPEND ls_poitem.
ls_poitemx-po_item = '00010'.
ls_poitemx-po_itemx = 'U'.
ls_poitemx-no_more_gr = 'X'.
ls_poitemx-final_inv = 'X'. "Final invoice
ls_poitem-MATERIAL = 'X'.
APPEND ls_poitemx.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = '0000404026'
poheader = '0000404026'
poheaderx = '0000404026'
TABLES
RETURN = ls_t_return
POITEM = ls_poitem
POITEMX = ls_poitemx.
LOOP AT ls_t_return.
CLEAR: l_msgty, l_msgid, l_msgno, l_msgtx.
l_msgty = ls_t_return-type.
l_msgid = ls_t_return-id.
l_msgno = ls_t_return-number.
l_msgtx = ls_t_return-message.
WRITE: / l_msgty, l_msgid, l_msgno, l_msgtx.
Endloop.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
2006 Dec 23 12:27 AM
Hi,
Are you changing a PO or an RFQ??
The sample code I provided worked fine for PO..
Thanks,
Naren
HI,
I am using this bapi to set the delivery completed and final invoice indicator for a single PO.
But iam unable to change it, is there any thing wrong in the program code, i meant in passing the parameters.
Please help me out.
REPORT ZCLOSEPO .
data: ls_POITEM like BAPIMEPOITEM occurs 0 with header line,
ls_POITEMX like BAPIMEPOITEMX occurs 0 with header line,
ls_t_return like BAPIRET2 occurs 0 with header line,
ls_purchaseorder like BAPIMEPOHEADER,
ls_poheader like BAPIMEPOHEADER,
ls_poheaderx like BAPIMEPOHEADERX.
DATA : l_msgty TYPE c,
l_msgid(2) TYPE c,
l_msgno(3) TYPE c,
l_msgtx(100) TYPE c,
l_errflag TYPE c.
clear: ls_t_return,
ls_poitem,
ls_poitemx.
ls_purchaseorder-PO_NUMBER = '0000404026'.
ls_poheader-PO_NUMBER = '0000404026'.
ls_poheaderx-PO_NUMBER = '0000404026'.
ls_poitem-PO_ITEM = '00010'.
ls_poitem-NO_MORE_GR = 'X'.
ls_poitem-final_inv = 'X'.
ls_poitem-MATERIAL = '989888'.
APPEND ls_poitem.
ls_poitemx-po_item = '00010'.
ls_poitemx-po_itemx = 'U'.
ls_poitemx-no_more_gr = 'X'.
ls_poitemx-final_inv = 'X'. "Final invoice
ls_poitem-MATERIAL = 'X'.
APPEND ls_poitemx.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = '0000404026'
poheader = '0000404026'
poheaderx = '0000404026'
TABLES
RETURN = ls_t_return
POITEM = ls_poitem
POITEMX = ls_poitemx.
LOOP AT ls_t_return.
CLEAR: l_msgty, l_msgid, l_msgno, l_msgtx.
l_msgty = ls_t_return-type.
l_msgid = ls_t_return-id.
l_msgno = ls_t_return-number.
l_msgtx = ls_t_return-message.
WRITE: / l_msgty, l_msgid, l_msgno, l_msgtx.
Endloop.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
2006 Dec 23 12:07 AM
Hi,
The changes are marked in bold..
REPORT ZCLOSEPO .
data: ls_POITEM like BAPIMEPOITEM occurs 0 with header line,
ls_POITEMX like BAPIMEPOITEMX occurs 0 with header line,
ls_t_return like BAPIRET2 occurs 0 with header line,
ls_purchaseorder like BAPIMEPOHEADER,
ls_poheader like BAPIMEPOHEADER,
ls_poheaderx like BAPIMEPOHEADERX.
DATA : l_msgty TYPE c,
l_msgid(2) TYPE c,
l_msgno(3) TYPE c,
l_msgtx(100) TYPE c,
l_errflag TYPE c.
clear: ls_t_return,
ls_poitem,
ls_poitemx.
<b>*ls_purchaseorder-PO_NUMBER = '0000404026'.
*ls_poheader-PO_NUMBER = '0000404026'.
*ls_poheaderx-PO_NUMBER = '0000404026'.</b>
ls_poitem-PO_ITEM = '00010'.
ls_poitem-NO_MORE_GR = 'X'.
ls_poitem-final_inv = 'X'.
<b>*ls_poitem-MATERIAL = '989888'</b>.
APPEND ls_poitem.
ls_poitemx-po_item = '00010'.
ls_poitemx-po_itemx = '<b>X</b>'.
ls_poitemx-no_more_gr = 'X'.
ls_poitemx-final_inv = 'X'. "Final invoice
<b>*ls_poitem-MATERIAL = 'X'.</b>
APPEND ls_poitemx.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = '0000404026'
<b>*poheader = '0000404026'
*poheaderx = '0000404026'</b>
TABLES
RETURN = ls_t_return
POITEM = ls_poitem
POITEMX = ls_poitemx.
LOOP AT ls_t_return.
CLEAR: l_msgty, l_msgid, l_msgno, l_msgtx.
l_msgty = ls_t_return-type.
l_msgid = ls_t_return-id.
l_msgno = ls_t_return-number.
l_msgtx = ls_t_return-message.
WRITE: / l_msgty, l_msgid, l_msgno, l_msgtx.
Endloop.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
Thanks,
Naren
2006 Dec 23 12:10 AM
Hi,
Also check this sample code..
PARAMETERS: p_ebeln LIKE ekko-ebeln OBLIGATORY.
PARAMETERS: p_ebelp LIKE ekpo-ebelp OBLIGATORY.
DATA: t_item LIKE bapimepoitem OCCURS 0 WITH HEADER LINE.
DATA: t_itemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
DATA: t_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
t_item-po_item = p_ebelp.
t_item-no_more_gr = 'X'.
t_item-final_inv = 'X'.
APPEND t_item.
t_itemx-po_item = p_ebelp.
t_itemx-po_itemx = 'X'.
t_itemx-no_more_gr = 'X'.
t_itemx-final_inv = 'X'.
APPEND t_itemx.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = p_ebeln
TABLES
return = t_return
poitem = t_item
poitemx = t_itemx.
LOOP AT t_return WHERE type = 'A' OR type = 'E'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
WRITE: / 'FAILED'.
ELSE.
WRITE: / 'SUCCESS'.
COMMIT WORK.
ENDIF.
Thanks,
Naren
2006 Dec 23 12:25 AM
Hi I got this erroe mesaage when executed the program with the changes!
E ME 616 Not possible to process an RFQ using this function
2006 Dec 23 12:15 AM
Hi,
Please reward points for helpful answers and close the thread if the problem is solved..
Thanks,
Naren
2021 May 06 3:27 PM
Hi Naren,
Error - E ME 616 Not possible to process an RFQ using this function while using BAPI_PO_CHANGE.
I would like to update the custom fields in ME43,ME42,ME41, i have added the custom fields at header(ekko) and item(ekpo) and at screen level using customer exit.
My requirement is to update the custom fields through bapi which i have added.
Please if you know can you share your solution
Thanks,
Gayathri.
2021 May 06 3:28 PM
Thanks for coming to SAP Community for answers. Please post your question as a new question here:
https://answers.sap.com/questions/ask.html Since you're new in asking questions here, check out our tutorial about asking and answering questions (if you haven't already), as it provides tips for preparing questions more effectively, that draw responses from our members. Please note, that your post here won't be answered.
2006 Dec 23 12:27 AM
Hi,
Are you changing a PO or an RFQ??
The sample code I provided worked fine for PO..
Thanks,
Naren
2012 Dec 31 9:29 AM
Dear Narendran,
I am using the BAPI_PO_CHANGE for closing the PO's, it is working fine but if the PO is set to Invoice Receipt = 'X', then it is throiwng the error indicator for invoice receipt used not allowed.Please help me on this. It is affecting the Productivity as they have close multiple PO's byt month end.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |