CRM and CX Blogs by Members
Find insights on SAP customer relationship management and customer experience products in blog posts from community members. Post your own perspective today!
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member186543
Active Contributor
0 Kudos

Purpose :

To trigger/handle events from messages in CRM Web-UI.

Explanation :


In CRM Web-UI, we can enable messages to appear as links, on the click of which a custom event can be triggered. Eg: On the click of a particular message , you can change status of a transaction or navigate to another page etc.



Steps :

1. In the view controller's class in tcode : BSP_WD_CMPWB, add an interface : IF_BSP_WD_MESSAGE_HANDLER ( This interface is responsible for handling message events ).

2. We need to subscribe the message's handler class, this can be done in any method in the controller class : I prefer , DO_INIT_CONTEXT.

DATA : lr_msg       TYPE REF TO cl_bsp_wd_message_service.

   lr_msg ?= cl_bsp_wd_message_service=>get_instance( ).

"Subscribe message for handling with the controller class

       lr_msg->subscribe_message(

         EXPORTING

           iv_message_class  'ZCRM_MESSAGES'   " Messages, Message Class

           iv_message_number '006'   " Messages, Message Number

           iv_subscriber     me  " Interface for Error Handler

       ).

     CATCH cx_bsp_wd_dupl_mess_subscr.    " Error: Double Registration for a Message

   ENDTRY.


3. In the controller class ( IMPL's ) method : IF_BSP_WD_MESSAGE_HANDLER~HANDLE_MESSAGE , you can handle the message events like this :


method IF_BSP_WD_MESSAGE_HANDLER~HANDLE_MESSAGE.

   if is_message-id = 'ZCRM_MESSAGE' and is_message-number = '006'.

     "logic to handle event

   endif.

endmethod.