10-21-2011 5:56 AM
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
10-21-2011 6:36 AM
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
10-21-2011 6:36 AM
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
10-21-2011 7:07 AM
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.
10-21-2011 7:15 AM
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
10-21-2011 7:27 AM
Thanks a lot it solved my first issue. Will work on it and will close thread after finishing.
12-14-2011 2:42 PM
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
12-15-2011 3:28 AM
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.
02-08-2024 10:10 PM - edited 02-08-2024 10:24 PM
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.