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: 

How to display Warning messages in BADI ME_PROCESS_REQ_CUST?

Former Member
1,673

Hi,

I have implemented BADI ME_PROCESS_REQ_CUST and coded necessary logic according to my requirement in Method PROCESS_ITEM.

On a certain condition , I need to display a Warning message.

I have written the code as follows:--

message w001(00) with 'XYZ'.

It didnt work.

Then, I included the message in message class ZPBS, and coded as follows.

message w012(zpbs).

But, still it didnt work..

Can u guys please guide me what I need to do?

Thanks,

Shivaa....

1 ACCEPTED SOLUTION

uwe_schieferstein
Active Contributor
0 Kudos
431

Hello Shiva

Have a look at method PO_READ of class CL_PO_HEADER_HANDLE_MM.


METHOD po_read.

  INCLUDE mm_messages_mac.

  DATA: l_po_number TYPE ekko-ebeln.

  IF im_po_number NE space.
    l_po_number = im_po_number.
  ELSE.
    l_po_number = po_number.
  ENDIF.

* authority check on transaction code disabled
* If called via CALL TRANSACTION, this check is already done by basis
* (see note 358122)
* restriction of T-code authority check to Enjoy only
  IF for_bapi IS INITIAL.
* tcode authorization
    IF NOT im_tcode IS INITIAL.
      CALL FUNCTION 'AUTHORITY_CHECK_TCODE'
        EXPORTING
          tcode  = im_tcode
        EXCEPTIONS
          ok     = 0
          not_ok = 1
          OTHERS = 2.
      IF sy-subrc NE 0.
        MESSAGE e172(00) WITH im_tcode INTO gl_dummy.
        mmpur_message_forced 'E' '00' '172' im_tcode '' '' ''.
        ex_result = mmpur_no.
        CALL METHOD set_state( im_state = c_available ).
        EXIT.
      ENDIF.
    ENDIF.
  ENDIF.
...

Add the include MM_MESSAGE_MAC to you method and set the message using macro MMPUR_MESSAGE_FORCED.

I am not sure whether the warning will indeed be displayed while changing an item but it should be displayed when checking the purchase requisition and presumably when saving it.

Regards

Uwe

4 REPLIES 4

Former Member
0 Kudos
431

Did you try placing a break-point and debugging the BADI, usually it should work with the way you designed.

uwe_schieferstein
Active Contributor
0 Kudos
432

Hello Shiva

Have a look at method PO_READ of class CL_PO_HEADER_HANDLE_MM.


METHOD po_read.

  INCLUDE mm_messages_mac.

  DATA: l_po_number TYPE ekko-ebeln.

  IF im_po_number NE space.
    l_po_number = im_po_number.
  ELSE.
    l_po_number = po_number.
  ENDIF.

* authority check on transaction code disabled
* If called via CALL TRANSACTION, this check is already done by basis
* (see note 358122)
* restriction of T-code authority check to Enjoy only
  IF for_bapi IS INITIAL.
* tcode authorization
    IF NOT im_tcode IS INITIAL.
      CALL FUNCTION 'AUTHORITY_CHECK_TCODE'
        EXPORTING
          tcode  = im_tcode
        EXCEPTIONS
          ok     = 0
          not_ok = 1
          OTHERS = 2.
      IF sy-subrc NE 0.
        MESSAGE e172(00) WITH im_tcode INTO gl_dummy.
        mmpur_message_forced 'E' '00' '172' im_tcode '' '' ''.
        ex_result = mmpur_no.
        CALL METHOD set_state( im_state = c_available ).
        EXIT.
      ENDIF.
    ENDIF.
  ENDIF.
...

Add the include MM_MESSAGE_MAC to you method and set the message using macro MMPUR_MESSAGE_FORCED.

I am not sure whether the warning will indeed be displayed while changing an item but it should be displayed when checking the purchase requisition and presumably when saving it.

Regards

Uwe

0 Kudos
431

Hi Owe,

I think, we have to comment the line from your sample. Otherwise, it is exactly correct:

  • MESSAGE e172(00) WITH im_tcode INTO gl_dummy.

The macro, mmpur_message_forced is responsible for poping up the error message thro BADI.

Rgds,

Ramani N.

Former Member
0 Kudos
431

MESSAGE 'xyz' TYPE 'W'.