Skip to Content
Author's profile photo Former Member

Sap CRM : WebUi specfic Messages handling

We often come across the requirement when we need to suppress the specific messages on web ui which we not find in the message container CL_CRM_GENIL_MESS_CONT_MANAGER .This Messages we will get from the reference of class cl_bsp_wd_message_service.

1. The messages which are added to the global message container can be deleted by resetting the class :

DATA: lr_core TYPE REF TO cl_crm_bol_core,

  lr_msg TYPE REF TO cl_crm_genil_mess_cont_manager.

  lr_core = cl_crm_bol_core=>get_instance( ).

 

*Create a instance of message container

 

lr_msg = lr_core->get_message_cont_manager( ).

  *Reset the container to delete the messages

  lr_msg->reset( ).

2. But when we want to delete any specific messages type from web ui using the
reference of class cl_bsp_wd_message_service.

 

Read all the messages that are added by reference of class cl_bsp_wd_message_service by below code snippet:

 

DATA: lr_msg_srv       TYPE  REF TO     cl_bsp_wd_message_service ,     
            lv_ref_kind       TYPE  crmt_object_kind,

            lv_msgidno      TYPE symsgno,

           lt_idno              TYPE bal_r_idno,

          ls_idno              TYPE bal_s_idno,

           lv_activity_guid    TYPE crmt_object_guid,

           lr_messages          TYPE REF TO bsp_wd_message_tab,

          lr_entity                 TYPE REF TO     if_bol_bo_property_access,

          lv_guid                 TYPE REF TO     data.

      lt_message             TYPE crmt_orgman_symsgno_tab,

       lr_mess_obj      TYPE REF TO cl_crm_message_obj_bt.

    FIELD-SYMBOLS  :
<lt_message> TYPE bsp_wd_message_tab,

  <ls_message> TYPE bsp_wd_message.

 
FIELD-SYMBOLS:  
<l_guid>        TYPE crmt_object_guid.

 

  CONSTANTS:

    lc_msgid                     TYPE symsgid VALUE ‘R11’.

lr_msg_srv = me->view_manager->get_message_service( ).

  

CALL METHOD lr_msg_srv->get_messages

  

EXPORTING

   iv_msg_type = ‘W’

  

RECEIVING

  

rv_result = lr_messages.

 

*We got all the required messages in lr_messages

ASSIGN lr_messages->* TO <lt_message>.

*Then call the below function module to delete the specific messages

 

lv_msgidno = ‘185’.

  

INSERT lv_msgidno INTO TABLE lt_message.

  LOOP AT lt_message INTO lv_msgidno.

   CLEAR ls_idno.

   ls_idnosign= ‘I’.

ls_idnooption = ‘EQ’.
ls_idnolowmsgid = lc_msgid.
ls_idnolowmsgno = lv_msgidno.
APPEND ls_idno TO lt_idno.
ENDLOOP.

* The below FM ‘CRM_MESSAGES_DELETE’ is used the delete the specific messages from the web ui

CALL FUNCTION ‘CRM_MESSAGES_DELETE’

   EXPORTING

  

* it_r_msgid = ‘R11’

   it_r_msgidno = lt_idno

   iv_ref_object = lv_activity_guid

   iv_ref_kind = lv_ref_kind

       EXCEPTIONS

   appl_log_error = 1

   OTHERS = 2.

IF sysubrc
<>
0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

In the above function module we have to pass the specific
message id number in the required passing parametr also order_guid and ref_kind
in order to delete the specif messages.

Hope it will be going to help for those who gets confuse while handling the messages on webUi .

Happy Learning

Cheers !!

Vicky

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Francisco Javier Argel Esquivel Díaz
      Francisco Javier Argel Esquivel Díaz

      Nice post.

      Thanks for share.

      Regards, Argel.

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hello Argel,

      Thanks for your feedback !!

      Regards,

      Vicky.

      Author's profile photo Mark Oscar-Few
      Mark Oscar-Few

      Works like a Charm 🙂

      Thanks for the Post, Prashant.

      Regards,

      Mark.

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thanks Mark