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

Former Member
0 Likes
865

Hi all,

After I have finished the processing of an excel file(uploading it into an itab and copied this file from one folder to another folder), I want to delete this file.

However I can not delete it, it is said it is being used...

How can I control whether it is being used or not? And if not used then I can delete, how can I understand that?

Thanks.

deniz.

7 REPLIES 7
Read only

Former Member
0 Likes
816

are you using open dataset or gui_upload?

Read only

former_member156446
Active Contributor
0 Likes
816

if the file is in application server after close dataset to read the file you can use delete dataset statement to delete the file from app server.

CONVT_DELETE_FILES

GUI_DELETE_FILE fm might help u..

Read only

Former Member
0 Likes
816

Hi,

The file is under a directory at My Computer, not on application server and I do not use dataset.

Just got the file and upload it through:

ALSM_EXCEL_TO_INTERNAL_TABLE.

Actually I get a list of files under directory and loop through this file itab and upload all files into data itab.

After uploading the file into itab, and do some more works,

I want to delete this file but could not achieve this.

Thanks.

deniz.

Read only

Former Member
0 Likes
816

Hello,

To upload file you will select path take that select path in one variable and pass that variable to the FM below.

data: y_lv_dpath TYPE rlgrap-filename.

CALL FUNCTION 'GUI_DELETE_FILE'

EXPORTING

file_name = y_lv_dpath

EXCEPTIONS

failed = 0

OTHERS = 0.

Read only

Former Member
0 Likes
816

If the file is in your Presentation server then you can go to that path and delete the file. If it is giving you a error message that it is being used by some other program then try to end all the programs that you are running and then try it again.

Thanks,

Jayant

Read only

0 Likes
816

Hi Jayant,

Thanks.

You understood the problem but actual problem is that the program that uses file and wants to delete the file is the same program.

Logic is that, get data of a file and then delete this file with the same program.

There is one way to solve this problem and it is to know when SHARING_VIOLATION ends.

Thanks.

deniz.

Read only

Former Member
0 Likes
816

Hi try like this.

open dataset.

--

--

-

-

close data set

delete dataset.

Kiran