05-20-2014 2:14 PM
Hi All,
I am doing some check on PO creation in PO BADI ME_PO_CUST method process header , in case if my check fails I need to show error message and stops further processing of PO i.e stop user to create PO . I am able to show error message but how to stop further processing of PO?
Thanks in advance.
05-20-2014 2:31 PM
Hi!
You can used method CHECK for that.
There you have a variable of type MMPUR_BOOL. if one of your checks fails, you can set this flag in order to abord processing.
You can also use method im_header->invalidate to set the header to error state if you prefer to do that.
Regards
Florian
05-20-2014 2:38 PM
You can use the BADI ME_PROCESSPO_CUST for issueing the messages normally, what all additionally you have to do is export a flag for error from the BADI so that you can import the same in BADI ME_HOLD_PO to set the hold flag to space.
For example in method ME_PROCESS_PO_CUST~PROCESS_ITEM if you have isued an error message like:
MMPUR_METAFIELD 007.
MMPUR_MESSAGE_FORCED 'E' 'ZPRPO' '000' '' '' '' ''.
CALL METHOD IM_ITEM->INVALIDATE( ).
flag = 'X'.
Just add one export flag to the code:
export flag from flag to memory id 'HOLD_PO'.
Once you have issued the message use the same in method ME_HOLD_PO~IS_ALLOWED.
data : flg type c.
import flag to flg from memory id 'HOLD_PO'.
if flg = 'X'.
ch_allowed = space.
endif.
05-20-2014 2:45 PM
First read the BAdI documentation and notes/documents like 1709562 - Messages ignored in BAdIs
ME_PROCESS_REQ_CUST and ME_PROCESS_PO_CUST. Also look at sample implementation CL_EXM_IM_ME_PROCESS_PO_CUST provided by SAP for usage of macro like macro mmpur_message_forced.
Regards,
Raymond
05-20-2014 3:10 PM
My scenario is like we are creating intercompany STO so as soon as user enters supplying pant at header and receiving plant at item level based on these two plants need to do check and if that fails stop user to hold or save PO...this processing I am doing in BADI ME_PO_CUST method process-header I tried to use im_header->invalidate but it still allowing me to hold PO and generate PO no. that I want to stop.