Skip to Content
avatar image
Former Member

Unicode Convertible error - Copying Internal Table into Permanent table

Hi experts!

I'm stuck on a big problem here, which I'm hoping someone can help with. I'm a bit of a newbie at ABAP.

The below ABAP attempts to:

1) Extract data from a .CSV file and place it into an internal table.

2) Then the contents of the internal table are copied into a permanent database table. (Don't worry about advance deletions in the permanent table, I've already got that covered.)

The above ABAP works fine if all the fields in the permanent table have the data type CHAR or LANG. However I run into a major problem if a field in the permanent table is INT4 (Integer). Unfortunately I can't change the data types in the permanent table, so I'm stuck with trying to import into an integer field.

The code I have is below.



" Types declarations:


types: begin of ttab,

REC(1000) type c,

end of ttab.


types: begin of tdat,

TEST(20) type c,

LAST_NAME(20) type c,

LANG(1) type c,


end of tdat.

" Data declarations:

data: itab type table of ttab with header line.

data: idat type table of tdat with header line.

data: file_str type string.


file_str = 'C:\TempCSVFile.csv'.

" Run code to import from Comma-delim file:



filename = file_str


data_tab = itab


others = 17.

" Populate temporary (internal) table idat:

loop at itab.

clear idat.

split itab-REC at ',' into





append idat.


" Now populate permanent table with data from temporary table:

insert ZMM_FIRST_TABLE from table idat. " <- This is the row where the Unicode convertible error get's reported.


The error I get when a field is an integer is:

"The type of the database table and work area (or internal table) "IDAT" are not Unicode convertible."

The field that has the problem is the INDEXCODE field and it only occurs when that field becomes an integer-type field in the permanent table. I have also tried changing the data type in the ABAP of to INDEXCODE TYPE I, but then I get an error message

""INDEXCODE" must be a character-type data object (data type C, N, D, T or STRING)."

Basically SAP's not letting me change the data type to an integer in the Types declaration, yet at the same time it's looking for an Integer data type. - Big clash.

Has anyone else come across this? Can anyone think of how I can resolve this problem?


- Andy

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Feb 22, 2012 at 08:41 PM

    Simply handle the integer separately. You can use the character structure for reading and parsing the file, but then move the values to a different structure/table that has the same type as the database table.


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Rob!

      All I can say is Pure Genius! It all works fine now!

      For everyone's information, below is the (working) code that I tagged onto the bottom of my code:

      DATA: BEGIN OF cdat occurs 0.


      DATA END OF cdat.

      loop at idat.

      MOVE-CORRESPONDING idat TO cdat.

      append cdat.


      delete from ZMM_FIRST_TABLE.

      " Now populate permanent table with data from temporary table:

      insert ZMM_FIRST_TABLE from table cdat.

      Thanks very much for your help Rob! 😊

      - Andy