Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

CL_GUI_FRONTEND_SERVICES->FILE_DELETE -- use???

Former Member
0 Kudos

How to delete a file from the presentation server (desktop) using the following method?? explain in detail with sample code.

CL_GUI_FRONTEND_SERVICES->FILE_DELETE

Regards,

Kalai

1 ACCEPTED SOLUTION

Former Member
0 Kudos

pass u r file path name in the presentation server thats it.......

DATA V_RC TYPE I.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_DELETE

EXPORTING

FILENAME = 'C:\LAK1.XLS'

CHANGING

RC = V_RC

EXCEPTIONS

FILE_DELETE_FAILED = 1

CNTL_ERROR = 2

ERROR_NO_GUI = 3

FILE_NOT_FOUND = 4

ACCESS_DENIED = 5

UNKNOWN_ERROR = 6

NOT_SUPPORTED_BY_GUI = 7

WRONG_PARAMETER = 8

OTHERS = 9.

IF SY-SUBRC <> 0.

ENDIF

4 REPLIES 4

Former Member
0 Kudos

Hi,

You just need to pass the file name to this method.

regards,

Atish

Former Member
0 Kudos

pass u r file path name in the presentation server thats it.......

DATA V_RC TYPE I.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_DELETE

EXPORTING

FILENAME = 'C:\LAK1.XLS'

CHANGING

RC = V_RC

EXCEPTIONS

FILE_DELETE_FAILED = 1

CNTL_ERROR = 2

ERROR_NO_GUI = 3

FILE_NOT_FOUND = 4

ACCESS_DENIED = 5

UNKNOWN_ERROR = 6

NOT_SUPPORTED_BY_GUI = 7

WRONG_PARAMETER = 8

OTHERS = 9.

IF SY-SUBRC <> 0.

ENDIF

Former Member
0 Kudos

Hi , just copy and paste the below code for deleteing the File ...

call method cl_gui_frontend_services=>file_delete
  exporting
    filename           = filepatch
  changing
    rc                 = sysubrc
*  EXCEPTIONS
*    FILE_DELETE_FAILED = 1
*    CNTL_ERROR         = 2
*    ERROR_NO_GUI       = 3
*    FILE_NOT_FOUND     = 4
*    ACCESS_DENIED      = 5
*    UNKNOWN_ERROR      = 6
*    others             = 7
        .
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.

Reward points if it is usefull .....

Girish

Former Member
0 Kudos

Hi,

Just give the path of the required file name which you want to delete to the exporting parameter 'File name = '

Regards,

Ramana