Skip to Content
0
Former Member
Aug 20, 2007 at 12:19 PM

CSV -> Internal table -> CVS

91 Views

Hi all,

type-pools: KCDE.

data: itab_csv type KCDE_INTERN.

DATA: i_text(9999) TYPE c OCCURS 0.

CONSTANTS c_delimiter(1) TYPE c VALUE ';'.

SELECTION-SCREEN BEGIN OF BLOCK 001.

PARAMETERS: p_file LIKE RLGRAP-FILENAME OBLIGATORY DEFAULT 'c:\temp\EBV\sap_input_without_header.csv'.

SELECTION-SCREEN END OF BLOCK 001.

CALL FUNCTION 'KCD_CSV_FILE_TO_INTERN_CONVERT'

EXPORTING

i_filename = p_file

i_separator = c_delimiter

tables

e_intern = itab_csv

EXCEPTIONS

UPLOAD_CSV = 1

UPLOAD_FILETYPE = 2

OTHERS = 3

.

This part of the coding works nice, all CSV content will be IMPORTED to internal table itab_csv.

Empty cells will be left empty in the internal table as well, so the structure of the itab is: ROW, COLUMN, VALUE.

Now that I have this information, I'm going to modify some of the values and want to EXPORT the modified itab to CSV format again.

Is there an appropriate function module available?

Ciao