‎2008 May 09 5:06 AM
Hi
i am running bdc session method i got some 2000 error records , and 3000 succes records , now how to process those 2000 error records how to get the error records into internal table.
Thanks,
‎2008 May 09 5:12 AM
‎2008 May 09 5:13 AM
suppose if i got so many error records in session method then how to proceed and how to collect those error records
‎2008 May 09 5:24 AM
Hi Kumar ,
If u get many error records in Session method , first u need to rectify the errors .
You may get errors due to wrong configurations , unnecessary data in the flat file
and default values etc ..After rectifying u need to run the program to uplaod the remaining records ..
To capture error records in the session method use following form .........
FORM mess . "fsp0
LOOP AT messtab.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = messtab-msgid
lang = messtab-msgspra
no = messtab-msgnr
v1 = messtab-msgv1
v2 = messtab-msgv2
v3 = messtab-msgv3
v4 = messtab-msgv4
IMPORTING
msg = l_mstring
EXCEPTIONS
not_found = 1
OTHERS = 2.
CONDENSE l_mstring.
i_mess-l_mstring = l_mstring(250).
i_mess-msgnr = messtab-msgnr.
i_mess-msgv1 = messtab-msgv1.
APPEND i_mess.
ENDLOOP.
ENDFORM. " mess
Reward if useful
Thanks
Jagadeesh.G
‎2008 May 09 5:31 AM
can we get status of the records into internal table in a bdc session?
what i want is i want the error records into internal table i dont want to re process the success records
‎2008 May 09 5:14 AM
Hi,
Using this code u can find error records.
FORM error .
LOOP AT IT_BDC_MESSAGES.
IF IT_BDC_MESSAGES-msgtyp = 'E'.
SELECT single * FROM t100 WHERE
sprsl = it_BDC_MESSAGES-msgspra
AND arbgb = IT_BDC_MESSAGES-msgid
AND msgnr = IT_BDC_MESSAGES-msgnr.
IF sy-subrc = 0.
l_mstring = t100-text.
IF l_mstring CS '&1'.
REPLACE '&1' WITH IT_BDC_MESSAGES-msgv1 INTO l_mstring.
REPLACE '&2' WITH IT_BDC_MESSAGES-msgv2 INTO l_mstring.
REPLACE '&3' WITH IT_BDC_MESSAGES-msgv3 INTO l_mstring.
REPLACE '&4' WITH IT_BDC_MESSAGES-msgv4 INTO l_mstring.
ELSE.
REPLACE '&' WITH IT_BDC_MESSAGES-msgv1 INTO l_mstring.
REPLACE '&' WITH IT_BDC_MESSAGES-msgv2 INTO l_mstring.
REPLACE '&' WITH IT_BDC_MESSAGES-msgv3 INTO l_mstring.
REPLACE '&' WITH IT_BDC_MESSAGES-msgv4 INTO l_mstring.
ENDIF.
CONDENSE l_mstring.
it_mess-msgtyp = IT_BDC_MESSAGES-msgtyp.
it_mess-lms = l_mstring.
it_mess-msgv1 = IT_BDC_MESSAGES-msgv1.
APPEND it_mess.
ELSE.
it_mess-msgtyp = IT_BDC_MESSAGES-msgtyp.
it_mess-lms = l_mstring.
it_mess-msgv1 = IT_BDC_MESSAGES-msgv1.
APPEND it_mess.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM.
form errordownload.
*down the internal table to excel file.
call function 'EXCEL_OLE_STANDARD_DAT'
EXPORTING
file_name = 'c:/Error.xls'
TABLES
data_tab = it_mess
fieldnames = excel
EXCEPTIONS
file_not_exist = 1
filename_expected = 2
communication_error = 3
ole_object_method_error = 4
ole_object_property_error = 5
invalid_filename = 6
invalid_pivot_fields = 7
download_problem = 8
others = 9.
endform.
If useful give reward.
Regards,
Narasimha.