2006 Jan 25 11:34 AM
Hi All,
Could any one of you tell me a function module which checks whether a given file on the application server is currently being open or not.
Regards
Amit Mishra
2006 Jan 25 12:31 PM
Amit,
Try GET DATASET.
Basic form
GET DATASET dsn.
Extras:
1. ... POSITION pos
2. ... ATTRIBUTES attr
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. For details, see File Interface.
Effect
Used to get the properties of a file already open.
You can use this statement without additions to determine whether the file is open.
If the file is not open, an exception of the type CX_SY_FILE_OPEN_MODE is triggered.
Regards,
Rao A
Message was edited by: Rao Arimilli
Hi All,
Could any one of you tell me a function module which checks whether a given file on the application server is currently being open or not.
Regards
Amit Mishra
2006 Jan 25 11:38 AM
Try to open the dataset in write mode.
If it fails, that means it is already open.
catch the Catchable Exception
CX_SY_FILE_OPEN
after the open dataset statement
Cause: File is already open (only in Unicode programs)
2006 Jan 25 11:48 AM
Hi Ravi,
Actually the scenario is something like this.
If the file is open in read mode then anybody can open it in write mode, in that case it won't give any error.
All I need to check is, if the file is open at all. Mode is not important in my situation.
Regards
Amit Mishra
2006 Jan 25 11:44 AM
Hi Amit Mishra,
1. There is no such FM/facility
by which we can know such thing.
2. However,
when we open the file in program,
the sy-subrc returned
tells that some error has occured,
and based on the value,
we can know, if its already opened!
regards,
amit m.
2006 Jan 25 11:46 AM
Hi,
try to open the dataset it will fail to open and throw this CX_SY_FILE_OPEN .
the check the documentation..
Applying OPEN DATASET to a file already opened - in the same internal mode - triggers an exception of the type CX_SY_FILE_OPEN.
check the documentation on open dataset..
2006 Jan 25 11:48 AM
if with open data set, sy-subrc = 4, then file is already open
2006 Jan 25 11:53 AM
2006 Jan 25 12:16 PM
hi amit,
when we use open dataset....instruction you can make use of the exception CX_SY_FILE_OPEN to see if the file open provided it is opened in unicode mode.
2006 Jan 25 12:29 PM
Hi,
you can try FM <b>EPS_OPEN_INPUT_FILE</b> and check .
or FM's <b>RZL_READ_FILE_LOCAL</b>
check the sy-subrc and decide
regards
vijay
2006 Jan 25 12:31 PM
Amit,
Try GET DATASET.
Basic form
GET DATASET dsn.
Extras:
1. ... POSITION pos
2. ... ATTRIBUTES attr
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. For details, see File Interface.
Effect
Used to get the properties of a file already open.
You can use this statement without additions to determine whether the file is open.
If the file is not open, an exception of the type CX_SY_FILE_OPEN_MODE is triggered.
Regards,
Rao A
Message was edited by: Rao Arimilli
2006 Jan 25 12:45 PM
Hi Arimilli,
Thanks. It's working fine for my scenario.
Regards
Amit Mishra
2007 Oct 16 12:55 PM
Hi Amit,
I have a same problem which you had earlier.
Could you please tell me how to solve the problem
Thanks and regards,
Mallareddy rayapureddy
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |