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

Read dataset Dump

Former Member
0 Likes
2,454

Hi ,

i want to read file from server and after the read i get sy-subrc = 8.

what can be the problem ?

here is my code.

DATA:
        dsn(500) VALUE '\\ivp08.tlv.sap.corp\DEV_P_Development\EP 6Program Office\r1.txt'.

  CLEAR itab.  REFRESH itab.

* Read the data.
  OPEN DATASET dsn FOR INPUT IN BINARY MODE.
  DO.
    READ DATASET dsn INTO str.
    IF sy-subrc = 0.
      APPEND itab.
    ELSE.
      EXIT.
    ENDIF.
  ENDDO.
  CLOSE DATASET dsn.

Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,696

although you not put the dump information about the error.But it seems you are not authorized to read this file.check the authorization you have, with basis.

10 REPLIES 10
Read only

Former Member
0 Likes
1,697

although you not put the dump information about the error.But it seems you are not authorized to read this file.check the authorization you have, with basis.

Read only

0 Likes
1,696

HI Amit,

i try to Access the file (copy paste from the code ) from strart-> run and the file is opened,

what can be the problem ?

Regards

Read only

0 Likes
1,696

i try to Access the file (copy paste from the code ) from strart-> run and the file is opened,

start > run is the file not in App server? your code for open dataset and all works for file in application server (AL11) only.. if you have file on another FTP server then you need FTP_connect and other FM's.

Read only

former_member156446
Active Contributor
0 Likes
1,696

check the case upper case and lower case... it would be issues generally on the .TXT and .txt both are diff

copy paste the name as it appears on the server address or in AL11.

Translate dsn to Lower case might help

from sap HElp: If the system was able to read data successfully, SY-SUBRC is set to 0. When the end of the file is reached, SY-SUBRC is set to 4. If the file could not be opened, SY-SUBRC is set to 8.

Read only

0 Likes
1,696

Hi J@Y ,

i try to translate like u write and it's not help ,

maybe u have other idea?

Regards

Read only

Former Member
0 Likes
1,696

Hi,

SY-SUBRC = 8 means that .. the file could not be opened.

Check whether the file is present in the server.

It is always safe to have a SY-SUBRC = 0 check after open dataset to avoid... dumps..


open dataset dsn.
if sy-subrc = 0.
...."process
close dataset dsn.
else.

"Throw error message thru coding

Regards

Read only

ThomasZloch
Active Contributor
0 Likes
1,696

Are you sure that path in dsn points to a file on the app server? Is the name 100% correct?

Also, you read into str, but append itab, this will not work.

Thomas

Read only

JP_Barcenas
Product and Topic Expert
Product and Topic Expert
0 Likes
1,696

Hi,

I am sure that if you check the sy-subrc after the OPEN DATASET, you will get a value 8, meaning that the file could not be opened. If you catch the exception you will see why it could not be opened. Read the documentation of OPEN DATASET for exception handling.

Regards,

Juan

Read only

Former Member
0 Likes
1,696

HI SY-SUBRC 8..

then it should be some thing to do with the DSN make sure you are using the same case.. the path DSN is case sensitive.... check in tr. AL11 how are the paths defined.. and get the DSN exactly the same.

If this didnt help then try opening the file using tcode cg3y . if not then might be an authorization issue .

Read only

Former Member
0 Likes
1,696

Hi,

can you send me the dump analysis screen shot.

if the error is different than the above ones.