<?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: CSV file into SAP in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/csv-file-into-sap/m-p/6138853#M1366628</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, maybe split the line into workfields, fill the table with the workfields and append the line. Succes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Sep 2009 08:13:42 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-09-10T08:13:42Z</dc:date>
    <item>
      <title>CSV file into SAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/csv-file-into-sap/m-p/6138852#M1366627</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 am trying to upload CSV file into SAP it is working fine, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;File format:&lt;/P&gt;&lt;P&gt;Test,12333,"Reg. Organisational Development Delegate, TEST TEST, HFHFHFHF, JKSDFAS ",7373737&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem:&lt;/P&gt;&lt;P&gt;When i am trying to SPLIT with ',' it is taking 3 column "Reg. Organisational Development Delegate, TEST TEST, HFHFHFHF, JKSDFAS" into diff-diff columns but my requirement is i want file data into 4 fields of internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rajneesh Gupta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2009 08:09:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/csv-file-into-sap/m-p/6138852#M1366627</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-10T08:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: CSV file into SAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/csv-file-into-sap/m-p/6138853#M1366628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, maybe split the line into workfields, fill the table with the workfields and append the line. Succes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2009 08:13:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/csv-file-into-sap/m-p/6138853#M1366628</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-10T08:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: CSV file into SAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/csv-file-into-sap/m-p/6138854#M1366629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Test,12333,"Reg. Organisational Development Delegate, TEST TEST, HFHFHFHF, JKSDFAS ",7373737&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you should not give comma inside "Reg. Organisational Development Delegate, TEST TEST, HFHFHFHF, JKSDFAS ", use some other delimiter inside double quotes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Karthik D&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2009 08:18:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/csv-file-into-sap/m-p/6138854#M1366629</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-10T08:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: CSV file into SAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/csv-file-into-sap/m-p/6138855#M1366630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi  Karthik D,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have file in this format only, this i have given a example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rajneesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2009 08:29:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/csv-file-into-sap/m-p/6138855#M1366630</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-10T08:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: CSV file into SAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/csv-file-into-sap/m-p/6138856#M1366631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;First split the file into a string variable.&lt;/P&gt;&lt;P&gt;Concatenate the required fileds and then move it into fieldstring and then append to the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or split first all into six columns ,then concatenate 3, 4, 5 fields into a variable and then populate into 4 columned internal table&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2009 08:39:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/csv-file-into-sap/m-p/6138856#M1366631</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-10T08:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: CSV file into SAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/csv-file-into-sap/m-p/6138857#M1366632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi  Sreesudha Gulla,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are talking about the static solution, but that is not the case, i don't know in which column i will get the situation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rajneesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2009 08:42:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/csv-file-into-sap/m-p/6138857#M1366632</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-10T08:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: CSV file into SAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/csv-file-into-sap/m-p/6138858#M1366633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rajneesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I too had the same problem some months before.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;c the link below. it solved my problem. in mean time i search for my code in prog and send u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1300546"&gt;&lt;/A&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check my code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at gt_raw into  gwa_raw.
    if sy-tabix &amp;gt; 1.
      split gwa_raw at ',' into table gt_string.
      describe table gt_string lines gv_fields.
*   If extra commas: field count higher than actual field count
      if gv_fields &amp;gt; 10.
        perform f_reassemble.
      endif.


      loop at gt_string into gwa_string.
        replace all occurrences of '"' in gwa_string with ''.
        case sy-tabix.
          when 1.
            gwa_cust-cust_code = gwa_string.
          when 2.
            gwa_cust-cust_name = gwa_string.
          when 3.
                      :           
                      :
          when 10.
            gwa_cust-osc_code = gwa_string.
        endcase.
      endloop.
      append gwa_cust to gt_cust.
      clear: gwa_cust.
    endif.
  endloop.

form f_reassemble .
  data: lastpos    type i,
        lastchar   type c,
        currtoken  type sy-tabix,
        nexttoken  type sy-tabix,
        gwa_next   type string.

  loop at gt_string into gwa_string.
    lastpos  = strlen( gwa_string ) - 1.
    lastchar = gwa_string+lastpos(1).
*   field starts with quote but does not end with one =&amp;gt;
*   must merge with the next field
    if gwa_string+0(1) = '"' and lastchar ne '"'.
      currtoken = sy-tabix.
      nexttoken = sy-tabix + 1.
      read table gt_string into gwa_next index nexttoken.
      concatenate gwa_string gwa_next into gwa_string separated by ','.
      modify gt_string from gwa_string index currtoken.
      delete gt_string index nexttoken.
    endif.
  endloop.
endform.                    " f_reassemble&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sakthi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: sakthi sri on Sep 10, 2009 5:42 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2009 09:37:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/csv-file-into-sap/m-p/6138858#M1366633</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-10T09:37:25Z</dc:date>
    </item>
  </channel>
</rss>

