How to Get Messages Number to Messages class
some time to requirements to get messages to messages class this code going to help you how to get messages for messages class its really ..
LOOP AT it_bdcmsg INTO wa_bdcmsg WHERE msgtyp = 'S' AND msgid = '29' AND msgnr = '030'.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = sy-msgid
lang = sy-langu
NO = sy-msgno
v1 = sy-msgv1
v2 = sy-msgv2
v3 = sy-msgv3
v4 = sy-msgv4
IMPORTING
msg = lv_text
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
wa_message-gv_rno = lv_rec.
wa_message-gv_sl = lv_sl.
wa_message-gv_text = lv_text.
WRITE icon_led_green AS ICON TO wa_message-gv_icon.
wa_message-gv_bom = lv_bom.
APPEND wa_message TO it_message.
CLEAR :wa_message,lv_text,lv_bom.
lv_sl = lv_sl + 1.
ENDLOOP.
ELSE.
*************************** for error messages *************************************
* Used this function module to capture the mesages into a internal table.
LOOP AT it_bdcmsg INTO wa_bdcmsg WHERE msgtyp = 'E'.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = sy-msgid
lang = sy-langu
NO = sy-msgno
v1 = sy-msgv1
v2 = sy-msgv2
v3 = sy-msgv3
v4 = sy-msgv4
IMPORTING
msg = lv_text
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
this above code help you get error messages..
*********************************************************************************RICEF
Reports interface Converstion , Enhancements , Forms
Classical Reports ALV Programming, ALE/ IDOC
BDA Programming, Call Transcation , SAP Script, Smartforms, Adove forms,
SAP T-CODE
MM FLOW , SD FLOW , SE11,SE18 ,SE24,SE30, SM12,ST22, SE41, SE51, SE80,SE84
SE90,SE10,SE09,SE03,
Getway T-Code
/IWFND/GW_CLIENT
/IWFND/ERROR_LOG
/IWFND/APPS_LOG
/IWBEP/VIEW_LOG
/IWFND/CACHE_CLEANUP
/IWFND/TRACES
*********************************************************************************
LOOP AT it_bdcmsg INTO wa_bdcmsg WHERE msgtyp = 'S' AND msgid = '29' AND msgnr = '030'.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = sy-msgid
lang = sy-langu
NO = sy-msgno
v1 = sy-msgv1
v2 = sy-msgv2
v3 = sy-msgv3
v4 = sy-msgv4
IMPORTING
msg = lv_text
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
wa_message-gv_rno = lv_rec.
wa_message-gv_sl = lv_sl.
wa_message-gv_text = lv_text.
WRITE icon_led_green AS ICON TO wa_message-gv_icon.
wa_message-gv_bom = lv_bom.
APPEND wa_message TO it_message.
CLEAR :wa_message,lv_text,lv_bom.
lv_sl = lv_sl + 1.
ENDLOOP.
ELSE.
*************************** for error messages *************************************
* Used this function module to capture the mesages into a internal table.
LOOP AT it_bdcmsg INTO wa_bdcmsg WHERE msgtyp = 'E'.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = sy-msgid
lang = sy-langu
NO = sy-msgno
v1 = sy-msgv1
v2 = sy-msgv2
v3 = sy-msgv3
v4 = sy-msgv4
IMPORTING
msg = lv_text
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
this above code help you get error messages..
*********************************************************************************RICEF
Reports interface Converstion , Enhancements , Forms
Classical Reports ALV Programming, ALE/ IDOC
BDA Programming, Call Transcation , SAP Script, Smartforms, Adove forms,
SAP T-CODE
MM FLOW , SD FLOW , SE11,SE18 ,SE24,SE30, SM12,ST22, SE41, SE51, SE80,SE84
SE90,SE10,SE09,SE03,
Getway T-Code
/IWFND/GW_CLIENT
/IWFND/ERROR_LOG
/IWFND/APPS_LOG
/IWBEP/VIEW_LOG
/IWFND/CACHE_CLEANUP
/IWFND/TRACES
*********************************************************************************
Comments
Post a Comment