09-29-2008 8:15 AM
Hi All,
I have a requirement like I will get the files to the application for the given logical path.I will get the physical files correspoding to that using FILE_GET_NAME function module but the problem is if there are multiple files in the given logical path how to get all these files using this function module?since this function module will return always only one file.
For example say my interface is woriking once in a day(examp afternoon) by that time if we have two different files with the date and time stamp(file_20090930_12.00.00,file_20090930_13.00.00) then if I use this function module which file it will return will it retun first file or second file?
Regards
Mahesh
09-29-2008 10:07 AM
Hi,
Try using FM 'EPS_GET_DIRECTORY_LISTING'. This FM will list all the file names from a particular directory.
*********************************************
For example...
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
DIR_NAME = LW_TEMP_PATH
FILE_MASK = '.'
TABLES
dir_list = it_files
EXCEPTIONS
invalid_eps_subdir = 1
sapgparam_failed = 2
build_directory_failed = 3
no_authorization = 4
read_directory_failed = 5
too_many_read_errors = 6
empty_directory_list = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*****************************************************
In your case, pass exporting parameter as
'file_20090930'*
Just see if it works out..
Regards,
Shailesh Jadhav
09-29-2008 10:12 AM
Hi,
In ur case, pass the exporting parameter FILE_MASK as 'file_20090930*'. So that it will give all file names starting with file_20090930 in interanl table it_files
Regards,
Shailesh Jadhav