09-16-2008 7:18 AM
I am using the function module SUBST_GET_FILE_LIST to get the list of files in the directory.In that there are two import parameters dirname and filenm.I wanted to know what do I enter for the above two parameters?I have with me the physical file name which I got from the logical filename using the function module FILE_GET_NAME
Can anyone please tell me what needs to be entered for the two parameters dirname and filenm and from where do I get those values from?
09-16-2008 7:28 AM
Since you don't mention an sap version, I'll guess you are using ECC6.
Parameter dirname should have the name of the directory you want to view a list of files of. (c:\temp ,/usr/sap/tmp , ...)
Filename can have a pattern '.\' for all files '\*.txt for only text files etc.
The parameter pattern seems to have the same effect as the parameter filenm, so I think you can ignore it.
Edited by: Dries Horions on Sep 16, 2008 8:29 AM
09-16-2008 7:45 AM
Hi...
Please see the test code..
REPORT z_test_subha3.
DATA: i_file TYPE STANDARD TABLE OF rsfillst INITIAL SIZE 0,
wa_file TYPE rsfillst .
Directory Block
SELECTION-SCREEN: BEGIN OF BLOCK file WITH FRAME TITLE text-002.
SELECTION-SCREEN SKIP.
PARAMETERS:
p_path TYPE rsmrgstr-path
DEFAULT './' LOWER CASE.
SELECTION-SCREEN: END OF BLOCK file.
START-OF-SELECTION.
CALL FUNCTION 'SUBST_GET_FILE_LIST'
EXPORTING
dirname = p_path
filenm = '*'
PATTERN =
TABLES
file_list = i_file
EXCEPTIONS
access_error = 1
OTHERS = 2
.
IF sy-subrc = 0.
LOOP AT i_file INTO wa_file.
WRITE: / wa_file-name.
ENDLOOP.
ENDIF.