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.
CLEAR: wa_message, tp_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.
CLEAR: wa_message, tp_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
No comments:
Post a Comment