Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing External Data →  ABAP File Interface →  Statements for the ABAP File Interface 

DELETE DATASET

Short Reference

Other versions: 7.31 | 7.40 | 7.54

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.

Exceptions


Catchable Exceptions

CX_SY_FILE_AUTHORITY

  • Cause: No authorization for access to file
    Runtime Error: OPEN_DATASET_NO_AUTHORITY (can be handled)

CX_SY_FILE_OPEN

  • Cause: File cannot be opened
    Runtime Error: DATASET_CANT_OPEN (can be handled)