List the files in a folder on a Presentation Server

By Venkateswara Rao Appikonda, Intelligroup

If there is a need to find the no of files in a folder on the Presentation Server , then this will be achieved by this function module TMP_GUI_DIRECTORY_LIST_FILES

Here is the sample code for the same.

report ztests. 
data : file_table like table of SDOKPATH with header line .
data : dir_table like table of SDOKPATH with header line . 
data : file_count type i ,
       dircount   type i . 
parameters:p_dir(50) type c.
CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
EXPORTING
DIRECTORY = p_dir
FILTER = '*.TXT'
 IMPORTING
 FILE_COUNT = file_count
 DIR_COUNT =  dircount
TABLES
FILE_TABLE = file_table
DIR_TABLE = dir_table
 EXCEPTIONS
 CNTL_ERROR = 1
 OTHERS = 2. 
write:/ 'no of files in the floder is : ', file_count .
skip 32. 
loop at file_table .
write:/ file_table-PATHNAME.
endloop.

Execute the program:

The output will be like this …

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image