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: 

Waring message not displayed

Junaidshaik284
Participant
0 Kudos
283

I tried to display warning ⚠️ but didn't display in purchase order me22n tcode and but error message it is showing and warning message is not displaying when I wrote code and help me to get it and it is badi enhancement that I am implenting

7 REPLIES 7

Robert-Fels
Participant
189

To display a warning message in the ME22N transaction, you can use the following steps:

1. Create a function module that will contain the code to display the warning message. The function module should have the following signature:

FUNCTION z_display_warning.
  *"----------------------------------------------------------------------
  *"*"Local Interface:
  *"  IMPORTING
  *"     VALUE(I_MESSAGE) TYPE  STRING
  *"  EXPORTING
  *"     VALUE(E_MESSAGE) TYPE  STRING
  *"----------------------------------------------------------------------

2. In the function module, use the following code to display the warning message:

MESSAGE i_message TYPE 'W' DISPLAY LIKE 'I'.

3. In the ME22N transaction, go to the screen where you want to display the warning message and add the following code in the PAI (Process After Input) event:

CALL FUNCTION 'Z_DISPLAY_WARNING'
  EXPORTING
    i_message = 'Your warning message goes here'
  IMPORTING
    e_message = lv_dummy.

This should display the warning message when the ME22N transaction is executed.

I hope this helps!

0 Kudos
189

Thank you sir, I will try and once it's working then I will let u know

raymond_giuseppi
Active Contributor
189

In a MM BAdI such as ME_PROCESS_PO_CUST, there are macros provided to handle messages.

INCLUDE mm_messages_mac. " to load the macro
mmpur_metafield mmmfd_acctasscat. " field which carry the message (type pools MMMFD)
mmpur_metafield_add mmmfd_net_price. " another field if required
mmpur_message_forced 'W' 'ZMM' '123' ls_item-knttp space space space. " sample of message<br>

0 Kudos
189

How to see macros. Can you tell me the process

0 Kudos
189

I wrote this code that It is giving an error ls_item is unknown

0 Kudos
189

That was a sample, replace it with a space or a text for your test.

For your reference, extract for check method

METHOD if_ex_me_process_po_cust~check.

  INCLUDE mm_messages_mac.

  DATA: ls_header TYPE mepoheader,
        lt_items  TYPE purchase_order_items,
        ls_items  TYPE purchase_order_item.

* Set context
  mmpur_context mmcnt_context_badi.
* read PO header
  ls_header = im_header->get_data( ).
* get list of items
  lt_items = im_header->get_items( ).
* loop on items
    LOOP AT lt_items INTO ls_items.
      ls_item = ls_items-item->get_data( ).
* raise an error, replace <placeholder> with your variables or constants
      IF <mttype> = 'E'.
        ch_failed = abap_true.
      ENDIF.
      mmpur_message_forced <mttype> <mid> <num> <dobj1> <dobj2> <dobj3> <dobj4>.
* etc.
    ENDLOOP.

0 Kudos
189

Thank you so much Raymond 😊. You guys r superb and I am very interested to learn now and thank you so much....