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.


/wp-content/uploads/2014/03/1_410392.png


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 ).

/wp-content/uploads/2014/03/1_410392.png

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_messageid = ‘ZCRM_MESSAGE’ and is_messagenumber = ‘006’.

     “logic to handle event

   endif.

endmethod.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply