2008 Jul 28 10:08 PM
I want to obtain the list of file in a folder. Is there a function module i can use directly?
2008 Jul 28 10:14 PM
Try this.
data: lt_filetable type filetable.
data: ls_filetable like line of lt_filetable.
data: lv_count type i.
CALL METHOD cl_gui_frontend_services=>directory_list_files
EXPORTING
directory = 'C:\'
* filter = '*.*'
files_only = 'X'
* directories_only =
changing
file_table = lt_filetable
count = lv_count.
loop at lt_filetable into ls_filetable.
write:/ ls_filetable-FILENAME.
endloop.
Regards,
Rich Heilman
2008 Jul 28 10:13 PM
check this sample
PARAMETER: p_fdir type pfeflnamel DEFAULT 'usrsapYRDSYSprofile'.
data:
t_files like salfldir occurs 0 with header line.
*START-OF-SELECTION
START-OF-SELECTION.
* Retrieving the list of files in the given directory
call function 'RZL_READ_DIR_LOCAL'
exporting
name = p_fdir
tables
file_tbl = t_files.
* List of files are contained within table it_filedir
loop at t_files.
write: / t_files-NAME.
endloop.
2008 Jul 28 10:14 PM
Try this.
data: lt_filetable type filetable.
data: ls_filetable like line of lt_filetable.
data: lv_count type i.
CALL METHOD cl_gui_frontend_services=>directory_list_files
EXPORTING
directory = 'C:\'
* filter = '*.*'
files_only = 'X'
* directories_only =
changing
file_table = lt_filetable
count = lv_count.
loop at lt_filetable into ls_filetable.
write:/ ls_filetable-FILENAME.
endloop.
Regards,
Rich Heilman
2008 Jul 28 10:16 PM
you can use the class
CL_GUI_FRONETEND_SERVICES and method FILE_OPEN_DIALOG
CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
Parameter FILE_TABLE this opens a poup where you select the files.
using CTRL we can select the multiple files, those file will be stored into FILE_TABLE.
so you can use this file_table and read the files.