‎2020 Jan 29 10:16 AM
Hi,
How to reject PR programmatically?
I found this BAPI_REQUISITION_RESET_RELEASE to cancel release. But this BAPI does not set the EBAN-BANPR (Proc. state) to '08' (Release Refused).
Thank you.
‎2020 Jan 29 10:42 AM
Hello,
It seems that it is not possible to reject a purchase requisition with a BAPI. Check note https://launchpad.support.sap.com/#/notes/2012650 for more information.
You could debug ME54N to find how the system rejects a purchase requisition.
Tip: Have a look in method IF_RELEASABLE_MM~INITIATE_RELEASE of class LCL_REQ_HEADER in function group MEREQ.
Regards
‎2020 Jan 29 10:42 AM
Hello,
It seems that it is not possible to reject a purchase requisition with a BAPI. Check note https://launchpad.support.sap.com/#/notes/2012650 for more information.
You could debug ME54N to find how the system rejects a purchase requisition.
Tip: Have a look in method IF_RELEASABLE_MM~INITIATE_RELEASE of class LCL_REQ_HEADER in function group MEREQ.
Regards
‎2020 Jan 30 6:22 AM
Hi,
Thank you for the reply. I have debugged ME54N, in my case it's in local class LCL_RELVIEW_MM, method execute, line 234 'MEREJECT'. I traced and it seems it updates BANPR to '08'. But I suppose, I am not expected to use the same way as in ME54N because it uses local classes (not sure if we can use those local classes in other programs).
I actually found a way to update BANPR by using BAPI_PR_CHANGE. include program L2105I03 method if_bapi_mereq~map2i_is2erp (line 184), it updates item and itemx from extensionin.
Thank you.
‎2020 Jan 30 10:53 AM
Hi,
Indeed, class LCL_RELVIEW_MM is the class behind the tab "Release strategy" of transactions ME**N. When you click on "Cancel release", the fcode is handled in method execute of lcl_relview_mm which call method IF_RELEASABLE_MM~INITIATE_RELEASE of class LCL_REQ_HEADER.
Are you sure the way you find to update BANPR is correct ? Because, if I check in my system, method if_bapi_mereq~map2i_is2erp calls a BADI (ME_BAPI_PR_IBS) which can only be implemented by SAP.
Regards,
‎2020 Feb 17 6:47 AM
Yes, it is for SAP implementation only, but I think we can create implicit enhancement at the end of the method.