How to check whether file exists in application server ?

Question: Hi.

I have a requirement , where if file at the corresponding location on the application server (That can be path where user is authorized ) exists need to throw a error message and should stop the user for going upload.

I had some light on this, before uploading we can read the corresponding file using read dataset.. if this fails, then there is no file and if not we can throw an error message saying that file exists.

Apart from this is there any FM which tells you that file already exists ?

Any thought on this.. That can helpful for me..

Thanks
Nagarjuna

Answer:
As you say an open dataset will give you the answer you seek.

Why then would you want a FM that will do an open dataset? Isnt that just more layers of complexity than is necessary?

Answer:
As you say an open dataset will give you the answer you seek.
Not really. The open could fail for many reasons, only one of which is because it doesn't exist.

Answer:
As you say an open dataset will give you the answer you seek.
Not really. The open could fail for many reasons, only one of which is because it doesn't exist.

And what would be the other reasons in this case? From reading the post they are trying to use this file as a way to check on authorisation - in which case the file wont change - it will just be a trigger file that they would always know which type of file it will be etc. So as far as I can think an open will do the job iin this case. But maybe im reading the requirement wrong.

Perhaps you should try to be helpful instead of giving one liner answers pulling down other people solutions? How about you give us your solution?

Answer:
I would get the list of files in the directory (FM ca be found in sapfans search) and look for file.

If app server is UNIX, you probably don't even need this FM, because very often the UNIX directory can be read just as a normal file (in binary mode) and then searched for file name. But this way is trickier.
_________________
ilya

More input data: http://abaplog.wordpress.com
Sapfans ABAP FAQ: /forums/viewtopic.php?t=94198
R's ABAP Knowledge Corner: http://www.Rard-harper.net/kb/kb.html
Function modules documentation: http://www.se37.com

Answer:
Hello Guys


All the Logical and physical filenames are stored in table FILENAMECI.

we can write a select statement on this table searching for a file. If sy-subrc eq to zero, file exits , else file is not existing.

What do you think guys. Anyway its my opinion , may not be correct.

Thank you
Vasu
Copyright ?2007 - 2008 www.jt77.com