<?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: Read CSV file into internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-csv-file-into-internal-table/m-p/1288275#M154550</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Use First&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;replace all the """ with an empty string&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;then  use &amp;lt;b&amp;gt;Condense with no-gaps&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;Then &amp;lt;b&amp;gt;split str at ',' into table itab&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;It will be solve ur problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;vinod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Mar 2006 09:04:01 GMT</pubDate>
    <dc:creator>vinod_gunaware2</dc:creator>
    <dc:date>2006-03-29T09:04:01Z</dc:date>
    <item>
      <title>Read CSV file into internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-csv-file-into-internal-table/m-p/1288270#M154545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a CSV file with one of the line&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"abc","aaa,ab",10,"bbc"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At first, I used&lt;/P&gt;&lt;P&gt;split str at ',' into table itab&lt;/P&gt;&lt;P&gt;and then&lt;/P&gt;&lt;P&gt;replace all the """ with an empty string&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But obviously that my case will be failed as one of the field contains "," in its content.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to ask where there is some functions in SAP can can read a CSV file into internal table. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 08:40:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-csv-file-into-internal-table/m-p/1288270#M154545</guid>
      <dc:creator>former_member220801</dc:creator>
      <dc:date>2006-03-29T08:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Read CSV file into internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-csv-file-into-internal-table/m-p/1288271#M154546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; chk this FM KCD_CSV_FILE_TO_INTERN_CONVERT&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 08:44:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-csv-file-into-internal-table/m-p/1288271#M154546</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-29T08:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: Read CSV file into internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-csv-file-into-internal-table/m-p/1288272#M154547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try fm TEXT_CONVERT_CSV_TO_SAP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway it should be better you re-format your csv file by excel to delete ".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 08:45:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-csv-file-into-internal-table/m-p/1288272#M154547</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-29T08:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: Read CSV file into internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-csv-file-into-internal-table/m-p/1288273#M154548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Gundam,&lt;/P&gt;&lt;P&gt; you can do something like this..&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: BEGIN OF itab OCCURS 0,
        vbeln LIKE vbak-vbeln,
        ernam LIKE vbak-ernam,
      END OF itab.
 
DATA itab2 LIKE TABLE OF KCDE_CELLS WITH HEADER LINE.
 
CALL FUNCTION 'KCD_CSV_FILE_TO_INTERN_CONVERT'
  EXPORTING
    i_filename            = 'D:dataupl.txt'
    i_separator           = ','
  tables
    e_intern              = itab2
* EXCEPTIONS
*   UPLOAD_CSV            = 1
*   UPLOAD_FILETYPE       = 2
*   OTHERS                = 3
          .
IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
 
LOOP AT itab2.
  SPLIT itab2-value AT ',' INTO itab-vbeln itab-ernam.
  APPEND itab.
  CLEAR itab.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;satesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 08:45:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-csv-file-into-internal-table/m-p/1288273#M154548</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-29T08:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: Read CSV file into internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-csv-file-into-internal-table/m-p/1288274#M154549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use this FM &amp;lt;b&amp;gt;KCD_CSV_FILE_TO_INTERN_CONVERT&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;and get the CSV data to Intenal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 08:47:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-csv-file-into-internal-table/m-p/1288274#M154549</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-29T08:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: Read CSV file into internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-csv-file-into-internal-table/m-p/1288275#M154550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Use First&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;replace all the """ with an empty string&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;then  use &amp;lt;b&amp;gt;Condense with no-gaps&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;Then &amp;lt;b&amp;gt;split str at ',' into table itab&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;It will be solve ur problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;vinod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 09:04:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-csv-file-into-internal-table/m-p/1288275#M154550</guid>
      <dc:creator>vinod_gunaware2</dc:creator>
      <dc:date>2006-03-29T09:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Read CSV file into internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-csv-file-into-internal-table/m-p/1288276#M154551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;KCD_CSV_FILE_TO_INTERN_CONVERT seems only work for local file. &lt;/P&gt;&lt;P&gt;(1)But what if my file is from application server?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My expect output for the line in CSV&lt;/P&gt;&lt;P&gt;"abc","aaa,ab",10,"bbc"&lt;/P&gt;&lt;P&gt;=&amp;gt;&lt;/P&gt;&lt;P&gt;abc&lt;/P&gt;&lt;P&gt;aaa,ab&lt;/P&gt;&lt;P&gt;10&lt;/P&gt;&lt;P&gt;bbc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(2)for FM KCD_CSV_FILE_TO_INTERN_CONVERT, it seems to have some problem for the last field.&lt;/P&gt;&lt;P&gt;the result becomes&lt;/P&gt;&lt;P&gt;abc&lt;/P&gt;&lt;P&gt;aaa,ab&lt;/P&gt;&lt;P&gt;10&lt;/P&gt;&lt;P&gt;"bbc"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 09:15:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-csv-file-into-internal-table/m-p/1288276#M154551</guid>
      <dc:creator>former_member220801</dc:creator>
      <dc:date>2006-03-29T09:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: Read CSV file into internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-csv-file-into-internal-table/m-p/1288277#M154552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think your CSV file is not correctly generated because there're , and " as separator.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you should split your file twice: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you have: "abc","aaa,ab",10,"bbc"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REFRESH ITAB.&lt;/P&gt;&lt;P&gt;SPLIT WA AT """ INTO TABLE ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now ITAB should be filled in this way:&lt;/P&gt;&lt;P&gt;record 1: abc&lt;/P&gt;&lt;P&gt;record 2: ,&lt;/P&gt;&lt;P&gt;record 3: aaa,ab&lt;/P&gt;&lt;P&gt;record 4: ,10,&lt;/P&gt;&lt;P&gt;record 5: bbc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you try to do something like fallowing code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;CONDENSE ITAB-FIELD NO-GAPS.&lt;/P&gt;&lt;P&gt;IF ITAB-FIELD = ','.&lt;/P&gt;&lt;P&gt;  DELETE ITAB.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;DO.&lt;/P&gt;&lt;P&gt;REPLACE ',' WITH SPACE INTO ITAB-FIELD.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC &amp;lt;&amp;gt; 0. EXIT. ENDIF.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;CONDENSE ITAB-FIELD NO-GAPS.&lt;/P&gt;&lt;P&gt;MODIFY ITAB.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 09:27:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-csv-file-into-internal-table/m-p/1288277#M154552</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-29T09:27:10Z</dc:date>
    </item>
  </channel>
</rss>

