Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop PO to be created in case of failed check condition?

Former Member
0 Kudos

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.

4 REPLIES 4

Former Member
0 Kudos

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

gaurab_banerji
Active Participant
0 Kudos

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.

raymond_giuseppi
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.