Application Development 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: 

Open dataset for output - sy-subrc = 8.

Former Member
0 Kudos
14,566

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

13 REPLIES 13

former_member223537
Active Contributor
0 Kudos
1,693

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.

0 Kudos
1,693

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

former_member223537
Active Contributor
0 Kudos
1,693

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

0 Kudos
1,693

Hello Prashanth,

Thank you for letting me know this. I will check with the basis team.

Regards,

Smitha

varma_narayana
Active Contributor
0 Kudos
1,693

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.

0 Kudos
1,693

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

0 Kudos
1,693

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

former_member223537
Active Contributor
0 Kudos
1,693

Hi,

I think it will affect. You need to atleast have read access to BCD folder.

BEst regards,

Prashant

0 Kudos
1,693

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

nbys
Explorer
0 Kudos
1,693

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.

Former Member
0 Kudos
1,693

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

0 Kudos
1,693

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

0 Kudos
1,693

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