上载文件时
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
mask = ',Excel Files,*.xls,All Files,*.*.' (101)
title = '选择文件'(100)
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
IF sy-subrc <> 0 AND sy-subrc <> 3.
MESSAGE e100(zdev) WITH '选择文件出错!'(007).
ENDIF.
需要选择窗口
两种实现方式:
PARAMETER: p_file TYPE ibipparms-path DEFAULT 'C:UserspcDesktop上传模板.xlsx'.
第一种:
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
第一种:
AT
第二种:
另外有个函数可以校验文件是否存在
TMP_GUI_GET_FILE_EXIST