Delete a file using ABAP

DELETE DATASET is the statement in ABAP programs used for deleting a file in Application server.

Syntax

DELETE DATASET <dsn>

Here the variable <dsn> specifies the file name for delete.

After this statement execution the system field SY-SUBRC contains the following values.

  • SY-SUBRC=0 (if the file is deleted successfully)
  • SY-SUBRC=4 (if failure in deletion)

The main runtime errors are

  • OPEN_DATASET_NO_AUTHORITY
  • DATASET_CANT_OPEN
Also Read : View Other ABAP Keywords & Syntax -> ABAP Transaction codes