2008 Sep 22 10:15 AM
Hi all,
i m using FM format_message to trace the error as well as success messages from th messtab. hw to use this FM with using and changing parameters. please help me out
Thanks & Regards
Ashu Singh
2008 Sep 22 11:03 AM
Anshu,
Please refer the following.
The code here collects all messgages from BDC and displayes them.
call transaction 'MM01' using itab1 mode v_mode update 'S' messages into it_messages.
LOOP AT it_messages INTO wa_messages.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = wa_messages-msgid
lang = 'en'
no = wa_messages-msgnr
v1 = wa_messages-msgv1
v2 = wa_messages-msgv2
v3 = wa_messages-msgv3
v4 = wa_messages-msgv4
IMPORTING
msg = wa_messages-msgv1
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.
modify it_messages from wa_messages index sy-tabix.
ENDLOOP.
Let me know if you need any further help on this.
Kind Regards,
Raj
Anshu,
Please refer the following.
The code here collects all messgages from BDC and displayes them.
call transaction 'MM01' using itab1 mode v_mode update 'S' messages into it_messages.
LOOP AT it_messages INTO wa_messages.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = wa_messages-msgid
lang = 'en'
no = wa_messages-msgnr
v1 = wa_messages-msgv1
v2 = wa_messages-msgv2
v3 = wa_messages-msgv3
v4 = wa_messages-msgv4
IMPORTING
msg = wa_messages-msgv1
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.
modify it_messages from wa_messages index sy-tabix.
ENDLOOP.
Let me know if you need any further help on this.
Kind Regards,
Raj
2008 Sep 22 10:26 AM
hi,
use this sample code.
data:v_text(80).
call function 'FORMAT_MESSAGE'
exporting
id = sy-msgid
lang = 'EN'
no = sy-msgno
v1 = sy-msgv1
v2 = sy-msgv2
v3 = sy-msgv3
v4 = sy-msgv4
importing
msg = v_text
exceptions
not_found = 1
others = 2.
2008 Sep 22 10:46 AM
Hi Ashu,
[format_message|http://www.sap-img.com/abap/retreive-error-message-from-bdc.htm]
Regards,
Sravanthi
2008 Sep 22 10:51 AM
2008 Sep 22 10:53 AM
Hi,
Try this way
*******************************************************************
CALL TRANSACTION 'XD01' USING i_bdcdata MODE 'N' UPDATE 'S' MESSAGES INTO i_bdcmsgcoll.
IF sy-subrc EQ 0
PERFORM get_success_messages.
WRITE 😕 i_upload-kunnr, v_msg.
ELSE.
PERFORM get_error_messages.
WRITE 😕 i_upload-kunnr, v_msg.
ENDIF.
FORM get_success_messages.
READ TABLE i_bdcmsgcoll WITH KEY msgtyp EQ 'S'.
IF sy-subrc EQ 0.
CALL FUNCTION 'FORMAT_MESSAGE'
Exporting
id = i_bdcmsgcoll-msgid
lang = sy-langu
no = i_bdcmsgcoll-msgnr
v1 = i_bdcmsgcoll-msgv1
v2 = i_bdcmsgcoll-msgv2
Importing
msg = v_msg.
ENDIF.
ENDFORM.
FORM get_error_messages.
READ TABLE i_bdcmsgcoll WITH KEY msgtyp EQ 'E'.
IF sy-subrc EQ 0.
CALL FUNCTION 'FORMAT_MESSAGE'
Exporting
id = i_bdcmsgcoll-msgid
lang = sy-langu
no = i_bdcmsgcoll-msgnr
v1 = i_bdcmsgcoll-msgv1
v2 = i_bdcmsgcoll-msgv2
Importing
msg = v_msg.
ENDIF.
ENDFORM.
*********************************************************************
Regards
Bala Krishna
2008 Sep 22 11:03 AM
Anshu,
Please refer the following.
The code here collects all messgages from BDC and displayes them.
call transaction 'MM01' using itab1 mode v_mode update 'S' messages into it_messages.
LOOP AT it_messages INTO wa_messages.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = wa_messages-msgid
lang = 'en'
no = wa_messages-msgnr
v1 = wa_messages-msgv1
v2 = wa_messages-msgv2
v3 = wa_messages-msgv3
v4 = wa_messages-msgv4
IMPORTING
msg = wa_messages-msgv1
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.
modify it_messages from wa_messages index sy-tabix.
ENDLOOP.
Let me know if you need any further help on this.
Kind Regards,
Raj
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |