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.

在SAP中处理数据时,经常需要从Excel导入。本文介绍了如何利用ABAP接口CL_GUI_FRONTEND_SERVICES中的方法file_open_dialog进行文件选择对话框操作,包括设置对话框标题、文件过滤器,并展示了处理多个上传文件的内表使用方式。
最低0.47元/天 解锁文章
133

被折叠的 条评论
为什么被折叠?



