Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
chengalarayulu
Active Contributor
0 Kudos

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.

Labels in this area