2006 Jun 27 3:12 PM
Hi all,
there is a function called FILENAME_GET and it gives a pop-up where the user can give a filename.
I do not want the user to write the complete path to the file,
so I would like to know if there is a function which let's the user select a file on his/her System
through browsing (like windows open file dialog) and returns the full path to the file?
greetings Fred.
2006 Jun 27 3:14 PM
hi fred,
check the method
CL_GUI_FRONTEND_SERVICES->FILE_OPEN_DIALOG.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Import from a local file'
default_extension = 'DAT'
DEFAULT_FILENAME =
initial_directory = 'C:\'
MULTISELECTION =
WITH_ENCODING =
CHANGING
file_table = l_table
rc = l_rc
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5
.
Message was edited by: Priya
Hi all,
there is a function called FILENAME_GET and it gives a pop-up where the user can give a filename.
I do not want the user to write the complete path to the file,
so I would like to know if there is a function which let's the user select a file on his/her System
through browsing (like windows open file dialog) and returns the full path to the file?
greetings Fred.
2006 Jun 27 3:14 PM
*---------------Popup for file name---------------------*
CONSTANTS :
lc_dft_ext TYPE string VALUE 'XLS',
lc_file_flt TYPE string VALUE '*.xls',
lc_int_drc TYPE string VALUE 'C:'.
DATA : lv_win_title TYPE string,
lv_file_name TYPE string,
lv_dft_fname TYPE string,
lv_fname TYPE string,
lv_path TYPE string.
CLEAR: lv_fname,
lv_path,
lv_file_name,
lv_win_title,
lv_dft_fname.
*---------------Set File Details F4 Based on Report Type--------------*
IF xv_indicator = lc_s.
lv_win_title = text-045.
lv_dft_fname = text-038.
ELSE.
lv_win_title = text-044.
lv_dft_fname = text-033.
ENDIF.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = lv_win_title
default_extension = lc_dft_ext
default_file_name = lv_dft_fname
file_filter = lc_file_flt
initial_directory = lc_int_drc
prompt_on_overwrite = lc_true
CHANGING
filename = lv_fname
path = lv_path
fullpath = lv_file_name
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF sy-subrc <> 0 OR lv_fname IS INITIAL
OR lv_path IS INITIAL
OR lv_file_name IS INITIAL.
CLEAR xyv_filepath.
ELSE.
*---FilePath
xyv_filepath = lv_file_name.
ENDIF.
2006 Jun 27 3:14 PM
hi fred,
check the method
CL_GUI_FRONTEND_SERVICES->FILE_OPEN_DIALOG.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Import from a local file'
default_extension = 'DAT'
DEFAULT_FILENAME =
initial_directory = 'C:\'
MULTISELECTION =
WITH_ENCODING =
CHANGING
file_table = l_table
rc = l_rc
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5
.
Message was edited by: Priya
2006 Jun 27 3:15 PM
2006 Jun 27 3:18 PM
Hi Fred,
Check out for FM: <b>F4_FILENAME</b>
Regds,
Akshay Bhagwat
Note: Pls mark helpful answers.
2006 Jun 27 3:18 PM
Whether it is a class-method / function, the user will have the option writing the file name.
But you can always validate the existence of the file and throw a error or call the same code again to select the file.
Regards,
Ravi
2006 Jun 27 3:23 PM
Try this one F4_DXFILENAME_TOPRECURSION.
Work with app server too.
Regards.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |