‎2008 Dec 26 8:50 AM
Hi Guys,
I am facing a problem with the FM : GUI DOWNLOAD
It gives me an error: File is Not Available
Please find my code below for the same and let me know as to how do i go about it.
DATA ls_fnam TYPE string.
ls_fnam = text-016.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = ls_fnam
filetype = 'ASC'
write_field_separator = 'X'
TABLES
data_tab = gt_data
fieldnames = gt_header.
Thanks and regards,
Frank
‎2008 Dec 26 9:11 AM
Hi,
I have assigned text-016 = C:\ABC.XLS. Now its giving me error stating that " Access to file denied".
Thanks
‎2008 Dec 26 8:55 AM
Hi Dear,
Debugg the program and chk what vale u r getting in text-016.
Regards,
Piyush
‎2008 Dec 26 8:58 AM
hi,
make sure your file exists in presentation server..not in application server.
‎2008 Dec 26 9:00 AM
have u mentioned a proper path for ur filename?
what is the value of text-016
Edited by: Anil Kalive on Dec 26, 2008 2:33 PM
‎2008 Dec 26 9:00 AM
Hi,
Check whether the file name is given in ' <filename> ' . I mean single quotes ' '
Edited by: Premalatha G on Dec 26, 2008 10:07 AM
‎2008 Dec 26 9:04 AM
ftype = 'ASC'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = pathname
FILETYPE = ftype
WRITE_FIELD_SEPARATOR = 'X'
TRUNC_TRAILING_BLANKS = 'X'
TABLES
DATA_TAB = disp_tab2
EXCEPTIONS
FILE_WRITE_ERROR = 1.
‎2008 Dec 26 9:05 AM
Text-016 contains "C:\" as the file path......where i want my excel sheet to be created/downloaded.
Thanks and regards,
Frank
‎2008 Dec 26 9:06 AM
‎2008 Dec 26 9:07 AM
Dear Frank,
You have to pass the file name also with C:\.
For ex: C:\ABC.xls
Thanks
Piyush
‎2008 Dec 26 9:14 AM
Check weather u have not opened ABC.xls
also check if ur windows login id has rights to create a file on C:\ drive of system
‎2008 Dec 26 9:11 AM
Hi,
I have assigned text-016 = C:\ABC.XLS. Now its giving me error stating that " Access to file denied".
Thanks
‎2008 Dec 26 9:14 AM
Hi Frank,
Check whether you are having access to create file in C:\ Directory. If not, then pass the other directory path, in which you have access.
Regards,
Piyush
‎2008 Dec 26 9:19 AM
Dear Frank,
I might not be having access to create file in C drive. Try with some other location like desktop or my documents. It should work. Remember to give the file extention also.
eg: D:\mydownloads\test.xls.
Most of the times u can't directly create files in drive. U can create a folder and try to download to that folder.
Thanks,
Vinod.
‎2008 Dec 26 9:18 AM
Hi,
use this FM also, then u can select the path wherever u want.
data: text type rlgrap-filename,
lv_text type string.
CALL FUNCTION 'kd_get_filename_on_f4'
EXPORTING
program_name = syst-repid
dynpro_number = syst-dynnr
* FIELD_NAME = ' '
* STATIC = ' '
mask = ', txt,*.txt,'
CHANGING
file_name = text
EXCEPTIONS
mask_too_long = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
lv_text = text.
CALL FUNCTION 'gui_download'
EXPORTING
* BIN_FILESIZE =
filename = lv_text
filetype = 'asc'
* APPEND = ' '
* WRITE_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 = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* IMPORTING
* FILELENGTH =
TABLES
data_tab = it_copy
* FIELDNAMES =
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.
Code Formatted by: Alvaro Tejada Galindo on Dec 26, 2008 10:56 AM
‎2008 Dec 26 9:24 AM
HI..
Use following code to find the file from presentation server.avoid to hard code of file path.
**File Name
data: flname type string.
at selection-screen on value-request for filename.
call function 'F4_FILENAME'
importing
file_name = filename.
start-of-selection.
flname = filename.
**Upload Input file from presentation server to SAP
call function 'GUI_UPLOAD'
exporting
filename = flname
filetype = 'ASC'
has_field_separator = 'X'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE =
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
tables
data_tab = it_record
exceptions
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
others = 17
.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
Regards.
jay
Code Formatted by: Alvaro Tejada Galindo on Dec 26, 2008 10:56 AM
‎2008 Dec 26 9:27 AM