cancel
Showing results for 
Search instead for 
Did you mean: 

How to throw message to webUI from BADI ORDER_SAVE

Former Member
0 Kudos

Hi all,

I use function module 'CRM_MESSAGE_COLLECT' to throw error message in SAP GUI. But it seems that the error message will not display in webui.

then how could throw message to webUI from BADI ORDER_SAVE ? which function could i use ?

BR.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I have used the FM CRM_MESSAGE_COLLECT to throw error message to both web UI and GUI from ORDER_SAVE Badi Implementation. Check whether you are passing all the parameters to the FM. Order_Save BADI gets triggered for both Web UI & GUI. If it is error message you can use this message_collect FM but using this FM you cannot throw warning message to Web UI alone (but warning message wud come in GUI). For your reference:

CALL FUNCTION 'CRM_MESSAGE_COLLECT'
    EXPORTING
      iv_caller_name = 'ORDERADM_H'
      iv_ref_object  = iv_guid
      iv_ref_kind    = 'A'
      iv_msgno       = MSG_NO
      iv_msgid       = MSG-ID
      iv_msgty       = 'E'
      iv_msgv1       = lv_syv1
      iv_msgv2       = lv_syv2
    EXCEPTIONS
      not_found      = 1
      appl_log_error = 2
      OTHERS         = 3.

Regards,

Bharathy.

Answers (3)

Answers (3)

0 Kudos

Hi All,

I was searching for a solution to my problem throwing a warning from ORDER_SAVE_BADI implementation and found your posts. As Bharathy mentioned you can only throw errors from ORDER_SAVE_BADI. An Error is saved to a transaction an will be shown until it is somehow deleted. You have also the option to change how a message is shown in customizing view  (sm30)CRMV_MESSAGES_C. However an important Message can not be show as less important e.g. an error can not be shown as a warning. In the end you can not show an Warning, which is thrown in ORDER_SAVE_BADI as a Error. It will be shown as an Error.

In Customizing View CRMV_MESSAGES_C you don't see any option to save a Message, but a field to save a message exists exactly in the Table CRMC_MESSAGES, which is used by the Standard View Cluster CRMV_MESSAGES or View CRMV_MESSAGES_S.

If you change your entry in CRMC_MESSAGES with a save flag and transport the entry with R3TR TABU CRMC_MESSAGES, you will be able to save a warning to your transaction and show ist.

Kind Regards

Oliver

saumya_govil
Active Contributor
0 Kudos

Hi Gang LI,

CRM_MESSAGE_COLLECT works both on SAP GUI and Web UI.

Please check if you are passing the desired parameters correctly.

Regards,

Saumya

Former Member
0 Kudos

hi,

try to use this

DATA: LR_GLOBAL_MESSAGES TYPE REF TO CL_CRM_GENIL_GLOBAL_MESS_CONT,

LR_CORE TYPE REF TO CL_CRM_BOL_CORE.

then check your condition.

if it is not satisfied like sy-subrc ne 0.

then give message like this

LR_CORE = CL_CRM_BOL_CORE=>GET_INSTANCE( ).

IF LR_CORE IS BOUND.

LR_GLOBAL_MESSAGES ?= LR_CORE->GET_GLOBAL_MESSAGE_CONT( ).

ENDIF.

IF LR_GLOBAL_MESSAGES IS BOUND.

CALL METHOD LR_GLOBAL_MESSAGES->ADD_MESSAGE

EXPORTING

IV_MSG_TYPE = 'E ''

IV_MSG_ID = 'Zxx''

IV_MSG_NUMBER = 'XXX''

IV_MSG_TEXT = 'YOUR MESSAGE'

IV_SHOW_ONLY_ONCE = 'X'.

endif.

REGARDS,

Mallik