11-07-2006 6:59 PM
Hi ,
I am allowing user to save a file in a directory using file_save_dialog in cl_gui_frontend_services, so i can write data to it using gui_download.
When the user choose the file at the selection screen its not getting displayed in the parameter box.
I have used the following code.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR d_wfil.
PERFORM dest_local.
FORM dest_local .
DATA:
s1 TYPE string,
s2 TYPE string.
DATA: cv_filename TYPE string.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = 'File'
default_extension = 'TXT'
default_file_name = cv_filename
FILE_FILTER =
initial_directory = 'C:\Documents and Settings\root\Desktop'
WITH_ENCODING =
PROMPT_ON_OVERWRITE = 'X'
CHANGING
filename = s
path = s1
fullpath = cv_filename
user_action =
FILE_ENCODING =
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform.
11-07-2006 7:05 PM
11-07-2006 7:07 PM
11-07-2006 8:50 PM
Hi Ram,
You need to use file_open_dialog from cl_gui_frontend_services.
Ex:
parameters: p_file type localfile.
at selection-screen on value-request for p_file.
data: ifile type filetable.
data: xfile like line of ifile.
data: rc type i.
call method cl_gui_frontend_services=>file_open_dialog
exporting
initial_directory
= 'C:\'
changing
file_table = ifile
rc = rc.
read table ifile into xfile index 1.
check sy-subrc = 0.
p_file = xfile-filename.
Cheers,
Vikram
Pls reward for helpful replies!!