11-29-2007 7:26 AM
Friends,
I am getting dump while using open dataset. I using open dataset filename in text mode encoding default. But its showing dump that file is already opened.
What could be the reason????/
Thanks,
Prashant
11-29-2007 7:30 AM
Hi,
Go to AL11 and open your file and copy the path of the file, dont make any change like letters from upper case to lower and vice versa in the file name. And use the same in the statement of open dataset.
Cheers,
Bujji
11-29-2007 7:31 AM
check if u are opening the same file multiple times, if yes call CLOSE_DATASET after first one.
Also u can use try--catch block to have a soft termination.
try.
open dataset < >
< processing here>
catch CX_SY_FILE_OPEN.
< message handling here>
endtry.
11-29-2007 7:33 AM
at a time only one data set open.
chk u open dataset syntex.close the dataset.
Catchable Exceptions
CX_SY_FILE_OPEN
Cause: File is already open (only in Unicode programs)
Runtime Error: DATASET_REOPEN
DATA: file TYPE string VALUE `test.dat`,
result TYPE string.
OPEN DATASET file FOR OUTPUT IN TEXT MODE
ENCODING DEFAULT
WITH SMART LINEFEED.
TRANSFER `1234567890` TO file.
CLOSE DATASET file.
OPEN DATASET file FOR UPDATE IN TEXT MODE
ENCODING DEFAULT
WITH SMART LINEFEED
AT POSITION 2.
TRANSFER `ABCD` TO file.
CLOSE DATASET file.
OPEN DATASET file FOR INPUT IN TEXT MODE
ENCODING DEFAULT
WITH SMART LINEFEED.
WHILE sy-subrc = 0.
READ DATASET file INTO result.
WRITE / result.
ENDWHILE.
CLOSE DATASET file.
INCLUDE ABAPOPEN_DATASET_ENCODING OBJECT DOKU ID SD
INCLUDE ABAPOPEN_DATASET_LINEFEED OBJECT DOKU ID SD
11-29-2007 7:38 AM
Hi ,
You might have opened the file (ex: notepad if text file) outside. Check it. If so close it and execute the program. If still problem exist, try to use CLOSE DATASET before OPEN DATASET.
Hope sytanx is written as OPEN DATASET filename FOR INPUT IN TEXT MODE.
12-31-2007 11:51 AM
Hi,
If the R/3 System is ruining under UNIX, If sy-subrc is 8.
The system cannot open the file, since the name you specified is that of a directory.
So check the path.
Regards
Vadivelan B
12-31-2007 12:03 PM
Hi Prasanth,
I will send a sample code for that.Just check it once ok..
code:
&----
*& Report YBDC_DATASETS_INPUT_AL11 *
*& *
&----
*& DEVELOPER : KIRAN KUMAR.G *
*& PURPOSE : FETCHING DATA FROM THE APPLICATION SERVER AND DISPLAY *
*& CREATION DT: 30/11/2007 *
*& REQUEST : ERPK900035 *
&----
REPORT YBDC_DATASETS_INPUT_AL11.
----
Internal Table
----
DATA: BEGIN OF gt_data OCCURS 0,
text(50),
END OF gt_data.
----
OPEN THE DATASET
----
OPEN DATASET 'ZBDCDEMO' FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
DO.
READ DATA FROM THE DATASET(APPSERVER) AND PLACE THEM IN Internal Table
CLEAR : gt_data. "Clear Header Line
READ DATASET 'ZBDCDEMO' INTO gt_data.
IF sy-subrc = 0.
APPEND gt_data.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDIF.
----
Display the Data
----
LOOP AT gt_data.
WRITE: / gt_data-text.
ENDLOOP.
----
Display the Data
----
CLOSE DATASET 'ZBDCDEMO'.
Award points if helpful.
Kiran Kumar.G
Have a Nice Day..