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

bdc

Former Member
0 Likes
422

how to download error record from log file in bdc?

3 REPLIES 3
Read only

Former Member
0 Likes
394

Hello

After calling transaction use the message table to get all the bdc´s log.

IE:

CALL TRANSACTION 'XXXX' USING batch_bdc MODE bmode UPDATE 'S'

MESSAGES INTO tbl_msg.

loop at TBL_MSG

ENDLOOP.

Hope this helps

Gabriel P.

Read only

Former Member
0 Likes
394

Hi uday,

for <b>Call transaction method:</b>

*Delcaring the structure for storing error messages in call transaction

Data: BDCMSG like BDCMSGCOLL occurs 0 with header line.

data:i_bdcdata like bdcdata occurs 0 with header line.

tcode = can be any tcode ex: 'MM01' etc.

i_mode = mode are 3 types 'A' = all sceen N = no screen and E = Error screen.

Upd_n = update 'S' = Synchronous , 'A' = Asynchronous.

use 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.

IN Sesssion method:

Session method will create error log file in SM35.

Go to t-code<b> SM35P</b> or table <b>APQL</b> to see the log details.

<b>reward if useful</b>.

Regards,

sunil kairam.

Read only

Former Member
0 Likes
394

declare an internal table to hold the messages with type bdcmsgcoll.

data: gt_messtab TYPE STANDARD TABLE OF bdcmsgcoll.

DATA: lv_text(125) TYPE c.

Call transaction statemet should be with Message field.

CALL TRANSACTION 'TCODE' USING bdcdata MODE 'A/N/E'

UPDATE 'A/S'

MESSAGES INTO gt_messtab. """"""""'

if not gt_messtab is initial.

READ TABLE gt_messtab WITH KEY msgtyp = 'E'.

if sy-subrc = 0.

LOOP AT gt_messtab WHERE msgtyp EQ 'E'.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = gt_messtab-msgid

no = gt_messtab-msgnr

v1 = gt_messtab-msgv1

v2 = gt_messtab-msgv2

v3 = gt_messtab-msgv3

v4 = gt_messtab-msgv4

IMPORTING

msg = lv_text.

gt_error-text = lv_text.

append gt_error.

ENDLOOP.

refresh gt_messtab[].

endif.

endif.

IT gt_error contains all error records in it.

and use FM: GUI_DOWNLOAD to down load error records into desktop.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = gv_filename

filetype = 'ASC'

TABLES

data_tab = gt_error

it downloads all error records in specified path of presentation server