Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

File List from Workstation

Former Member
0 Kudos

Hello,

I'm trying to get a list of files from specific directory, say c:\temp\, on the presentation server (workstation).

What is the best way to do this? Any help would be appreciated. Thanks!

Regards,

Sandeep

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos

Hello,

Try this FM:

TMP_GUI_DIRECTORY_LIST_FILES

Pass Directory = 'C:\temp\'

Filler = '.'

Regards,

Naimesh

5 REPLIES 5

suresh_datti
Active Contributor
0 Kudos

You can use the method DIRECTORY_LIST_FILES in the class CL_GUI_FRONTEND_SERVICES.

~Suresh

naimesh_patel
Active Contributor
0 Kudos

Hello,

Try this FM:

TMP_GUI_DIRECTORY_LIST_FILES

Pass Directory = 'C:\temp\'

Filler = '.'

Regards,

Naimesh

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Check this sample.



report zrich_0001.

data: ifile type table of string.
data: xfile type string.
data: xcount type i.


call method cl_gui_frontend_services=>directory_list_files
  exporting
    directory                   = 'C:'
*    FILTER                      = '*.*'
     FILES_ONLY                  = 'X'
*    DIRECTORIES_ONLY            =
  changing
    file_table                  = ifile
    count                       = xcount
  exceptions
    cntl_error                  = 1
    directory_list_files_failed = 2
    wrong_parameter             = 3
    error_no_gui                = 4
    others                      = 5.


loop at ifile into xfile.
  write:/ xfile.
endloop.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi Sandeep,

The method <b>DIRECTORY_LIST_FILES</b> of class <b>CL_GUI_FRONTEND_SERVICES</b> will gives you list of files in a given directory on work station.

Give your directory c:\temp\ to Import parameter <b>DIRECTORY</b> and it will gives list of files in <b>FILE_TABLE</b> and number of files in COUNT.

Thanks,

Vinay