abap中方法file_open_dialog的使用

来源:互联网 发布:广联达是什么软件 编辑:程序博客网 时间:2024/05/16 04:48

SAP中,经常会将整理好的数据(通常为excel表格)通过程序写入相应的表中。

这过程中,选择上传文件需要使用到SAP提供的标准方法:file_open_dialog。

它是接口CL_GUI_FRONTEND_SERVICES中的一个标准方法,调用例子如下:

  data: v_rc type i,g_file like rlgrap-filename,        v_filetable type filetable.  call method cl_gui_frontend_services=>file_open_dialog    exporting      window_title            = '选择源文件'      file_filter             = '全部文件 (*.*)'      multiselection          = space    changing      file_table              = v_filetable      rc                      = v_rc    exceptions      file_open_dialog_failed = 1      cntl_error              = 2      error_no_gui            = 3      not_supported_by_gui    = 4      others                  = 5.  if sy-subrc = 0 and v_rc = 1.    read table v_filetable into g_file index 1.  endif.

参数:

window_title:文件选择对话框标题

file_filter:文件过滤器

file_table:选择上传的文件,若打开多个文件,则将该参数定义为一个内表,此时打开文件参数rc>1

--the end--