파일의 경로를 입력하면, 그 파일명과 디렉토리를
딱 나누어줍니다. 괜찮죠?
REPORT YTEST .
DATA: FULLNAME LIKE RLGRAP-FILENAME,
FILENAME LIKE RLGRAP-FILENAME,
FILEPATH LIKE RLGRAP-FILENAME.
FULLNAME = 'C:temptest.txt'.
CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
EXPORTING
FULL_NAME = FULLNAME
IMPORTING
STRIPPED_NAME = FILENAME
FILE_PATH = FILEPATH.
WRITE: / FILENAME,
FILEPATH.
찾아보니 이런 함수도 있군요...
FORM split_filename USING pv_filepath CHANGING pv_extension pv_filename.
DATA : lv_filepath TYPE dsvasdocid,
lv_directory TYPE dsvasdocid,
lv_extension TYPE dsvasdocid,
lv_filename TYPE dsvasdocid.
CLEAR : pv_extension, pv_filename,
lv_filepath, lv_directory, lv_extension, lv_filename.
CHECK pv_filepath NE space. "CHECK 조건이 True면 프로세스 진행 (False면 진행되지 않음)
lv_filepath = pv_filepath.
CALL FUNCTION 'DSVAS_DOC_FILENAME_SPLIT'
EXPORTING
pf_docid = lv_filepath
IMPORTING
pf_directory = lv_directory
pf_extension = lv_extension
pf_filename = lv_filename.
IF sy-subrc EQ 0.
"TRANSLATE 문자열 TO UPPER CASE : 대문자로 변환
"TRANSLATE 문자열 TO LOWER CASE : 소문자로 변환
TRANSLATE lv_extension TO UPPER CASE. "대문자로 변환
pv_extension = lv_extension.
pv_filename = lv_filename.
ENDIF.
ENDFORM. " SPLIT_FILENAME