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: 

Warning messages from ME_PROCESS_REQ_CUST method CHECK

Former Member
0 Kudos

Hello All,

I am facing below mentioned issue with BADI ME_PROCESS_REQ_CUST

1: how can we issue warning messages from BADI ME_PROCESS_REQ_CUST method CHECK?

2: Check method is called twice if I click on check button in ME52N.

Thanks

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

1. Use MESSAGE '<text>' type 'W' in the check method to raise your warning.

2. Use a counter to make the your code execute only one time.

Hope this will surely help you !!

Regards,

Punit

7 REPLIES 7

Former Member
0 Kudos

Hi,

1. Use MESSAGE '<text>' type 'W' in the check method to raise your warning.

2. Use a counter to make the your code execute only one time.

Hope this will surely help you !!

Regards,

Punit

0 Kudos

Hi Punit,

1: I have tried that but no messages are shown at check if i issue warning messages. if i trigger error messages then it will be displyed.

HI ,

You can use Below

include mm_messages_mac. "useful macros for message handling

if  ur condition   .

mmpur_message_forced 'W' 'ME' '083' text-001 '' '' ''.

endif.

text-001 : text element for your description .

BUt Warning Message will not keep the screen on error page . it will be better to use 'E' for error if you want

mmpur_message_forced 'E' 'ME' '083' text-001 '' '' ''.

regards

Deepak.

Edited by: Deepak Dhamat on Oct 21, 2011 8:20 AM

0 Kudos

Thanks a lot it solved my first issue. Will work on it and will close thread after finishing.

0 Kudos

Hi there!

Did you figure out how to assign the warning/error messages to specific items of the purchase requisition?

I can issue warning messages that are shown at header lever but I did not discover how to assign it to a specìfic item.

Thanks a lot!

Regards,

Douglas

0 Kudos

Hi,

If messages are issued from method PROCESS_ITEM it will get assigned to specific line items in PR.

Use include include mm_messages_mac to issue warning message.

0 Kudos

I am aware that this question was asked more than 10 years ago, but there will continue to be new developers who face this problem. So...
Use the macro mmpur_business_obj in the methods for processing header, item and account assignment. And then the final nice trick which I discovered today after working with ABAP for more than 20 years, but admittedly not with ME_PROCESS_REQ_CUST all those years 😄
In the CHECK method, get the message handler and get the highest message severity to decide whether the check failed (to prevent saving a requisition with error messages).

 

  METHOD if_ex_me_process_req_cust~check.
    CHECK im_hold = mmpur_no AND im_park = mmpur_no.

    ch_failed = im_header->is_valid( ).

    INCLUDE mm_messages_mac. " useful macros for message handling
    cl_message_handler_mm=>get_handler( IMPORTING ex_handler = gl_message_handler ).
    DATA(msg_severity) = gl_message_handler->get_severity_bo( im_header ).
    IF msg_severity >= mmpur_event_e.
      ch_failed = mmpur_yes.
      RETURN.
    ENDIF.

    LOOP AT im_header->get_items( ) ASSIGNING FIELD-SYMBOL(<itm>).
      msg_severity = gl_message_handler->get_severity_bo( im_business_obj          = <itm>-item
                                                          im_include_child_objects = mmpur_yes ).
      IF msg_severity >= mmpur_event_e.
        ch_failed = mmpur_yes.
        EXIT.
      ENDIF.
    ENDLOOP.
  ENDMETHOD.

  METHOD if_ex_me_process_req_cust~process_account.
    INCLUDE mm_messages_mac. " useful macros for message handling
    mmpur_business_obj im_account_ref.
    [... your checks and MESSAGE tnnn(cl) WITH v1..v4 INTO for_where_used_list ...]
    mmpur_metafield mmmfd_[whatever].
    mmpur_message_forced sy-msgty sy-msgid sy-msgno
                         sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDMETHOD.

  METHOD if_ex_me_process_req_cust~process_header.
    INCLUDE mm_messages_mac. " useful macros for message handling
    mmpur_business_obj im_header.
    [... your checks and MESSAGE tnnn(cl) WITH v1..v4 INTO for_where_used_list ...]
    mmpur_metafield mmmfd_[whatever].
    mmpur_message_forced sy-msgty sy-msgid sy-msgno
                         sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDMETHOD.

  METHOD if_ex_me_process_req_cust~process_item.
    INCLUDE mm_messages_mac. " useful macros for message handling
    mmpur_business_obj im_item.
    [... your checks and MESSAGE tnnn(cl) WITH v1..v4 INTO for_where_used_list ...]
    mmpur_metafield mmmfd_[whatever].
    mmpur_message_forced sy-msgty sy-msgid sy-msgno
                         sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDMETHOD.

 

 
Kjetil Kilhavn (Vettug AS) - ABAP developer since Feb 2000