12-21-2007 2:38 PM
Hi,
How to get all file names present inside a folder which is on application server ? (not on my workstation !)
Like CL_GUI_FRONTEND_SERVICES~DIRECTORY_LIST_FILES, but for a SAP server.
Thanks
Mickael
12-21-2007 2:41 PM
Hi Michael, you could use that class/method, but you just provide the full path with host name and it must be open on your network, but instead try this example program.
report zrich_0001 .
data: begin of itab occurs 0,
rec(1000) type c,
end of itab.
data: wa(1000) type c.
data: p_file type localfile.
data: ifile type table of salfldir with header line.
parameters: p_path type salfile-longname
default '/usr/sap/TST/DVEBMGS01/data/'.
call function 'RZL_READ_DIR_LOCAL'
exporting
name = p_path
tables
file_tbl = ifile
exceptions
argument_error = 1
not_found = 2
others = 3.
loop at ifile.
format hotspot on.
write:/ ifile-name.
hide ifile-name.
format hotspot off.
endloop.
at line-selection.
concatenate p_path ifile-name into p_file.
clear itab. refresh itab.
open dataset p_file for input in text mode.
if sy-subrc = 0.
do.
read dataset p_file into wa.
if sy-subrc <> 0.
exit.
endif.
itab-rec = wa.
append itab.
enddo.
endif.
close dataset p_file.
loop at itab.
write:/ itab.
endloop.
Regards,
Rich Heilman
12-21-2007 2:57 PM
Thanks it works fine.
Note: for unicode (ECC 6.0), we have to add "ENCODING DEFAULT" with "open dataset ".
Else I found also FM " TMP_GUI_DIRECTORY_LIST_FILES "
Edited by: Mickael Huchet on Dec 21, 2007 2:59 PM