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 handling in bdc session method

Former Member
0 Likes
4,104

hi

can any one tell me how to handle the error in bdc session method.

i know we can see the error log in sm35... i want to write the error log once the seesion completed...

in which table the error log are stored...

is there any function module available...

plz its urgent...

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,677

Hi,

If you want to show the errors then what is the benefit of session method? Better use call transaction.

Regards,

Atish

4 REPLIES 4
Read only

Former Member
0 Likes
1,678

Hi,

If you want to show the errors then what is the benefit of session method? Better use call transaction.

Regards,

Atish

Read only

Former Member
1,677

hi,

If there are any error records in session, all those error records will get poulated in log .and after the session is completed , u can see error records which can be corrected and reprocessed again

We have the structures BDCLD and BDCLM, which will capture the log details inthe session. Firstly, sesssion should be processed. After that log will be created. Then caputure the information into an internal table using BDCLM and BDCLD.

and refer the link.

regards

raji

reward if helpful

Read only

Former Member
0 Likes
1,677

hi,

It is better to use CALL TRANSCATION if u want to display the error message.

Plz find below a sample code .

table gt_report contains the fields and messages to be displayed for error.

data: gt_bdcmsgcoll type bdcmsgcoll.

*to update throuh BDC

CALL TRANSACTION 'CO02' USING gt_bdctab

MODE 'A'

UPDATE 'S'

MESSAGES INTO gt_bdcmsgcoll.

IF sy-subrc EQ 0.

CONCATENATE text-t01 gwa_afko-aufnr text-t07 INTO lf_message SEPARATED BY space.

gwa_report-aufnr = gwa_afko-aufnr.

gwa_report-status = text-t11.

gwa_report-msgdes = lf_message.

APPEND gwa_report TO gt_report .

ELSE.

LOOP AT gt_bdcmsgcoll INTO gwa_bdcmsgcoll WHERE msgtyp = 'E'.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = gwa_bdcmsgcoll-msgid

lang = 'E'

no = gwa_bdcmsgcoll-msgnr

v1 = gwa_bdcmsgcoll-msgv1

v2 = gwa_bdcmsgcoll-msgv2

v3 = gwa_bdcmsgcoll-msgv3

v4 = gwa_bdcmsgcoll-msgv4

IMPORTING

msg = lf_string

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc NE 0.

MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDLOOP.

gwa_report-aufnr = gwa_bdcmsgcoll-msgv1.

gwa_report-status = text-t08.

gwa_report-msgdes = lf_message.

APPEND gwa_report TO gt_report.

ENDIF.

CLEAR : gwa_bdcmsgcoll, gwa_afko.

ENDLOOP.

reward points if useful.

regards

sandhya

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,677

Hi,

You have to use the function modules like

BDC_PROTOCOL_SELECT_QID

RSTS_OPEN_RLC

RSTS_READ

You can refer this wiki posted by Sandra

[Get log of batch input session|http://wiki.sdn.sap.com/wiki/display/ABAP/Getlogofbatchinput+session]