Wednesday, June 26, 2013

Dynamic Error Message usinge Message Class (SE91)



How to assign dynamic error message using Message Class (SE91)

1) Assign message variable , starting with ampersand(&) symbol and combine with number e.g &1 , &2 . Maximum 4 variable can be assigned.

2) Call the message in the ABAP program below is the code snippet. 


IF sy-subrc <> 0.
      
CLEARwa_messagetp_msg.
      
CONCATENATE 'Item No' wa_im_t_eban-bnfpo INTO tp_msg SEPARATED BY SPACE.
      wa_message
-type 'E'.
      wa_message
-id 'ZMM01'.
      wa_message
-number '082'.
      wa_message
-message_v1 tp_msg.
      
APPEND wa_message TO ex_messages.
*      MESSAGE e082(ZMM01) .
    
ENDIF.

3) The variable format for append the message is message_v1,message_v2  till message_v4

Wednesday, June 5, 2013

Display error message in report after Selection Screen

Below is the code snippet  to display error message, in report after selection of data.

Normal type 'E' report prevent user to back to original selection screen.

IF ta_report[] IS NOT INITIAL.
    
PERFORM display_report.
ELSE.
    
MESSAGE s000(zfi01WITH  'Data Does Not Exists' DISPLAY LIKE 'E'.
    
LEAVE LIST-PROCESSING.
ENDIF.