F How to read AL11 files using ZSUBST_GET_FILE_LIST function module in ABAP program | CodeTheta

How to read AL11 files using ZSUBST_GET_FILE_LIST function module in ABAP program

January 31, 2023

Code :
REPORT zvp_read_all_files.

DATA r3_filepath(100TYPE c,
       it_filelists     TYPE TABLE OF rsfillst.

DATApath      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 '/'.
    WRITEopen_file.
  ENDLOOP.
ENDIF.

Output :



IDE Used To Test This Code : ABAP Editor.

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