2009 Mar 25 12:50 PM
Hello Experts
I'm learn ABAP and I have a small problem after using GUI_DOWNLOAD.
I try to download the internal table in a xls file. The file has been created but the is no content. I get a error message 0 bytes transfered, codepage 1160.
Here my code:
FORM DOWNLOAD_ITAB04 .
CHECK dbdlml IS NOT INITIAL.
lokale_datei = lokdatei.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = lokale_datei
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
(...)
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = itab04
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
(...)
OTHERS = 22.
Where I should look for the solution?
Many thanks
Krzysztof
Edited by: Krzysztof Murmylo on Mar 25, 2009 1:53 PM
Edited by: Matt on Mar 25, 2009 1:55 PM - translated a few German words into English.
2009 Mar 25 12:55 PM
check if ur passing the filaname correctly.
and also if the internal table that ur passing is correct.
2009 Mar 25 12:55 PM
check if ur passing the filaname correctly.
and also if the internal table that ur passing is correct.
2009 Mar 25 2:08 PM
Hello
I solved the problem.
The itab04 was not set with content correctly.
Many thanks at all of you.
Krzysztof
2009 Mar 25 12:56 PM
Only pass thes parameters(Required)
1)
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = lw_filename " Check file
WRITE_FIELD_SEPARATOR = 'X'
TABLES
data_tab = lt_itab
2 ) Check the target field name.
3) Use class CL_GUI_FRONTEND_SERVICES=>FILE_EXIST to check the existance of file
Regards,
gurpreet
2009 Mar 25 12:59 PM
Hi,
For this kind of issues, try to give lokale_datei type should be same as filnename type in GUI_Download( i guess its rlgrap-filename)
Regards
Arani Bhaskar
2009 Mar 25 1:07 PM
Hi.
see this and compare ur code
form upload_file.
data : lv_file type string.
if not ( p_filep is initial ).
lv_file = p_filep.
call function 'GUI_UPLOAD'
exporting
filename = lv_file
filetype = 'ASC'
has_field_separator = 'X'
importing
filelength = lv_fsize
tables
data_tab = lt_upload.
if sy-subrc = 0.
message s398(00) with 'Document imported successfully' lv_fname
lv_ftype lv_fsize ."#EC NOTEXT
elseif sy-subrc = 4.
message text-116 type 'W'..
set screen 0.
leave screen.
endif.
endif.
Regards
2009 Mar 25 2:12 PM
Hi,
You can use the function module:
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = 'd:\cps_data1.xls'
filetype = 'DAT'
mode = 'A'
TABLES
data_tab = intab
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.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
here intab is your internal table name.
Try this. it will help.
Regards,
Dhirendra Pandit
2009 Mar 26 3:14 AM
Hi Dhirendra,
In ECC 6.0, WS_DOWNLOAD is obsolete FM. Its not suggestable for ECC.
For WS_DOWNLOAD replacement FM is GUI_DOWNLOAD.
Regards
Arani Bhaskar
2009 Mar 26 4:09 AM
Hi,
use the FM like this...
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = FNAME
FILETYPE = 'DAT' "<----Give DAT
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = GI_FINAL[]
FIELDNAMES = FIELDNAMES[] "<-----For Header
.
2011 Dec 22 10:15 PM
Although the post is very old, still replying to it.
Your internal table does not have any data, that is why you are getting this message. This is a success message not a failure.
Check your internal table for the missing data.
thanks
Hamid