2014 Mar 19 9:56 AM
Hello experts,
I want to use BAPI_PR_CHANGE to close purchase requisition item when creating new PO with reference to PR, and here is my code snippet:
* Create table for purchase requisition item's changing indicators
APPEND INITIAL LINE TO lt_pritemsx ASSIGNING <fs_pritemx>.
<fs_pritemx>-preq_item = lv_pr_item_number.
<fs_pritemx>-closed = lc_x. " 'X' means we will change the CLOSED field
* Create table for purchase requisition item's new values
APPEND INITIAL LINE TO lt_pritems_new ASSIGNING <fs_pritem_new>.
MOVE-CORRESPONDING <fs_pritem> TO <fs_pritem_new>.
<fs_pritem_new>-closed = lc_x. " 'X' means the value of CLOSED field will be changed to 'X'
* Set "PReq. Closed" flag
CALL FUNCTION 'BAPI_PR_CHANGE'
EXPORTING
number = lv_pr_number
TABLES
return = lt_return
pritem = lt_pritems_new
pritemx = lt_pritemsx.
For most cases, BAPI_PR_CHANGE works well. But for some case, for example there is ‘Release stragety’ tab in some PR item, and I released it using ME54, then BAPI_PR_CHANGE will give me such message and 'PReq. Closed' flag is set failed.
But if I use BAPI_REQUISITION_DELETE for the same case, 'PReq. Closed' flag will be set successfully.
So could anyone tell me why BAPI_PR_CHANGE doesn't work here? And what's the difference between BAPI_REQUISITION_DELETE and BAPI_PR_CHANGE in deleting or closing purchase requisition?
Thanks,
Shelwin
2014 Mar 19 10:04 AM
Hi,
You also need to set the PRITEMX-CLOSED flag for the item which you want to close.
This is required in BAPI_PR_CHANGE.
Let me know if it helped?
Thanks,
Zuber
2014 Mar 19 10:36 AM
Hi Zuber,
I have already set the PRITEMX-CLOSED flag for the item, please refer to my code snippet.
Regards,
Shelwin
2014 Mar 19 10:32 AM
BAPI_REQUISITIONS* (4.0A+) are old BAPI relative to "outdated" non-Enjoy transaction, when BAPI_PR* (6.40+) are relative to new Enjoy transactions.
Reference : 499627 - FAQ: BAPIs for purchase requisitions and 1803189 - FAQ: End of Support of ME21, ME51, and BAPI_PO_CREATE etc.
Look also at OSS for notes relative to error ME 664 like 1908567 - BAPI_PO_CREATE1/BAPI_PO_CHANGE : Information message "ME 664" or 1287690 - Ready for input status of purchase requisition dialog box .
You should also been allowed to execute the change with ME52 and not with ME52N or with a warning/popup ?
Regards,
Raymond