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 problem

Former Member
0 Likes
437

hi ,

i am wroking on call transaction and i want to store error occured records into one internal table and download to desktop.plz help

3 REPLIES 3
Read only

Former Member
0 Likes
410
CALL TRANSACTION 'xxx'  USING BDCDATA  MODE 'N' 
                         MESSAGES INTO ITAB. 

Now all the error messages will be ITAB.

So you can download it using GUI_DOWNLOAD

Pavan

Read only

Former Member
0 Likes
410

Hi,

Check this code

DATA:  BEGIN OF s_ctu_params,
          dismode  TYPE ctu_params-dismode  VALUE 'N',
          updmode  TYPE ctu_params-updmode  VALUE 'A',
          cattmode TYPE ctu_params-cattmode,
          defsize  TYPE ctu_params-defsize  VALUE 'X' , "
          racommit TYPE ctu_params-racommit,
          nobinpt  TYPE ctu_params-nobinpt,
          nobiend  TYPE ctu_params-nobiend,
       END OF s_ctu_params.

DATA : git_bdcdata LIKE STANDARD TABLE OF s_bdcdata,
       git_messtab LIKE STANDARD TABLE OF s_messtab.

  CALL TRANSACTION <TCODE>  USING git_bdcdata
                                 OPTIONS FROM s_ctu_params
                                 MESSAGES INTO git_messtab.

    DESCRIBE TABLE git_messtab LINES lv_lines.
    READ TABLE git_messtab INTO wa_messtab INDEX lv_lines.
    IF sy-subrc EQ 0.
      CALL FUNCTION 'FORMAT_MESSAGE'
        EXPORTING
          id        = wa_messtab-msgid
          lang      = wa_messtab-msgspra
          no        = wa_messtab-msgnr
          v1        = wa_messtab-msgv1
          v2        = wa_messtab-msgv2
          v3        = wa_messtab-msgv3
          v4        = wa_messtab-msgv4
        IMPORTING
          msg       = lv_msg
        EXCEPTIONS
          not_found = 1
          OTHERS    = 2.
    ENDIF.

Regards,

Satish

Read only

Former Member
0 Likes
410

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