04-29-2015 1:02 PM
Hi All,
My requirment is to get releted files from Local Directory.
For Example Path is "D/Data/"
in this path there is files like
abc123_de.txt
abc123_en.txt
xyz123_de.txt
abc123_pt.txt
xyz123_en.txt
pqr123_en.txt
bcg234_en.txt
sjd467_en.txt
Now i want to use only files which are strart from abc123 and use their data.
From which FM i can do it or how can i do this?
Thanks,
Mahipalsinh
04-29-2015 1:07 PM
Hi,
just try this method.
CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES
I think that should fit your requirement.
regards
Alex
04-29-2015 1:07 PM
Hi,
just try this method.
CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES
I think that should fit your requirement.
regards
Alex
04-29-2015 2:02 PM
04-30-2015 7:31 AM
Dear Mahipalsinh,
I have got the same requirement some days back, i think there is no FM for your requirement. so what i did, i have get all the files using below FM and Concatenate the ABC.
Please use the Below FM, because if the file name is above that 50 character that time always it gives the full file name. Please check, if u used the other one for getting the Files.
CALL FUNCTION 'EPS2_GET_DIRECTORY_LISTING'
EXPORTING
iv_dir_name = lv_dir_name
TABLES
dir_list = lt_file_name
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.
* Implement suitable error handling here
ENDIF.
For reading Specific Files.
CONCATENATE 'AP' lv_internal_date INTO lv_filename.
LOOP AT lt_file_name INTO ls_file_name.
lv_index = sy-tabix.
IF ls_file_name-name CS lv_filename.
" PUT YOUR LOGIC
endif.
endloop.
Thanks,
Nishant
04-30-2015 1:48 PM