Give the path of the file to be deleted as the value of FILE_PATH. The file path can also be obtained using the file browser using the function module 'KD_GET_FILENAME_ON_F4 '.
DATA : file type RLGRAP-FILENAME value 'C:\test.txt'.
CALL FUNCTION 'GUI_DELETE_FILE'
FILE_NAME = file
FAILED = 1
OTHERS = 2
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.