Skip to Content
avatar image
Former Member

CSV -> Internal table -> CVS

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Aug 20, 2007 at 12:26 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 07:23 AM

    Hi,

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

    Regards,

    Hk.

    Add comment
    10|10000 characters needed characters exceeded