REPORT zcatch_endcatch.
DATA: BEGIN OF ifile OCCURS 0,
rec(150),
END OF ifile.
PARAMETERS: path(99) TYPE c LOWER CASE
DEFAULT '/usr/sap/TST/SYS/TEST001.txt'.
OPEN DATASET path FOR INPUT IN TEXT MODE ENCODING DEFAULT.
CATCH SYSTEM-EXCEPTIONS dataset_cant_open = 1.
DO.
READ DATASET path INTO ifile-rec.
IF sy-subrc EQ 0.
APPEND ifile.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDCATCH.
IF sy-subrc = 1.
WRITE:/ 'File could not be opened'.
ENDIF.
Here you can find examples and sample programs related to ABAP Report Programs, ALV Grid/List Programs, BDC, HR ABAP, Function Modules, BAPIs, BADIs, Smartforms, SapScripts, etc.
Google Search - Blog...........
Showing posts with label handle system exceptions using catch statement. Show all posts
Showing posts with label handle system exceptions using catch statement. Show all posts
Subscribe to:
Posts (Atom)