hi gurus,
I have a problem regarding OPEN DATA SET.....when user provide blank file....it produce shot dump.....the code i written is given below....file name is blank and path is '/data/intrface/send/'
OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING UTF-8 IGNORING CONVERSION ERRORS.
IF sy-subrc <> 0.
WRITE : /3 'Error opening file, check your file name'.
STOP.
ENDIF.
wc_flag = 'T'.
DO.
CLEAR rec.
READ DATASET p_file INTO rec.
IF wc_flag = 'T'.
wc_rectype = rec(6).
wc_flag = 'F'.
ENDIF.
and i get below Shot dump
Runtime Error DATASET_READ_ERROR
Exception CX_SY_FILE_IO
Occurred on 05/10/2010 at 14:41:10
-
Error occurred while reading file "/data/intrface/send/"
-
What happened?
-
The program "ZSDRB05" had to be terminated because a read error occurred
during data retrieval.
-
What can you do?
-
Print out the error message (using the "Print" function)
and make a note of the actions and input that caused the
error.
To resolve the problem, contact your SAP system administrator.
You can use transaction ST22 (ABAP Dump Analysis) to view and administer
termination messages, especially those beyond their normal deletion
date.
-
Error analysis
-
An exception occurred. This exception will be dealt with in more detail
below. The exception, assigned to the class 'CX_SY_FILE_IO', was not caught,
which
led to a runtime error. The reason for this exception is:
An error occurred while reading file "/data/intrface/send/".
Error text: "Is a directory"
Error code: 21
-
Source code extract
-
000960 CLEAR jtab_srepsn_outrec.
000970 REFRESH jtab_srepsn_outrec.
000980 CLEAR jtab_srepse_outrec.
000990 REFRESH jtab_srepse_outrec.
001000
001010 * D47K9A08E2 +
001020 *AT SELECTION-SCREEN ON so_sernr.
001030 * IF NOT so_sernr IS INITIAL .
001040 * PERFORM validate_serial_number.
001050 * ENDIF.
001060
001070 *AT SELECTION-SCREEN ON BLOCK b8. "OUTPUT.
001080 * PERFORM modify_screen.
001090 * D47K9A08E2 +
001100
001110 START-OF-SELECTION. " D47K9A08E2 +
001120
001130 **start Prashanth
001140 *OPEN DATASET p_file IN TEXT MODE.
001150 OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING UTF-8 IGNORING CON
001160 **end Prashanth
001170 *--- Start Mod # 0001
001180 IF sy-subrc <> 0.
001190 WRITE :/3 'Error opening file, check your file name'.
001200 STOP.
001210 ENDIF.
001220 wc_flag = 'T'.
001230 *--- End Mod # 0001
001240 DO.
001250 CLEAR rec.
-
> READ DATASET p_file INTO rec.
001270 IF wc_flag = 'T'.
001280 wc_rectype = rec(6).
001290 wc_flag = 'F'. "add - 0001
001300 ENDIF.
please resolve the problem