I'm trying to prevent a user from saving a Purchase Requisition through a BAdI implementation, checking lines and accounts. The error messages I throw do not stop the saving process, and I can't find a way to invalidate the line, as I would in PO's. So, a PR can be saved containing faulty data.
I extended the purchase requisition BAdI and implemented IF_EX_ME_PROCESS_REQ_CUST
in ZCL_IM_EI_PROCESS_REQ_CUST
. In methods PROCESS_ITEM
and PROCESS_ACCOUNT
I have access to several imports on account and item. Unlike the PO though, I can't find a way to invalidate an item. None of the classes used offer that functionality.
The PR item objects I have access to in the BAPI are of interface IF_PURCHASE_REQUISITION_ITEM
, implemented as a local class in function pool MEREQ
. This interface has a method IS_VALID
but does not offer anything to invalidate, in contrast to the PO item interface, which has an INVALIDATE
method.
edit
After more debugging it seems the invalidation is done through member MY_STATE-BROKEN_RULES
from local class MEREQ/LCL_REQ_ITEM
. Any idea how I can access this?