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
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
Thanks Nithish for reply,
Yes you are correct,but,my question is how to display information message using crm_message_collect as i mentioned in my Question. i tried with passing the message type,Msg id and other parametrs also but not successful.
Hi Charan,
I have encountered such problem in reports( for type I and E).Check also for warning message type W in Badi to figure out this problem is for only type I.
You can search for FM CRM*MESSAGE*REGISTER* ( don't remember exactly)and get the log handle from that and pass it to FM CRM_MESSAGE_COLLECT . Also pass object guid to iv_docnumber for this FM.
Regards,
Nithish
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.
Hi Nitish,
I tried but unsuccessful, Something else needs to be done. Could u please explain in Detail?
Hi Ajaya Kumar,
Thank you very much for reply, I don't want to use message service class which does not display in Gui (and also message will disappear for next round trip if i pass show only once as true otherwise it displays untill i press END).
Thanks in advance,
Regards,
Charan
HI Charan,
Try this code.
CALL FUNCTION 'CRM_MESSAGES_REGISTER'
EXPORTING
iv_docnumber = v_guid
CHANGING
cv_log_handle = v_log_handle.
CALL FUNCTION 'CRM_MESSAGE_COLLECT'
EXPORTING
iv_caller_name = <object name> ( of type crmt_object_name )
iv_ref_object = v_guid
iv_ref_kind = v_ref_kind " A or B ( at header or line item level)
iv_msgno = v_msg_no
iv_msgid = v_msgid
iv_msgty = 'I'
iv_log_handle = v_log_handle
iv_docnumber = v_guid
EXCEPTIONS
not_found = 1
appl_log_error = 2
OTHERS = 3.
Hope this helps.
Regards,
Nithish
Tried the same code, Not working..
Regards,
Charan
Hi Charan,
I would like to know in which method of badi implementation you are trying to diplsay the message??
Also try with FM CRM_MESSAGES_SAVE after CRM_MESSAGE_COLLECT.
Regards,
Nithish
CHECK_BEFORE_SAVE
Regards,
Charan
Hi Charan,
Try using CRM_MESSAGE_REGISTER followed by CRM_MESSAGE_COLLECT followed by CRM_MESSAGE_SAVE.
If it doesn't work , then place a breakpoint in CRM_ORDER_SAVE FM , there they are displaying the message type I using CRM_MESSAGE_COLLECT . Check out if any parameters are missing.
Regards,
Nithish
you can also check FM
'CRM_APPLOG_PREP_FOR_DISP_UI'
-Ajay
Thanks to all for your helpful responses. I am closing this discussion as i followed another approach.
Regards,
Charan