Skip to Content

This document guides you to how to report multiple types(error, success, warning) of messages in one shot.

Let you wanna display multiple types (error, warning, success) messages, just create your own structure follows:

Types: Begin of ty_messages,

               message type string,

               message_type type char01,

          end of ty_messages.

Data: lt_messages type table of ty_messages,

          ls_messages type ty_messages.

Data: lv_error_true(1).

**** Append the messages in your required places. 

ls_messages-message_type = ‘S’.

ls_messages-message = ‘This is success message’.

append ls_messages to lt_messages.

ls_messages-message_type = ‘E’.

ls_messages-message = ‘This is error message’.

append ls_messages to lt_messages.

ls_messages-message_type = ‘W’.

ls_messages-message = ‘This is success message’.

append ls_messages to lt_messages.

if lt_messages is not initial.

loop at lt_messages into ls_messages.

if ls_messages-message_type eq ‘E’.

     lo_message_manager->report_error_message(

               message_text = ls_messages-message ).

lv_error_true = ‘X’. “””” if required to stop the process.

elseif ls_messages-message_type eq ‘W’.

     lo_message_manager->report_warning(

               message_text = ls_messages-message ).

elseif ls_messages-message_type eq ‘S’.

     lo_message_manager->report_success(

               message_text = ls_messages-message ).

endif.

endloop.

if lv_error_true = ‘X’.    “”” Stops the process if there is any Error message.

     RETURN.

ENDIF.

endif.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply