2009 Mar 06 4:25 AM
Hi, all.
My situation now is: I have a report pogram which can retrieve data from database, and I would like to export or download those data to outside as a text file (.txt) in my local computer.
So, does anyone know how to do it? i mean my report coding should add on or enhance with what coding in order to do like that.
Thanks in advance.
2009 Mar 06 4:28 AM
Hi,
In se38 open your program --> click menu UTILITIES --> select MORE UTILITIES --> select UPLOAD/DOWNLOAD --> and click DOWNLOAD.
You will be asked for the popup for file path.
SAVE it as .txt file.
To download data form internal table use GUI_DOWNLOAD.
DATA : c_file_path TYPE string.
c_file_path = 'C:/TEST.TXT'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = c_file_path "file path
filetype = 'DAT'
TABLES
data_tab = <itab> "internal table name
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.
DATA : w_msg(100) TYPE c.
CONCATENATE text-001 c_file_path INTO w_msg SEPARATED BY space. "file downloaded message
MESSAGE w_msg TYPE 'S'.
ELSE.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards,
Tarun
Edited by: Tarun Gambhir on Mar 6, 2009 9:59 AM
Hi, all.
My situation now is: I have a report pogram which can retrieve data from database, and I would like to export or download those data to outside as a text file (.txt) in my local computer.
So, does anyone know how to do it? i mean my report coding should add on or enhance with what coding in order to do like that.
Thanks in advance.
2009 Mar 06 4:28 AM
Hi,
In se38 open your program --> click menu UTILITIES --> select MORE UTILITIES --> select UPLOAD/DOWNLOAD --> and click DOWNLOAD.
You will be asked for the popup for file path.
SAVE it as .txt file.
To download data form internal table use GUI_DOWNLOAD.
DATA : c_file_path TYPE string.
c_file_path = 'C:/TEST.TXT'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = c_file_path "file path
filetype = 'DAT'
TABLES
data_tab = <itab> "internal table name
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.
DATA : w_msg(100) TYPE c.
CONCATENATE text-001 c_file_path INTO w_msg SEPARATED BY space. "file downloaded message
MESSAGE w_msg TYPE 'S'.
ELSE.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards,
Tarun
Edited by: Tarun Gambhir on Mar 6, 2009 9:59 AM
2009 Mar 06 4:28 AM
Use function Modules
GUI_DOWNLOAD
WS_DOWNLOAD if u want data which is retrevied from Database
Edited by: Upender Verma on Mar 6, 2009 5:29 AM
2009 Mar 06 4:30 AM
Hi Dude,
one you generate list output , you will find the option called List at application tool bar..-> Save / Send -> unconverted radio button then pass the file name and press enter ..
It generate the *.txt file..
2009 Mar 06 4:31 AM
2009 Mar 06 4:32 AM
Hi,
Use GUI_DOWNLOAD Function module.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = 'FILEPATH'*
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X' (Field separator )
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
IMPORTING
FILELENGTH =
tables
data_tab = t_customer ( give internal tablename )
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.
ENDIF. " IF SY-SUBRC
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |