Skip to Content

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

Using wild characters to pick up files from Local desktop file directory

Hi all,

My flat files are on my local desktop .

Let's say I have 3 files starting with the letter 'T'.

Titan1.txt

Titan2.txt

Titan3.txt

I need to use wild characters and pick up all 3 files by giving 'T*.txt'

I would like to know how to search my directory ?

Please guide me and give some pointers.

Warm regards,

Hari Kiran

Former Member
replied

You can pass 'T*.TXT' to the FILTER param of the method DIRECTORY_LIST_FILES.

No need to take data into the internal table & process it.

CALL METHOD cl_gui_frontend_services=>directory_list_files
EXPORTING
directory = dir
filter = 'T*.TXT'
files_only = 'X' 
CHANGING
file_table = it_pfiles
count = count
EXCEPTIONS
cntl_error = 1
directory_list_files_failed = 2
wrong_parameter = 3
error_no_gui = 4
not_supported_by_gui = 5
OTHERS = 6.

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