Skip to Content
0
Former Member
Sep 07, 2009 at 04:45 PM

OPEN DATASET for CSV files

3330 Views

Hi all!

I'm using OPEN DATASET to read CSV files (created using Excel 2007), that contain multiple lines, the problem is when I use READ DATASET it transfers the hole content of the CSV file into the variable instead of transfering line by line.

The source code is the following:

data: lv_lines type string.

open dataset x_file for input
  in text mode
  encoding default.
if sy-subrc eq 0.
  do.
    clear lv_lines.
    read dataset x_file into lv_lines.
    if sy-subrc eq 0.
      append lv_lines to y_outtab.
    else.
      exit.
    endif.
  enddo.
else.
  message e001(ztim_fi)
    with x_file
    raising general_fault.
endif.

close dataset x_file.

Can anyone help me with this?

Kind regards,

Mário Espinheira