08-02-2007 7:15 AM
Dear Members,
In BDC how to display the error data's after uploaded the data using text file(notepad), Could u send me the sample code's and where i have t write the piece of code.
Thanks in Advance,
Thanuskodi T.
08-02-2007 7:17 AM
Hi,
Using function module 'FORMAT_MESSAGE' you can capture the messages.
Here is a sample of the program code for that:
LOOP AT it_messtab.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = it_messtab-msgid
lang = it_messtab-msgspra
no = it_messtab-msgnr
v1 = it_messtab-msgv1
v2 = it_messtab-msgv2
IMPORTING
msg = g_msg
EXCEPTIONS
OTHERS = 0.
IF it_messtab-msgtyp = 'S'.
it_sucess-sucess_rec = g_msg.
it_sucess-lifnr = it_header-lifnr." Based on your field
it_sucess-tabix = v_lines.
APPEND it_sucess.
ELSEIF it_messtab-msgtyp = 'E'.
it_error-error_rec = g_msg.
it_error-lifnr = it_header-lifnr.
it_error-tabix = v_lines.
APPEND it_error.
ELSE.
it_info-info_rec = g_msg.
it_info-lifnr = it_header-lifnr.
it_info-tabix = v_lines.
APPEND it_info.
ENDIF.
ENDLOOP.
Regards,
Bhaskar
08-02-2007 7:19 AM
Hi,
se this code
CALL TRANSACTION tcode USING i_bdcdata MODE l_mode
UPDATE upd_n
MESSAGES INTO err_data.
*
IF NOT err_data[] IS INITIAL.
LOOP AT err_data WHERE msgtyp EQ 'S' OR msgtyp EQ 'E'.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = err_data-msgid
lang = 'E'
no = err_data-msgnr
v1 = err_data-msgv1
v2 = err_data-msgv2
v3 = err_data-msgv3
v4 = err_data-msgv4
IMPORTING
msg = v_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.
ENDLOOP.
Regards
08-02-2007 7:20 AM
Hi,
in session method..
system maintains implicit error log..u need not to main tain any thing for this
if u want to see forst
execute ur bdc with session name any in SM35.
after that select session name and click on error log on application bar.u can fid out all error relevent to ur seseion name.
in call transaction..
u have to maintain explicit error..for this
define a internal table with include structure BDCMSGCOLL...
mention this internal table in ur call transaction command like this
call transaction 'xk01' using '<BDCDATA table name>' messages into <BDCMSGCOLL table name> \
Regards
Sudheer