Hi,
You can multiple message at once by different ways. For example
You can use CRM_MESSAGE_COLLECT function module or global message container.
Using global message container:
lr_gmc TYPE REF TO cl_crm_genil_global_mess_cont
lr_core = cl_crm_bol_core=>get_instance( ).
lr_gmc = lr_core->get_global_message_cont( ).
CALL METHOD
lr_gmc->add_message
EXPORTING
iv_msg_type = 'E'
iv_msg_id = ' message class'
iv_msg_number = '000'
iv_msg_v1 =
iv_msg_v2 =
iv_show_only_once = 'X'
For using FM:
You need to delete the messages first and then set messages again so that message will be displayed only in required case
** delete all the messages in zlto_msg
CALL FUNCTION 'CRM_MESSAGES_DELETE'
EXPORTING
it_r_msgid = lt_msgid
* it_r_msgidno = lt_r_msg
iv_ref_object = ls_items-guid
iv_ref_kind = 'B'
iv_caller_name = lc_caller_obj
EXCEPTIONS
appl_log_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
then setting the message
CALL FUNCTION 'CRM_MESSAGE_COLLECT'
EXPORTING
iv_caller_name = lc_caller_obj
iv_ref_object = ls_items-guid
iv_ref_kind = 'B'
iv_msgno = '004'
iv_msgid = lc_msg_class
iv_msgty = 'E'"ls_items-number_int
EXCEPTIONS
not_found = 1
appl_log_error = 2
OTHERS = 3.
I hope this would be helpful for you.