DATA:GDF_PATH TYPE STRING, "add by shikai.liao
GDF_FILENAME TYPE STRING,
GDF_FULLPATH TYPE STRING.
DATA:LDF_PATH TYPE LOCALFILE.
.
"弹出路径框
CLEAR: GDF_PATH,
GDF_FILENAME,
GDF_FULLPATH.
PERFORM FRM_GET_PATH_038 CHANGING GDF_PATH GDF_FILENAME GDF_FULLPATH .
IF GDF_FULLPATH IS INITIAL .
MESSAGE '请选择要保存的文件夹和输入文件名' TYPE 'I'.
ELSE.
CLEAR LDF_PATH.
MOVE GDF_FULLPATH TO LDF_PATH.
FORM FRM_GET_PATH_038 CHANGING:FU_PATH
FU_FILENAME
FU_FULLPATH .
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
WINDOW_TITLE = 'Select Folder and Enter Filename to Save File'
DEFAULT_EXTENSION = 'xls' "'xlsx'
* DEFAULT_FILE_NAME =
* WITH_ENCODING =
FILE_FILTER = '*.xls' "'*.xlsx'
* INITIAL_DIRECTORY =
* PROMPT_ON_OVERWRITE = 'X'
CHANGING
FILENAME = FU_FILENAME
PATH = FU_PATH
FULLPATH = FU_FULLPATH
* USER_ACTION =
* FILE_ENCODING =
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
INVALID_DEFAULT_FILE_NAME = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
* CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
* EXPORTING
* WINDOW_TITLE = 'Select Folder to Save File'
* CHANGING
* SELECTED_FOLDER = gdf_path
* EXCEPTIONS
* CNTL_ERROR = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
* OTHERS = 4.
* IF SY-SUBRC <> 0.
*
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
ENDFORM. " FRM_GET_PATH