12 Replies Latest reply: Jun 1, 2012 6:22 PM by Krishna Charan RSS

How to display information message from badi

Krishna Charan
Currently Being Moderated

Hi All,

 

        I have a scenario where i have to display the information message from order_save badi. I tried using crm_message_collect but i am successful to display error message which collects all the messages into application log and displays it.

Also i am able to display the information message by raising the event do_not_save and by using the different classes like message services which does not display the msg in Gui or when u display it from inbox.

 

 

I debug the code and find that, Created new entry in view crmv_message with the message Id but not successful.

 

 

Please help me to display information message from badi using crm_message_collect Fm or other FM's.

 

 

Thanks in Advance,

 

 

 

 

Regards,

Charan

  • Re: How to display information message from badi
    Nithish PP
    Currently Being Moderated

    Hi Charan,

     

    CRM_MESSAGE_COLLECT can be used in Badi to display information messages( TYPE I) both in GUI and Web UI. The message container classes can be used only if you would like to display information messages in Web UI.

     

    Regards,

    Nithish

  • Re: How to display information message from badi
    Ajaya Kumar
    Currently Being Moderated

    You can try this in DO_PREPARE_OUTPUT.

     

       DATA : lv_logh    TYPE balloghndl,
             lt_logh          TYPE bal_t_logh,
             lt_msg_handle    TYPE bal_t_msgh,
             ls_msg_handle    TYPE balmsghndl,
             lv_guid          TYPE crmt_object_guid,
             ls_bal_message   TYPE bal_s_msg,
        

             lr_msg_srv        TYPE REF TO cl_bsp_wd_message_service.

     

       ** Get the log
          CALL FUNCTION 'CRM_MESSAGES_REGISTER'
            EXPORTING
              iv_docnumber  = lv_guid  "<------ guid of business transaction
            CHANGING
              cv_log_handle = lv_logh.
          CLEAR lt_logh.
          INSERT lv_logh INTO TABLE lt_logh.

    *     Check if planning message
          CALL FUNCTION 'BAL_GLB_SEARCH_MSG'
            EXPORTING
              i_t_log_handle = lt_logh
            IMPORTING
              e_t_msg_handle = lt_msg_handle
            EXCEPTIONS
              msg_not_found  = 0
              OTHERS         = 0.

          LOOP AT lt_msg_handle INTO ls_msg_handle.
            CALL FUNCTION 'CRM_MESSAGES_GET_MSG_INFO'
              EXPORTING
                is_msg_handle           = ls_msg_handle
              IMPORTING
                es_msg                  = ls_bal_message
              EXCEPTIONS
                not_found               = 1
                wrong_context_structure = 2
                OTHERS                  = 3.
            IF ls_bal_message-msgid = 'MSG_CLASS' AND ls_bal_message-msgno = '199'. "check for specifc message if found add it, then exit  "chnage it according to your req.
              lr_msg_srv->add_message( EXPORTING iv_msg_type   = ls_bal_message-msgty
                                                 iv_msg_id     = ls_bal_message-msgid
                                                 iv_msg_number = ls_bal_message-msgno
                                                 iv_msg_v1     = ls_bal_message-msgv1
                                                 iv_msg_v2     = ls_bal_message-msgv2
                                                 iv_msg_v3     = ls_bal_message-msgv3
                                                 iv_msg_v4     = ls_bal_message-msgv4
                                                 iv_msg_level  = '1' ).
              EXIT.
            ENDIF.
          ENDLOOP.

  • Re: How to display information message from badi
    Krishna Charan
    Currently Being Moderated

    Thanks to all for your helpful responses. I am closing this discussion as i followed another approach.

     

     

     

     

    Regards,

    Charan