*&———————————————————————*
*& Report ZST_UPLOAD
*&———————————————————————*
*&
*&———————————————————————*
REPORT ZST_UPLOAD.
DATA: FILENAME TYPE STRING VALUE ‘c:bathinput.TXT’.
TYPES: BEGIN OF ITAB,
F(20),
END OF ITAB.
DATA: DATA_TAB TYPE STANDARD TABLE OF ITAB.
DATA: WA_TAB TYPE ITAB.
DATA: FILE_FILTER TYPE STRING,
RC TYPE I.
DATA: FILE_TABLE TYPE FILETABLE.
DATA: WA_FILE_TABLE TYPE LINE OF FILETABLE.
FILE_FILTER = ‘All Files (*.*)|*.TXT’.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = ‘WINDOW_TITLE’
DEFAULT_EXTENSION = ‘*.TXT’
DEFAULT_FILENAME = ‘BatchInput.TXT’
FILE_FILTER = FILE_FILTER
INITIAL_DIRECTORY = ‘c:\’
MULTISELECTION = ‘X’
CHANGING
FILE_TABLE = FILE_TABLE
RC = RC
.
LOOP AT FILE_TABLE INTO WA_FILE_TABLE.
FILENAME = WA_FILE_TABLE–FILENAME.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
EXPORTING
FILENAME = FILENAME
FILETYPE = ‘DAT’
DAT_MODE = ‘X’
CHANGING
DATA_TAB = DATA_TAB .
IF SY–SUBRC <> 0.
WRITE:/ ‘failure’.
ELSE.
LOOP AT DATA_TAB INTO WA_TAB.
WRITE:/ WA_TAB–F.
ENDLOOP.
ENDIF.
ENDLOOP.