DATA FNAME(60) VALUE 'myfile'.
OPEN DATASET FNAME FOR OUTPUT.
OPEN DATASET FNAME FOR INPUT.
IF SY-SUBRC = 0.
WRITE / 'File found'.
ELSE.
WRITE / 'File not found'.
ENDIF.
DELETE DATASET FNAME.
OPEN DATASET FNAME FOR INPUT.
IF SY-SUBRC = 0.
WRITE / 'File found'.
ELSE.
WRITE / 'File not found'.
ENDIF.
The output appears as follows:
File found
File not found