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: 

Me21n Need to Raise Error message through the badi.

former_member196331
Active Contributor
0 Kudos

Hi.

I have one doubt. Need Your suggestions.I need to validate the Down payment with Total po amount.

So, i used   Badi  ME_PROCESS_PO_CUST-> PROCESS_HEADER Method.

I have found some posts that  i should not used the Normal error message Like Below

message 'error' Type 'E'..

If i want to Add error message in Error log. I need to use INCLUDE  mm_messages_mac.

I am raising the Error message like below.


  MMPUR_MESSAGE 'E' 'ZME21NER' '001' '' '' '' ''.  (i created custom message using Se91)


While adding first time,Error message is triggering, But After Some times If i press Enter,

Error message is Not in the log. Please have a look on below attached image. After some time also.

The custom message should be there. May i know what should i do.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

Did you invalidate the header to trigger next execution of BAdI method at next enter?


ls_header = im_header->get_data( ).

* Clear messages (case of multiple call)

mmpur_context mmcnt_context_badi.

IF NOT ls_header-id IS INITIAL.

  mmpur_remove_msg_by_context ls_header-id mmcnt_context_badi.

ENDIF.

* Add some error error

IF invalid_data.

  mmpur_metafield mmmfd_vendor.

  mmpur_message_forced 'E' 'ZFSM' '999' ls_header-lifnr ' ' ' ' ' '.

  im_header->invalidate( ).

  EXIT.

ENDIF.

Regards,

Raymond

3 REPLIES 3

raymond_giuseppi
Active Contributor
0 Kudos

Did you invalidate the header to trigger next execution of BAdI method at next enter?


ls_header = im_header->get_data( ).

* Clear messages (case of multiple call)

mmpur_context mmcnt_context_badi.

IF NOT ls_header-id IS INITIAL.

  mmpur_remove_msg_by_context ls_header-id mmcnt_context_badi.

ENDIF.

* Add some error error

IF invalid_data.

  mmpur_metafield mmmfd_vendor.

  mmpur_message_forced 'E' 'ZFSM' '999' ls_header-lifnr ' ' ' ' ' '.

  im_header->invalidate( ).

  EXIT.

ENDIF.

Regards,

Raymond

0 Kudos

Hi,

Thanks for your reply.

Are you asking me to do the Delete the  id of the Error.

What about the Standard Error. Like line item does not have plant , qty, it is deleting the Standard errors also.

0 Kudos

Don't worry the context is set by mmpur_context, so no "damage" to standard messages, nor to BAdI error message on line item or account records or other part of the PO.

Regards,

Raymond