Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

error records in bdc session method

Former Member
0 Likes
619

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,

5 REPLIES 5
Read only

Former Member
0 Likes
536

hi Kumar,

CHeck out the below sample program which uses both call transaction and session method ...here the erroreneous records gets updated with session method ..

Regards,

Santosh

Read only

0 Likes
536

suppose if i got so many error records in session method then how to proceed and how to collect those error records

Read only

0 Likes
536

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

Read only

0 Likes
536

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

Read only

Former Member
0 Likes
536

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.