*&---------------------------------------------------------------------*
*& Report Z_BARRY_FILE_SELECT
*&
*&---------------------------------------------------------------------*
*& 文件、路径选取模板
*&
*&---------------------------------------------------------------------*
REPORT z_barry_file_select.
TABLES rlgrap.
DATA: gd_path TYPE string.
DATA: it_tab TYPE filetable,
gd_subrc TYPE i.
DATA: ld_filename TYPE string,
ld_path TYPE string,
ld_fullpath TYPE string,
ld_result TYPE i,
gd_file TYPE c.
SELECT-OPTIONS openfile FOR rlgrap-filename.
PARAMETERS: savefile TYPE rlgrap-filename.
PARAMETERS: filepath LIKE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filepath.
CALL METHOD cl_gui_frontend_services=>directory_browse
EXPORTING
window_title = 'File Directory'
initial_folder = 'C:'
CHANGING
selected_folder = gd_path.
CALL METHOD cl_gui_cfw=>flush.
CONCATENATE gd_path '' INTO filepath.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR openfile-low.
REFRESH: it_tab.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select File'
default_filename = '*.txt'
multiselection = 'X'
CHANGING
file_table = it_tab
rc = gd_subrc.
LOOP AT it_tab INTO openfile-low.
openfile-sign = 'I'.
openfile-option = 'EQ'.
APPEND openfile.
ENDLOOP.
CALL METHOD cl_gui_cfw=>flush.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR savefile.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
default_extension = 'XLS'
default_file_name = 'accountsdata'
initial_directory = 'c:\temp\'
CHANGING
filename = ld_filename
path = ld_path
fullpath = ld_fullpath
user_action = ld_result.
savefile = ld_fullpath.
阅读(3881) | 评论(0) | 转发(0) |