2009 May 19 5:39 AM
Hi all,
How can i trap error if it happens for a particular field while updating in BDC ? For both the method in call transaction as well as session method?.
Thanks in advance,
Abhijit
2009 May 19 7:48 AM
in Session method , you can find the all errors in SM35 tcode.
for Call transaction
CALL TRANSACTION tcode USING gi_bdcdata "#EC CI_CALLTA
MODE gv_ctumode
UPDATE gc_cupdate
MESSAGES INTO gt_messtab.
l_subrc = sy-subrc.
IF sy-subrc <> 0.
WRITE: / 'CALL_TRANSACTION',
tcode,
'returncode:',
l_subrc,
'RECORD:',
sy-index.
LOOP AT gt_messtab INTO gwa_messtab.
CLEAR lwa_t100.
SELECT SINGLE * FROM t100 INTO lwa_t100 WHERE sprsl = gwa_messtab-msgspra
AND arbgb = gwa_messtab-msgid
AND msgnr = gwa_messtab-msgnr.
IF sy-subrc = 0.
l_mstring = lwa_t100-text.
IF l_mstring CS '&1'.
REPLACE '&1' WITH gwa_messtab-msgv1 INTO l_mstring.
REPLACE '&2' WITH gwa_messtab-msgv2 INTO l_mstring.
REPLACE '&3' WITH gwa_messtab-msgv3 INTO l_mstring.
REPLACE '&4' WITH gwa_messtab-msgv4 INTO l_mstring.
ELSE.
REPLACE '&' WITH gwa_messtab-msgv1 INTO l_mstring.
REPLACE '&' WITH gwa_messtab-msgv2 INTO l_mstring.
REPLACE '&' WITH gwa_messtab-msgv3 INTO l_mstring.
REPLACE '&' WITH gwa_messtab-msgv4 INTO l_mstring.
ENDIF.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = gwa_messtab-msgid
lang = sy-langu
no = gwa_messtab-msgnr
v1 = gwa_messtab-msgv1
v2 = gwa_messtab-msgv2
v3 = gwa_messtab-msgv3
v4 = gwa_messtab-msgv4
IMPORTING
msg = l_mstring
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.
CONDENSE l_mstring.
IF NOT l_mstring IS INITIAL.
WRITE: / gwa_messtab-msgtyp, l_mstring(250).
MESSAGE l_mstring TYPE 'I'.
ENDIF.
ELSE.
WRITE: / gwa_messtab.
ENDIF.
ENDLOOP.
SKIP.
ENDIF.
Hi all,
How can i trap error if it happens for a particular field while updating in BDC ? For both the method in call transaction as well as session method?.
Thanks in advance,
Abhijit
2009 May 19 7:48 AM
in Session method , you can find the all errors in SM35 tcode.
for Call transaction
CALL TRANSACTION tcode USING gi_bdcdata "#EC CI_CALLTA
MODE gv_ctumode
UPDATE gc_cupdate
MESSAGES INTO gt_messtab.
l_subrc = sy-subrc.
IF sy-subrc <> 0.
WRITE: / 'CALL_TRANSACTION',
tcode,
'returncode:',
l_subrc,
'RECORD:',
sy-index.
LOOP AT gt_messtab INTO gwa_messtab.
CLEAR lwa_t100.
SELECT SINGLE * FROM t100 INTO lwa_t100 WHERE sprsl = gwa_messtab-msgspra
AND arbgb = gwa_messtab-msgid
AND msgnr = gwa_messtab-msgnr.
IF sy-subrc = 0.
l_mstring = lwa_t100-text.
IF l_mstring CS '&1'.
REPLACE '&1' WITH gwa_messtab-msgv1 INTO l_mstring.
REPLACE '&2' WITH gwa_messtab-msgv2 INTO l_mstring.
REPLACE '&3' WITH gwa_messtab-msgv3 INTO l_mstring.
REPLACE '&4' WITH gwa_messtab-msgv4 INTO l_mstring.
ELSE.
REPLACE '&' WITH gwa_messtab-msgv1 INTO l_mstring.
REPLACE '&' WITH gwa_messtab-msgv2 INTO l_mstring.
REPLACE '&' WITH gwa_messtab-msgv3 INTO l_mstring.
REPLACE '&' WITH gwa_messtab-msgv4 INTO l_mstring.
ENDIF.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = gwa_messtab-msgid
lang = sy-langu
no = gwa_messtab-msgnr
v1 = gwa_messtab-msgv1
v2 = gwa_messtab-msgv2
v3 = gwa_messtab-msgv3
v4 = gwa_messtab-msgv4
IMPORTING
msg = l_mstring
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.
CONDENSE l_mstring.
IF NOT l_mstring IS INITIAL.
WRITE: / gwa_messtab-msgtyp, l_mstring(250).
MESSAGE l_mstring TYPE 'I'.
ENDIF.
ELSE.
WRITE: / gwa_messtab.
ENDIF.
ENDLOOP.
SKIP.
ENDIF.
2009 May 19 9:38 AM
Hi,
in session method error log is created when you check in SM35,it shows how many screen are processed every thing.
if you got for call transaction method ,decleare one internal table like bdcmsgcoll,after writing call transaction syntax after call function module ' formate_message ' finally all errors are stored in one internal table ,dowload that file using gui_download to presentation server.
check the below link
https://www.sdn.sap.com/irj/scn/wiki?path=/display/home/bdc&;
Regards,
Madhu
2009 May 19 2:22 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |