Application Development and Automation 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: 
Read only

deleting file from server

Former Member
0 Likes
1,624

hi, i need help,i have a file in server: file.txt, i rename this to file.ols,but file.txt yet exist,

how i delete the file file.txt....

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,281

Hi,

See the example.

DATA FNAME(60) VALUE 'myfile'.

OPEN DATASET FNAME FOR OUTPUT.

OPEN DATASET FNAME FOR INPUT.

IF SY-SUBRC = 0.

WRITE / 'File found'.

ELSE.

WRITE / 'File not found'.

ENDIF.

DELETE DATASET FNAME.

OPEN DATASET FNAME FOR INPUT.

IF SY-SUBRC = 0.

WRITE / 'File found'.

ELSE.

WRITE / 'File not found'.

ENDIF.

The output appears as follows:

File found

File not found

In this example, the file "myfile" is opened for write access as long as it does not already exist. The system finds the file when it is opened for read access. After the DELETE DATASET statement, the system can no longer find the file

Don't forget to reward i8f useful...

hi, i need help,i have a file in server: file.txt, i rename this to file.ols,but file.txt yet exist,

how i delete the file file.txt....

6 REPLIES 6
Read only

Former Member
0 Likes
1,281

where is the file?

is it in application server or presentation server?

if its in appltn server use "Delete dataset"

bye

Read only

Former Member
0 Likes
1,281

thanks,you have any example of delete dataset please???

Read only

0 Likes
1,281

You can use the function module - ISH_N2_DELETE_FILE_APP_SERVER,

Pass the file path and file name to it, it deletes the file.

Thanks,

Srinivas

Read only

Former Member
0 Likes
1,282

Hi,

See the example.

DATA FNAME(60) VALUE 'myfile'.

OPEN DATASET FNAME FOR OUTPUT.

OPEN DATASET FNAME FOR INPUT.

IF SY-SUBRC = 0.

WRITE / 'File found'.

ELSE.

WRITE / 'File not found'.

ENDIF.

DELETE DATASET FNAME.

OPEN DATASET FNAME FOR INPUT.

IF SY-SUBRC = 0.

WRITE / 'File found'.

ELSE.

WRITE / 'File not found'.

ENDIF.

The output appears as follows:

File found

File not found

In this example, the file "myfile" is opened for write access as long as it does not already exist. The system finds the file when it is opened for read access. After the DELETE DATASET statement, the system can no longer find the file

Don't forget to reward i8f useful...

Read only

Former Member
0 Likes
1,281

1) If the file in presentation server

use FM: GUI_DELETE_FILE

or

use static method: CL_GUI_FRONTEND_SERVICES=>FILE_DELETE.

2)If the file is in application server

use the syntax : DELETE DATASET <filename>.

Reward if it useful.

Dara.

Read only

Former Member
0 Likes
1,281

I suggest you try Long path tool is the very good program for easily delete, copy & rename long path files, error, unlock solution. Try it and solve your problem.