2007 Dec 17 4:16 AM
Hi,
I am trying to export the log data from internal table into text file.
The text file shuold be stored at 'c:\log_details.txt' on a presentation server.
For this I am using the code as follows:
selection-screen begin of Block blk1 WITH FRAME TITLE text-002.
PARAMETERS: log_file LIKE RLGRAP-FILENAME DEFAULT 'c:\log_details.txt'.
selection-screen end of Block blk1.
also using the function module for uploading the data into file as
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = log_file
FILETYPE = 'ASC'
TABLES
DATA_TAB = it2006_log
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10 .
But the file is not getting created at the specified location.
Please advice.
Hi,
I am trying to export the log data from internal table into text file.
The text file shuold be stored at 'c:\log_details.txt' on a presentation server.
For this I am using the code as follows:
selection-screen begin of Block blk1 WITH FRAME TITLE text-002.
PARAMETERS: log_file LIKE RLGRAP-FILENAME DEFAULT 'c:\log_details.txt'.
selection-screen end of Block blk1.
also using the function module for uploading the data into file as
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = log_file
FILETYPE = 'ASC'
TABLES
DATA_TAB = it2006_log
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10 .
But the file is not getting created at the specified location.
Please advice.
2007 Dec 17 4:30 AM
Hi,
initially i want to say tht ws_upload is the obsolute function module and we need to use gui_upload rather so anyways if u r using this function module.check wether u are follwing these steps
1.declaration of types ie internal table structure
2.declaration of data.
3.now comes select options.
4.for f4 functionality all fm f4_filename.
4.now comes start-of selection.
5.now wite the select stmnts to fetch data.
6.coming to ur step check for sy-subrc value. i.e
if not lt_<tabenam> is initial.
then call function module ws_upload.
7. check sy-subrc and print the value
if ur following these steps then i am sure it works.
Regards,
Sana.
Reward points if found helpful....
2007 Dec 17 4:36 AM
hi use the following FM
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = y_lv_fullpath
filetype = 'DAT'
TABLES
data_tab = p_y_i_file
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 NE 0.
MESSAGE ID sy-msgid TYPE y_k_s NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Rewards points if it is helpful
2007 Dec 17 4:37 AM
2007 Dec 17 4:48 AM
Hi Ramesh,
Your code is perfect and its working fine for me. Please check the sy-subrc value.
This is the code I have used, file if getting created for me.
REPORT ztest_dwld.
TYPES: BEGIN OF ty_makt.
INCLUDE STRUCTURE makt.
TYPES: END OF ty_makt.
DATA: it_makt TYPE STANDARD TABLE OF ty_makt.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-002.
PARAMETERS: log_file LIKE rlgrap-filename DEFAULT 'c:\lsmw\log_details.txt'.
SELECTION-SCREEN END OF BLOCK blk1.
SELECT * FROM makt INTO TABLE it_makt.
IF sy-subrc = 0.
ENDIF.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = log_file
filetype = 'ASC'
TABLES
data_tab = it_makt
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
OTHERS = 11
.
IF sy-subrc <> 0.
ENDIF.
Regards
Avi..
2007 Dec 17 4:52 AM
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = rv_file----file
filetype = 'ASC'
write_field_separator = 'X'
confirm_overwrite = 'X'
header = '00'
CHANGING
data_tab = rt_outfile[]-----data table
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
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
2007 Dec 17 4:56 AM
Hi Ramesh
Use Gui_Download instead of ws_download because ws_download doesnt support in the latest version.
why are you using tables option in the ws_download.
Reward points if it will be helpful to you.
Regards
Deepanker
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |