REPORT Y_CLY_104X.
START-OF-SELECTION.
DATA: P_FULLPATH TYPE STRING.
PERFORM FRM_GET_FILE_PATH CHANGING P_FULLPATH.
WRITE: P_FULLPATH.
*&---------------------------------------------------------------------*
*& Form FRM_GET_FILE_PATH
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_P_FULLPATH text
*----------------------------------------------------------------------*
FORM FRM_GET_FILE_PATH CHANGING CV_FULLPATH.
"路径
DATA: L_FILENAME TYPE STRING,
L_PATH TYPE STRING,
L_FULLPATH TYPE STRING.
CLEAR: CV_FULLPATH.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
WINDOW_TITLE = '下载文件'
FILE_FILTER = ''
CHANGING
FILENAME = L_FILENAME
PATH = L_PATH
FULLPATH = L_FULLPATH
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
IF L_PATH IS INITIAL
OR L_FILENAME IS INITIAL. " 未选择路径,则返回
RETURN.
ELSE.
TRANSLATE L_FILENAME TO UPPER CASE .
FIND REGEX '.XLS' IN L_FILENAME.
IF SY-SUBRC <> 0.
MESSAGE '请填写完整路径!' TYPE 'E'.
RETURN.
ENDIF.
ENDIF.
CV_FULLPATH = L_FULLPATH.
ENDFORM. " FRM_GET_FILE_PATH