Application Development 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: 

Downloading the Internal table data

Former Member
0 Kudos

Hai,

Can u tell me how to download the data from Internal table to tab delimited file(text file separated by tabs)

thank u in advance

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Check this example..

DATA: BEGIN OF itab OCCURS 0,

matnr TYPE matnr,

werks TYPE werks_d,

END OF itab.

itab-matnr = 'ABC'.

itab-werks = 'ASDF'.

APPEND itab.

itab-matnr = 'EFG'.

itab-werks = 'DHIS'.

APPEND itab.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'C:\test.txt'

write_field_separator = 'X'

TABLES

data_tab = itab

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7

separator_not_allowed = 8

filesize_not_allowed = 9

header_too_long = 10

dp_error_create = 11

dp_error_send = 12

dp_error_write = 13

unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full = 17

dp_timeout = 18

file_not_found = 19

dataprovider_exception = 20

control_flush_error = 21

OTHERS = 22.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

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

ELSE.

MESSAGE s208(00) WITH 'File downloaded'.

ENDIF.

Thanks,

Naren

2 REPLIES 2

Former Member
0 Kudos

Hi,

You can use the FM GUI_DOWNLOAD by passing the parameter WRITE_FIELD_SEPARATOR = 'X'.

Thanks,

Naren

Former Member
0 Kudos

Hi,

Check this example..

DATA: BEGIN OF itab OCCURS 0,

matnr TYPE matnr,

werks TYPE werks_d,

END OF itab.

itab-matnr = 'ABC'.

itab-werks = 'ASDF'.

APPEND itab.

itab-matnr = 'EFG'.

itab-werks = 'DHIS'.

APPEND itab.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'C:\test.txt'

write_field_separator = 'X'

TABLES

data_tab = itab

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7

separator_not_allowed = 8

filesize_not_allowed = 9

header_too_long = 10

dp_error_create = 11

dp_error_send = 12

dp_error_write = 13

unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full = 17

dp_timeout = 18

file_not_found = 19

dataprovider_exception = 20

control_flush_error = 21

OTHERS = 22.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

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

ELSE.

MESSAGE s208(00) WITH 'File downloaded'.

ENDIF.

Thanks,

Naren