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

Open dataset error code 8

Former Member
0 Likes
5,602

Hello,

I am getting sy-subrc = 8 when i try to open a dataset.

The problem is i have two files to read.

For the one of them it works fine but not for the other and i get that error code.

This is my code:

OPEN DATASET Z_FIC FOR INPUT IN TEXT MODE.

IF SY-SUBRC EQ 0.

.

.

ENDIF.

Thanks for your help.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,058

OPEN DATASET sets SY-SUBRC to 0 if the file could be opened, otherwise to 8.

Search forum before asking basic Questions

9 REPLIES 9
Read only

Former Member
0 Likes
3,059

OPEN DATASET sets SY-SUBRC to 0 if the file could be opened, otherwise to 8.

Search forum before asking basic Questions

Read only

0 Likes
3,058

thanks, but i want to know why the program is reading my first file and not the second.

do you have a clue?

Read only

0 Likes
3,058

We can't tell you that, especially since you haven't posted much code. Use the command to retrieve the message from the operating system (see the help), check the file access, check your file name/existence of the file, etc...

Read only

0 Likes
3,058

but i want to know why the program is reading my first file and not the second

Without your code&logic written its impossible to give a clue.

Read only

0 Likes
3,058

FORM OUVERTURE_FICHIER_LECTURE USING Z_FIC LIKE V_FICHIER

CHANGING R_STATUS.

R_STATUS = '0'.

V_FIC_ORIG = Z_FIC.

OPEN DATASET Z_FIC FOR INPUT IN TEXT MODE.

IF SY-SUBRC EQ 0.

  • MODIF_EL170399 début : Mode exploitation , recherche du fic orig.

READ DATASET Z_FIC INTO V_FIC_ORIG. " Nom original du fichier

IF NOT V_FIC_ORIG CS 'v_fic_orig='.

V_FIC_ORIG = Z_FIC .

CLOSE DATASET Z_FIC .

OPEN DATASET Z_FIC FOR INPUT IN TEXT MODE.

ENDIF.

  • MODIF_EL170399 Fin

IF SY-BATCH EQ 'X'.

  • Ouverture du fichier en lecture : &

MESSAGE I010(ZZ) WITH V_FIC_ORIG. " z_fic. MODIF_EL230399

ENDIF.

ELSE.

R_STATUS = SY-SUBRC. " MODIF_EL220399

  • Erreur d'ouverture du fichier : & - Sy-subrc = &

  • message e004(zz) with z_fic sy-subrc. " MODIF_EL220399

ENDIF.

*

ENDFORM. " OUVERTURE_FICHIER_LECTURE

Read only

0 Likes
3,058

Its hard to tell you a solution directly, it seems that Z_FIC is declared globally.

A proper debugging will solve the problem, do it step by step and find where the problem is.

Read only

0 Likes
3,058

It may be that the operating system cannot close and then open as quickly as you can do it in ABAP.

Rather than doing it this way, why not see if v_fic contains the string 'v_fic_orig=' and based on that, determine how to open the dataset and just do it once.

Rob

Read only

anesh_kumar
Active Participant
0 Likes
3,058

hi

GO THROUGH THE BELOW LINK

Regards

Read only

Former Member
0 Likes
3,058

Hi,

I'm also facing same kind of issue..

i checked all the suggested ways.. but still getting the value of SY-SUBRC is 8..

Operating system is Sun OS.. its working fine in dev and prd ..

issue is only with quality..

Kindly let me know your ideas to fix this..

Thanks,

Prakash