‎2007 Oct 17 4:30 PM
Hi All,
I am getting a short dump when I try "READ DATASET g_unixfile INTO internal-table." to read a file into an internal table.
I have opened the file using th code>>"OPEN DATASET g_unixfile FOR INPUT IN TEXT MODE ENCODING DEFAULT."
and closed it using>>"CLOSE DATASET g_unixfile."
I have used the G_unixfile as 104 Characters and internal table as:
DATA: BEGIN OF g_t_tdata OCCURS 50,
g_recdata(104),
END OF g_t_tdata.
Please can anyone tell why I am getting a Dump?? at Read dataset??
Regards,
Shashank.
‎2007 Oct 17 4:34 PM
Can you see what is the SY_SUBRC value returned after OPEN DATASET.
That might be 4 and because of this READ is failing.
Also make sure that file exists at the specified location.
ashish
‎2007 Oct 17 4:35 PM
hi,
Try increasing the size of the field of Internal table to fit the data in the file. So just check it out in this way
DATA: BEGIN OF g_t_tdata OCCURS 50,
g_recdata<b>(2000)</b>,
END OF g_t_tdata.
‎2007 Oct 17 4:35 PM
‎2007 Oct 17 4:38 PM
Hi Atish,
This is whole MAIN code.
Its syntatically correct but giving dump....on execution.
CODE>>
DATA: g_eventid LIKE tbtco-eventid,
g_eventparm LIKE tbtcm-eventparm.
DATA: g_file(30).
DATA: g_file1(10).
****Changes made later******
DATA: g_unixfile(104) TYPE c, " Unix File Name
g_unixfile1(104) TYPE c,
g_old_filename TYPE string,
g_new_unixfilename(80),
g_zzadirect LIKE filename-pathintern.
DATA: BEGIN OF g_t_tdata OCCURS 50, " Upload data into this itab
g_recdata(104),
END OF g_t_tdata.
****Changes made later******
Selection screen>>
PARAMETERS : p_direct LIKE filepath-pathintern OBLIGATORY DEFAULT 'ZIN_COMPLETE'." Unix Directory
PARAMETERS :p_filenm LIKE t9aif-zzafilenam OBLIGATORY DEFAULT 'AFS.FNBLOD.4310.DATE.TIME'. " File Name
*************CONSTANTS
CONSTANTS : c_zzaibfform(2) VALUE 'LA'.
**********START-OF-SELECTION****************
START-OF-SELECTION.
g_file = p_filenm.
g_file1 = g_file+11(4).
****Changes made later******
SELECT SINGLE zzadirect INTO g_zzadirect
FROM t9aig
WHERE zzaibfform EQ c_zzaibfform.
IF sy-subrc = 0.
MOVE p_filenm TO g_old_filename.
CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
EXPORTING
logical_path = g_zzadirect
file_name = g_old_filename
IMPORTING
file_name_with_path = g_unixfile
EXCEPTIONS
path_not_found = 1
missing_parameter = 2
operating_system_not_found = 3
file_system_not_found = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
OPEN DATASET g_unixfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
MESSAGE e099 WITH text-011.
ENDIF.
CONCATENATE 'AFS.FNBPFI.' g_file1 '.LOAD.TXT' INTO g_new_unixfilename.
CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
EXPORTING
logical_path = g_zzadirect
file_name = g_new_unixfilename
IMPORTING
file_name_with_path = g_unixfile1
EXCEPTIONS
path_not_found = 1
missing_parameter = 2
operating_system_not_found = 3
file_system_not_found = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Open the data files.
OPEN DATASET g_unixfile1 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
MESSAGE e099 WITH text-012.
ENDIF.
Extract the data from input data file and store in to new data file
DO.
READ DATASET g_unixfile INTO g_t_tdata-g_recdata.
IF sy-subrc <> 0.
EXIT.
ENDIF.
TRANSFER g_t_tdata-g_recdata TO g_unixfile1.
ENDDO.
CLOSE DATASET g_unixfile.
CLOSE DATASET g_unixfile1.
‎2007 Oct 17 4:44 PM
Hi,
Try by increasing field length
DATA: BEGIN OF g_t_tdata OCCURS 50, " Upload data into this itab
g_recdata(2000),
END OF g_t_tdata.
Regards,
Atish
‎2007 Oct 17 4:51 PM
‎2007 Oct 17 4:51 PM
‎2007 Oct 17 5:21 PM
Hi Shashank,
Can you remove ENCODING DEFAULT and try.
Regards,
Atish