2010 Sep 07 4:01 PM
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.
2010 Sep 07 4:08 PM
OPEN DATASET sets SY-SUBRC to 0 if the file could be opened, otherwise to 8.
Search forum before asking basic Questions
2010 Sep 07 4:08 PM
OPEN DATASET sets SY-SUBRC to 0 if the file could be opened, otherwise to 8.
Search forum before asking basic Questions
2010 Sep 07 4:12 PM
thanks, but i want to know why the program is reading my first file and not the second.
do you have a clue?
2010 Sep 07 4:24 PM
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...
2010 Sep 07 4:26 PM
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.
2010 Sep 07 4:33 PM
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
2010 Sep 07 4:37 PM
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.
2010 Sep 07 4:44 PM
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
2010 Sep 07 4:40 PM
2013 Nov 01 5:27 AM
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