05-19-2008 12:45 PM
Hi to all,
Can anybody tell me how to use
CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES
Thanks in advance
05-19-2008 12:48 PM
Hi,
The method returns all files in the specified directory.
Cheers.
...Reward if useful.
05-19-2008 12:48 PM
Hi,
The method returns all files in the specified directory.
Cheers.
...Reward if useful.
05-19-2008 12:49 PM
Hi,
we Can use this method cl_gui_frontend_services=>directory_list_files
to get the list of files not only from local server but also from a different server(other than R/3).
Check the sample code
REPORT ZGRO_TESTT.
*
DATA: FILE_TABLE TYPE FILETABLE.
DATA: COUNT TYPE I.
*
START-OF-SELECTION.
*
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES
EXPORTING
DIRECTORY = 'C:\'
DIRECTORY = '
server\server1'
CHANGING
FILE_TABLE = FILE_TABLE
COUNT = COUNT.
*
IF SY-SUBRC 0.
WRITE: / SY-SUBRC.
ENDIF.
*
BREAK-POINT.
*
END-OF-SELECTION.
Reward useful Answers
Regards,
Raj.
05-19-2008 12:53 PM
TYPES: BEGIN OF TY_LINE,
LINE TYPE CHAR100,
END OF TY_LINE.
DATA: FILE_TABLE TYPE TABLE OF TY_LINE,
COUNT TYPE I.
CALL METHOD cl_gui_frontend_services=>directory_list_files
EXPORTING
directory ='C:\'
filter = '.'
files_only =
directories_only =
changing
file_table = FILE_TABLE
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
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Reward if helpful
05-19-2008 12:54 PM
Hi,
check out the below sample code
DATA: gt_filetab TYPE TABLE OF file_info,
wa_filetab LIKE LINE OF gt_filetab,
lv_konyvtar_string TYPE string,
...
REFRESH gt_filetab.
lv_konyvtar_string = 'C:\Temp'
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES
EXPORTING directory = lv_konyvtar_string
CHANGING file_table = gt_filetab
count = gv_count
Regards
Kiran Sure