Hello,
CRM_MESSAGE_COLLECT can be used e.g. in this way:
*first delete existing messages
DATA: lw_msg TYPE bal_s_idno,
lt_msg TYPE bal_r_idno.
lw_msg-sign = 'I'.
lw_msg-option = 'EQ'.
lw_msg-low-msgid = 'YOURMESSAGECLASS'.
lw_msg-low-msgno = '065'.
APPEND lw_msg TO lt_msg.
lw_msg-low-msgno = '066'.
APPEND lw_msg TO lt_msg.
CALL FUNCTION 'CRM_MESSAGES_DELETE'
EXPORTING
it_r_msgidno = lt_msg
iv_ref_object = iv_guid
iv_caller_name = 'ORDERADM_H'
EXCEPTIONS
appl_log_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*ERRORS? create new message
message e066(yourmsgclass) into lv_msg.
CALL FUNCTION 'CRM_MESSAGE_COLLECT'
EXPORTING
iv_caller_name = 'ORDERADM_H'
iv_ref_object = iv_guid
iv_msgno = sy-msgno
iv_msgid = sy-msgid
iv_msgty = sy-msgty
* iv_msgv1 = lf_msgv1
EXCEPTIONS
not_found = 1
appl_log_error = 2
OTHERS = 3.
raise do_not_save.
maybe you will have to register the message/message class in
table CRMC_MESSAGES or CRMC_MESSAGES_S.
The result should be that the collected messages are shown in the message log in
transaction CRMD_ORDER
regards,
Christoph