<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unicode Convertible error - Copying Internal Table into Permanent table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/unicode-convertible-error-copying-internal-table-into-permanent-table/m-p/8557753#M1658811</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;CDAT has to be defined exactly the same as the database table. Use the structure in the definition, not the individual fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Feb 2012 21:32:59 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2012-02-22T21:32:59Z</dc:date>
    <item>
      <title>Unicode Convertible error - Copying Internal Table into Permanent table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unicode-convertible-error-copying-internal-table-into-permanent-table/m-p/8557747#M1658805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The below ABAP attempts to:&lt;/P&gt;&lt;P&gt;1) Extract data from a .CSV file and place it into an internal table.&lt;/P&gt;&lt;P&gt;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.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code I have is below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"----&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------" /&gt;&lt;P&gt;REPORT  Z_MYTESTPROGRAM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;" Types declarations:&lt;/P&gt;&lt;P&gt;"Columns:&lt;/P&gt;&lt;P&gt;types: begin of ttab,&lt;/P&gt;&lt;P&gt;       REC(1000) type c,&lt;/P&gt;&lt;P&gt;       end of ttab.&lt;/P&gt;&lt;P&gt;"Rows:&lt;/P&gt;&lt;P&gt;types: begin of tdat,&lt;/P&gt;&lt;P&gt;       TEST(20) type c,&lt;/P&gt;&lt;P&gt;       LAST_NAME(20) type c,&lt;/P&gt;&lt;P&gt;       LANG(1) type c,&lt;/P&gt;&lt;P&gt;       INDEXCODE(10) TYPE c,&lt;/P&gt;&lt;P&gt;       end of tdat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;" Data declarations:&lt;/P&gt;&lt;P&gt;data: itab type table of ttab with header line.&lt;/P&gt;&lt;P&gt;data: idat type table of tdat with header line.&lt;/P&gt;&lt;P&gt;data: file_str type string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;" FILE PATH:&lt;/P&gt;&lt;P&gt;file_str = 'C:\TempCSVFile.csv'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;" Run code to import from Comma-delim file:&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'GUI_UPLOAD'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    filename                = file_str&lt;/P&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;    data_tab                = itab&lt;/P&gt;&lt;P&gt;  EXCEPTIONS&lt;/P&gt;&lt;P&gt;    others                  = 17.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;" Populate temporary (internal) table idat:&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;  clear idat.&lt;/P&gt;&lt;P&gt;  split itab-REC at ',' into&lt;/P&gt;&lt;P&gt;                             idat-TEST&lt;/P&gt;&lt;P&gt;                             idat-LAST_NAME&lt;/P&gt;&lt;P&gt;                             idat-LANG&lt;/P&gt;&lt;P&gt;                             idat-INDEXCODE.&lt;/P&gt;&lt;P&gt;  append idat.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;" Now populate permanent table with data from temporary table:&lt;/P&gt;&lt;P&gt;insert ZMM_FIRST_TABLE from table idat. " &amp;lt;- This is the row where the Unicode convertible error get's reported.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error I get when a field is an integer is:&lt;/P&gt;&lt;P&gt;"The type of the database table and work area (or internal table) "IDAT" are not Unicode convertible."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;""INDEXCODE" must be a character-type data object (data type C, N, D, T or STRING)." &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has anyone else come across this? Can anyone think of how I can resolve this problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Andy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 20:27:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unicode-convertible-error-copying-internal-table-into-permanent-table/m-p/8557747#M1658805</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-22T20:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Unicode Convertible error - Copying Internal Table into Permanent table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unicode-convertible-error-copying-internal-table-into-permanent-table/m-p/8557748#M1658806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 20:41:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unicode-convertible-error-copying-internal-table-into-permanent-table/m-p/8557748#M1658806</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-22T20:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Unicode Convertible error - Copying Internal Table into Permanent table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unicode-convertible-error-copying-internal-table-into-permanent-table/m-p/8557749#M1658807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you be able to provide a sample of the code to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Andy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 20:46:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unicode-convertible-error-copying-internal-table-into-permanent-table/m-p/8557749#M1658807</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-22T20:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: Unicode Convertible error - Copying Internal Table into Permanent table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unicode-convertible-error-copying-internal-table-into-permanent-table/m-p/8557750#M1658808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please try it yourself and get back to the forum if you have a specific problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 20:49:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unicode-convertible-error-copying-internal-table-into-permanent-table/m-p/8557750#M1658808</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-22T20:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: Unicode Convertible error - Copying Internal Table into Permanent table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unicode-convertible-error-copying-internal-table-into-permanent-table/m-p/8557751#M1658809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok Rob, I think this is how it's done. I've tagged the following code onto the end of my code. I still however get the same error message (the one about Unicode conversion). Am I transferring the data structure, and changing the field type correctly below?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF cdat occurs 0,&lt;/P&gt;&lt;P&gt;        TESTB(20) TYPE c,&lt;/P&gt;&lt;P&gt;        LAST_NAMEB(20) TYPE c,&lt;/P&gt;&lt;P&gt;        LANGB(4) TYPE c,&lt;/P&gt;&lt;P&gt;        INDEXCODEB TYPE I,&lt;/P&gt;&lt;P&gt;      END OF cdat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MOVE-CORRESPONDING idat TO cdat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;" Now populate permanent table with data from temporary table:&lt;/P&gt;&lt;P&gt;insert ZMM_FIRST_TABLE from table cdat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers, - Andy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 21:06:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unicode-convertible-error-copying-internal-table-into-permanent-table/m-p/8557751#M1658809</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-22T21:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: Unicode Convertible error - Copying Internal Table into Permanent table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unicode-convertible-error-copying-internal-table-into-permanent-table/m-p/8557752#M1658810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And the error I get is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The type of the database table and work area (or internal table) "CDAT" are not Unicode convertible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Therefore the transfer is happening from IDAT to CDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 21:30:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unicode-convertible-error-copying-internal-table-into-permanent-table/m-p/8557752#M1658810</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-22T21:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Unicode Convertible error - Copying Internal Table into Permanent table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unicode-convertible-error-copying-internal-table-into-permanent-table/m-p/8557753#M1658811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;CDAT has to be defined exactly the same as the database table. Use the structure in the definition, not the individual fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 21:32:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unicode-convertible-error-copying-internal-table-into-permanent-table/m-p/8557753#M1658811</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-22T21:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Unicode Convertible error - Copying Internal Table into Permanent table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unicode-convertible-error-copying-internal-table-into-permanent-table/m-p/8557754#M1658812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All I can say is Pure Genius! It all works fine now!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For everyone's information, below is the (working) code that I tagged onto the bottom of my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF cdat occurs 0.&lt;/P&gt;&lt;P&gt;  INCLUDE STRUCTURE ZMM_FIRST_TABLE.&lt;/P&gt;&lt;P&gt;DATA END OF cdat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at idat.&lt;/P&gt;&lt;P&gt;MOVE-CORRESPONDING idat TO cdat.&lt;/P&gt;&lt;P&gt;append cdat.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;delete from ZMM_FIRST_TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;" Now populate permanent table with data from temporary table:&lt;/P&gt;&lt;P&gt;insert ZMM_FIRST_TABLE from table cdat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks very much for your help Rob! &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Andy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 22:15:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unicode-convertible-error-copying-internal-table-into-permanent-table/m-p/8557754#M1658812</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-22T22:15:19Z</dc:date>
    </item>
  </channel>
</rss>

