使用cl_gui_frontend_services=>file_open_dialog打开文件选择框时,可以输入file_filter参数,来限定和过滤文件选择框内的文件类型。
常用的文件类型如下:
1 2 3 4 5 6 7 8 |
FILETYPE_ALL = 'All Files (*.*)|*.*|' FILETYPE_EXCEL = 'Microsoft Excel Files (*.XLS;*.XLSX;*.XLSM)|*.XLS;*.XLSX;*.XLSM|' FILETYPE_WORD = 'Microsoft Word Files (*.DOC;*.DOCX;*.DOCM)|*.DOC;*.DOCX;*.DOCM|' FILETYPE_TEXT = 'Text Files (*.TXT)|*.TXT|' FILETYPE_HTML = 'HTML files (*.HTML, *.HTM)|*.HTML;*.HTM|' FILETYPE_RTF = 'RTF Files (*.RTF)|*.RTF|' FILETYPE_XML = 'XML (*.XML)|*.XML|' FILETYPE_POWERPOINT = 'Microsoft PowerPoint Files (*PPT;*.PPTX;*.PPTM)|*PPT;*.PPTX;*.PPTM|' |
可以在类cl_gui_frontend_services的属性中找到,
例子代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
cl_gui_frontend_services=>file_open_dialog( EXPORTING file_filter = cl_gui_frontend_services=>FILETYPE_EXCEL multiselection = space CHANGING file_table = lt_files rc = lv_subrc user_action = lv_user_action EXCEPTIONS file_open_dialog_failed = 1 cntl_error = 2 error_no_gui = 3 not_supported_by_gui = 4 OTHERS = 5 ). |
结果显示:
以上。
发表评论