cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAdI impl. ME_PROCESS_PO give an error message but the PO can also be saved

Former Member
0 Likes
893

Hi experts,

I implement BADI ME_PROCESS_PO and make some check in method IF_EX_ME_PROCESS_PO~PROCESS_ACCOUNT.

In this method I give an error message using:

mmpur_message 'E' '/FMFMS/FM' '041' '' '' '' ''.

But when I save the error PO it can also be saved.

will you please kindly tell me how to solve the problem?

Best regards,

Tracy

Accepted Solutions (0)

Answers (4)

Answers (4)

RaymondGiuseppi
Active Contributor
0 Likes

Try a code like

       mmpur_metafield mmmfd_cost_ctr.
       mmpur_message_forced 'E' 'ZFSM' '425' ls_accounting-kostl ' ' ' ' ' '.
       im_account->invalidate( ).

Regards,

Raymond

Sijin_Chandran
Active Contributor
0 Likes

Hello Tracy ,

That POs are saved as HELD Purchase Orders , if you need to restrict creation of HELD POs you need to implement ME_HOLD_PO  BADI.

Check the below thread ,

http://scn.sap.com/message/10471722


Former Member
0 Likes

HI,

I could save the PO not HELD it.

Sijin_Chandran
Active Contributor
0 Likes

Ok Tracy ,

You write your logic in ME_HOLD_PO and check .

Just Give this solution a try .

If you have gone through the above link then you can find that my purpose was quite similar as that of yours.

Former Member
0 Likes

Hello Sij,

I have go through the above link, you mentioned that when you did check in BADI  ME_HOLD_PO, you can not correct the error.

Sijin_Chandran
Active Contributor
0 Likes

Yeah , that issue will be there.

Former Member
0 Likes

But I hope the user can correct the error rather than closing the window and reopening it.

Sijin_Chandran
Active Contributor
0 Likes

No but this issue will be there , reason being messages behave differently in various sections of codes in ABAP , especially in BADI with Update tasks.

Similar phenomenon prevails here also.

So you need to check for other alternatives.

Former Member
0 Likes

Yeah, thank you very much!

former_member210730
Participant
0 Likes

Hi Tracy,

May be you need to have a hard error which will actually stop the processing thereby preventing the error PO from getting saved.

Thanks

Vinay

Former Member
0 Likes

yes, but how could I do that?

kathylau007
Explorer
0 Likes

To add custom error message into PO screen:
mmpur_message_forced 'E' '<msgid>' '<msgno>' lv_msgv1 lv_msgv2 lv_msgv3 lv_msgv4.

To stop PO from saving:
 IF sy-ucomm EQ 'MESAVE'.
  "Prompt data incomplete dialog screen with 'Hold' button
  MESSAGE e000(mepo).
ENDIF.