*---------------------------------------------------------------------*
* FORM get_app_dir_list *
*---------------------------------------------------------------------*
* 取Application目录文件列表 *
*---------------------------------------------------------------------*
* --> FILE_LIST 包含文件名和文件类型的内表 *
* --> A_DIR App服务器路径,应该为绝对路径 *
*---------------------------------------------------------------------*
FORM get_app_dir_list TABLES file_list STRUCTURE itab_app_file_list
USING a_dir.
DATA: len TYPE i.
CLEAR file_list. REFRESH file_list. CLEAR len.
CALL 'C_DIR_READ_FINISH'.
CALL 'C_DIR_READ_START'
ID 'DIR' FIELD a_dir
ID 'FILE' FIELD '*'.
IF sy-subrc NE 0.
MESSAGE e000(z900) WITH '读取错误' a_dir.
ENDIF.
DO.
CLEAR app_file.
CALL 'C_DIR_READ_NEXT'
ID 'TYPE' FIELD app_file-typ
ID 'NAME' FIELD app_file-name .
CASE sy-subrc.
WHEN 0.
WHEN 1.
EXIT.
WHEN OTHERS.
ADD 1 TO len.
IF len > 10.
EXIT.
ENDIF.
ENDCASE.
* CHECK app_file-typ(1) CO 'fFdD'.
CHECK app_file-typ(1) CO 'fF'. "只要文件,不要目录
MOVE-CORRESPONDING app_file TO file_list.
APPEND file_list.
ENDDO.
SORT file_list BY typ name ASCENDING.
ENDFORM.
阅读(4659) | 评论(6) | 转发(0) |