Для открытия диалога выбора файла используем метод cl_gui_frontend_services=>file_open_dialog.
*&---------------------------------------------------------------------* *& Form F4_FILENAME *&---------------------------------------------------------------------* * File name search help *----------------------------------------------------------------------* FORM f4_filename CHANGING value(cv_filename). DATA: lt_filename TYPE filetable, ls_filename LIKE LINE OF lt_filename, lv_def_filename TYPE string, lv_file_filter TYPE string, lv_rc TYPE i. CLEAR cv_filename. CLEAR lv_def_filename. lv_file_filter = 'Excel-файлы (*.XLS;*.XLSX)|*.XLS;*.XLSX|'. CALL METHOD cl_gui_frontend_services=>file_open_dialog EXPORTING * default_extension = lv_def_extension " 'DBF' default_filename = lv_def_filename file_filter = lv_file_filter CHANGING file_table = lt_filename rc = lv_rc EXCEPTIONS file_open_dialog_failed = 1 cntl_error = 2 error_no_gui = 3 not_supported_by_gui = 4 OTHERS = 5. IF sy-subrc NE 0. ELSEIF lt_filename IS NOT INITIAL. READ TABLE lt_filename INTO ls_filename INDEX 1. cv_filename = ls_filename-filename. ENDIF. ENDFORM. " F4_FILENAME
Комментариев нет:
Отправить комментарий