Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Empty folder

How can I know if a directory is empty (without files)?

Somebody know a function? or have any idea?

Thanks a lot.

Former Member
replied

You can use this FM: TMP_GUI_DIRECTORY_LIST_FILES

Like:

  DATA: TBL_FILES LIKE SDOKPATH OCCURS 10 WITH HEADER LINE,
        TBL_DIRS LIKE SDOKPATH OCCURS 10 WITH HEADER LINE.


  CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
       EXPORTING
            DIRECTORY  = P_DIRECTORY
       TABLES
            FILE_TABLE = TBL_FILES
            DIR_TABLE  = TBL_DIRS.


describe table tbl_Files lines sy-index.
if sy-index is initial.
*  no files in the directory
endif. 

Regards,

Naimesh Patel

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question