Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

CSV -> Internal table -> CVS

Former Member
0 Kudos

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

2 REPLIES 2

Former Member
0 Kudos

Hi,

Just create a simple text file with you colums separated by ';'.

Then save it either on the server or on a local machine.

To create the file, use

OPEN DATASET dsn FOR INPUT. "(to open the file)

TRANSFER line TO dsn. "(to write into the file)

CLOSE DATASET dsn. "(to close the file)

Hope that will help.

Regards,

Yann

Former Member
0 Kudos

Hi,

Use "GUI_DOWNLOAD" function module to download the internal table data to your CSV file.

Regards,

Hk.