I used the funtion module 'CRM_MESSAGE_COLLECT' to popup the message in Both Gui & PCUI. When I use the message type is Error(iv_msgty = 'E'), that's OK. But if the message type is Warning or Info, No message displayed. I don't know why? could anybody give me the comments about it?
CALL FUNCTION 'CRM_MESSAGE_COLLECT'
iv_caller_name = 'ORDER'
iv_ref_object = iv_guid
iv_ref_kind = 'A'
iv_msgno = 131
iv_msgid = 'ZD'
iv_msgty = 'E, 'I', 'W'
iv_msgv1 = text-007
iv_msgv2 = space
iv_msgv3 = space
iv_msgv4 = space
not_found = 1
appl_log_error = 2
OTHERS = 3.
if you dive into the code of function module CRM_MESSAGE_COLLECT, you will find a call to the function module CRM_ORDER_MESSAGES_READ_CB.
In here the table CRMC_MESSAGES_S will be read (maintained by developer) as well as CRMC_MESSAGES (maintained by customer). If you do the proper configuration in these tables, your message will be displayed.
So you don't need to fetch an instance of CL_CRM_GENIL_GLOBAL_MESS_CONT
DATA lr_core TYPE REF TO cl_crm_bol_core. DATA lr_mess_cont TYPE REF TO cl_crm_genil_global_mess_cont. lr_core = cl_crm_bol_core=>get_instance( ). lr_core->start_up( 'ALL' ). lr_mess_cont = lr_core->get_global_message_cont( ). lr_mess_cont->add_message( EXPORTING iv_msg_type = 'I' iv_msg_id = '00' iv_msg_number = '398' iv_msg_v1 = 'Information message' ).
Nor you need to modify the standard IF_BSP_WD_STATE_CONTEXT~GET_MESSAGE_FILTER of your Web UI Component.
This put me in the right direction.
Proper config in table CRMC_MESSAGES means adding an entry for your message with MSGTY = 'W' and MSGSAVE = 'X'. Note that this last flag will make the message persistent and also show when the CIC is started later for the same document. Also note that the document will still be saved without any further user interaction, so it behaves different than generating a warning with the command MESSAGE.
did not need to add anything to CRMC_MESSAGES_S.