Code :
REPORT zvp_read_all_files.
DATA : r3_filepath(100) TYPE c,
it_filelists TYPE TABLE OF rsfillst.
DATA: path TYPE rsmrgstr-path,
filename TYPE rsmrgstr-name,
open_file TYPE rlgrap-filename.
r3_filepath = 'Your Folder Path'.
path = r3_filepath.
CALL FUNCTION 'ZSUBST_GET_FILE_LIST'
EXPORTING
dirname = path
filenm = filename
pattern = 'HOLD_*.CSV'
TABLES
file_list = it_filelists
EXCEPTIONS
access_error = 1
OTHERS = 2.
IF it_filelists[] IS INITIAL.
MESSAGE 'No File in Application Layer Folder' TYPE 'I'.
LEAVE LIST-PROCESSING.
ELSE.
LOOP AT it_filelists INTO DATA(wa_filelists).
CONCATENATE wa_filelists-dirname wa_filelists-name INTO open_file SEPARATED BY '/'.
WRITE: open_file.
ENDLOOP.
ENDIF.
DATA : r3_filepath(100) TYPE c,
it_filelists TYPE TABLE OF rsfillst.
DATA: path TYPE rsmrgstr-path,
filename TYPE rsmrgstr-name,
open_file TYPE rlgrap-filename.
r3_filepath = 'Your Folder Path'.
path = r3_filepath.
CALL FUNCTION 'ZSUBST_GET_FILE_LIST'
EXPORTING
dirname = path
filenm = filename
pattern = 'HOLD_*.CSV'
TABLES
file_list = it_filelists
EXCEPTIONS
access_error = 1
OTHERS = 2.
IF it_filelists[] IS INITIAL.
MESSAGE 'No File in Application Layer Folder' TYPE 'I'.
LEAVE LIST-PROCESSING.
ELSE.
LOOP AT it_filelists INTO DATA(wa_filelists).
CONCATENATE wa_filelists-dirname wa_filelists-name INTO open_file SEPARATED BY '/'.
WRITE: open_file.
ENDLOOP.
ENDIF.
Output :
Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us. We will reply you as soon as possible.
Post a Comment