‎2008 Mar 31 1:42 PM
hi,
how to read the second line of file placed in application server in to the internal table
‎2008 Mar 31 1:45 PM
hi,
Read the entire file into an in internal table and use statement..
READ TABLE ITAB INDEX 2. Regards,
Santosh
‎2008 Mar 31 1:46 PM
* To get the data from application server file
OPEN DATASET p_filename IN TEXT MODE FOR INPUT ENCODING DEFAULT.
IF sy-subrc <> 0.
MESSAGE e001 WITH p_filename.
ENDIF.
CLEAR: wa_local.
DO.
READ DATASET p_filename INTO wa_local.
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND wa_local TO p_local_table.
CLEAR: wa_local.
ENDDO.
CLOSE DATASET p_filename.
To read the second recode:
DO.
IF sy-tabix EQ 2.
READ DATASET p_filename INTO wa_local.
IF sy-subrc 0.
EXIT.
ENDIF.
APPEND wa_local TO p_local_table.
CLEAR: wa_local.
ENDIF.
ENDDO.
‎2008 Mar 31 1:46 PM
‎2008 Mar 31 1:48 PM
Hi,
Try like this.
DO.
READ DATASET file INTO line.
IF sy-index = 2.
lv_line = line.
EXIT.
ENDIF.
ENDDO.
‎2008 Mar 31 1:53 PM
Hi,
Please use the following code.
*Open the File in READ mode
open dataset <filename> for input in text mode encoding default.
Read the File.
read dataset <filename> to it_data.
if sy-subrc eq 0.
append it_data.
clear it_data.
endif.
Close the File
close dataset <filename>.