SAP NetWeaver AS ABAP Release 752, ©Copyright 2017 SAP AG. All rights reserved.
ABAP - Keyword Documentation → ABAP - Reference → Processing External Data → ABAP File Interface → Statements for the ABAP File Interface →
DELETE DATASET
Syntax
DELETE DATASET dset.
Effect
The statement deletes the file specified in dset. dset expects a character-like data object containing the
physical name of the file. The file can be opened or closed.
Note
When a file is deleted, automatic authorization checks are performed; self-programmed checks may also be necessary.
Security Note
Access to a file whose name dset is injected into a program from outside is a serious security risk. Any names passed to a program from outside must be checked thoroughly before being used. See
Directory Traversal.
Return Value
| sy-subrc | Meaning |
| 0 | File has been deleted. |
| 4 | File could not be deleted. |
Handleable Exceptions
CX_SY_FILE_AUTHORITY
CX_SY_FILE_OPEN
Example
Opens a file for writing and reading and then deletes the file.
DATA(dset) = 'test.dat'.
OPEN DATASET dset FOR OUTPUT IN BINARY MODE.
...
CLOSE DATASET dset.
...
OPEN DATASET dset FOR INPUT IN BINARY MODE
...
CLOSE DATASET dset.
DELETE DATASET dset.