2007 Sep 12 5:22 AM
Hello Experts!!!
I am facing a very weird problem. I have a file which exists in two different folders. If I open the file in the first folder, the sy-subrc value is 0. If I try to open the same file in the other folder i get sy-subrc value as 8. The file exists in both the paths and the path is coded correctly. Can anyone let me know whether there can be any other problem? I tried creating and changing files in manually in both the folders and I was able to do so.
I hard coded both the paths to check for any discrepencies and the problem persisted. Here is the code-
open dataset
'
Wxyzf001\interfaces\ABC\DEFG\OUT\ZCANA_PB_CC_DTB_TEST.txt' for
output in text mode ENCODING DEFAULT.
write sy-subrc.
Here the output is 0.
open dataset
'
Wxyzf001\interfaces\BCD\EFG_XYZ\OUT\ZCANA_PB_CC_DTB_TEST.txt' for
output in text mode ENCODING DEFAULT.
write sy-subrc.
Here the output is 8.
Please throw some light on why this is happening.
Thanks and Regards,
Smitha
2007 Sep 12 5:30 AM
Please check whether the path & file name is correct. Try to read a file from that folder to ensure that you have authorization to access that folder.
2007 Sep 12 5:49 AM
Hello Prashanth,
Thank you for the reply. I tried reading some other file in the same folder and I still got sy-subrc = 8. I think I have access privileges as I am able to modify the files manually. This means that I have access privileges right? Can there be any other reason that this is happening?
Thanks and Regards,
Smitha
2007 Sep 12 5:55 AM
Hi Smitha,
Manually is altogether different. Accessing a folder programmatically has certain steps/process which wont be there while accessing manually.
Check with BASIS team whether you have read/write access to the folder.
Best regards,
Prashant
2007 Sep 12 6:06 AM
Hello Prashanth,
Thank you for letting me know this. I will check with the basis team.
Regards,
Smitha
2007 Sep 12 6:05 AM
Hi Smitha..
Generally File Open will be failed in two cases.
1) When the File does not exist (the Path may be wrong etc.)
2)When the authorization fails.
To check the Authorization call the FM
AUTHORITY_CHECK_DATASET before the OPEN DATASET
This will give the status whether you have authorization..
reward if Helpful.
2007 Sep 12 6:35 AM
Hello Varma,
I used the FM you have given. In both the cases the FM returned sy-subrc = 0 for both read and write activity. Does this mean that I have proper privileges to open the dataset? Then why am I still getting sy-subrc = 8 when I open the dataset for outpu? The rechecked the path I have given and it is right.
Thanks and Regards,
Smitha
2007 Sep 12 6:51 AM
Hello,
I observed something now. In the path I am trying to access i.e.
Wxyzf001\interfaces\BCD\EFG_XYZ\OUT\ZCANA_PB_CC_DTB_TEST.txt, I don't have write permission to the folder BCD, but, I have the permission for the next folder i.e. EFG_XYZ. Will this affect the code in any way?
Thanks and Regards,
Smitha
2007 Sep 12 7:06 AM
Hi,
I think it will affect. You need to atleast have read access to BCD folder.
BEst regards,
Prashant
2007 Sep 19 9:30 AM
HI SMITHA
first you test the file is uploading or not.next that folder place change it means dont put the folder in folder.
first tha is working or not check it
2014 Jan 13 12:47 PM
Go to the AL11, select your folder where you try to save a file, then click Attribute.
I had to change the mode from 600 to 770 and problem has been resolved. Communicate with your Basis team.
2014 May 05 3:44 PM
Hi ALL,
I was facing the same issue.
Then I converted parameter like this.
PARAMETERS: filename(200) TYPE c DEFAULT '/tmp/test1.xml' LOWER CASE.
So, open dataset was able to find the file.
Thank you.
Bing
2016 Oct 03 12:19 PM
Hi All,
Similar problem i also faced.
Then i used TRANSLATE destination TO LOWER CASE
before OPEN DATASET.
It solved the problem.
Thanks Meet for the solution.
Regards,
Pulkit
2016 Oct 03 1:21 PM
hi,
Mostly in two case you will be getting the sy-subrc = 8 . Please check the below two test case .
Case 1 : Check the authorization for the user , if he got permission to read/write to the application server, and same for the presentation server from where the user is trying to write . (Both side authorization should be there ) .
Case2: Check the destination is correct, and in proper case . Open the directory from your user manually .
Regards,
Amaresh