<?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 Upload comma separated data from CSV file to a custom database table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/upload-comma-separated-data-from-csv-file-to-a-custom-database-table/m-p/729051#M34296</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;I am new to ABAP and currently working on an ABAP program that will read data from a comma separated text file and upload to a custom table that i created.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;After referring to loads of videos in youtube and in Sap community sites, i manged to do half of my requirement. &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;The below code reads the csv file using GUI_UPLOAD function into an Internal table called UTAB. UTAB contains data of format 1 - Name,Address, Contact&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;An other Internal table called DTAB is defined that will read the data from UTAB and splits the value using comma (,) and stores the data like this.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;1.Name&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;2.Address&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;3.Contact&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;Now i need to somehow loop through these values in DTAB and store them in my custom table ZCUST_DETAIL.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;Please help me complete the code.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;REPORT ZZ_UPLOAD_GEACACCOUNT.
PARAMETERS: P_FNAME TYPE STRING OBLIGATORY

DATA UTAB TYPE TABLE OF CHAR300.
FIELD-SYMBOLS &amp;lt;FS_UTAB&amp;gt; LIKE LINE OF UTAB.

CALL METHOD CL_GUI_FRONTEND_SERVICES=&amp;gt;GUI_UPLOAD
    EXPORTING
      FILENAME = P_FNAME
    CHANGING
      DATA_TAB = UTAB
    EXCEPTIONS
      FILE_OPEN_ERROR = 1.
IF SY-SUBRC &amp;lt;&amp;gt; 0.
* Implement suitable error handling here
ENDIF.
* EXCEL DATA IS NOW IN UTAB TABLE
DATA DTAB TYPE TABLE OF CHAR100.
FIELD-SYMBOLS &amp;lt;FS_DTAB&amp;gt; LIKE LINE OF DTAB.
LOOP AT UTAB ASSIGNING &amp;lt;FS_UTAB&amp;gt; FROM 2.  
    SPLIT &amp;lt;FS_UTAB&amp;gt; AT ',' INTO TABLE DTAB
ENDLOOP. 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 07 Oct 2018 05:03:42 GMT</pubDate>
    <dc:creator>jayaraj2018</dc:creator>
    <dc:date>2018-10-07T05:03:42Z</dc:date>
    <item>
      <title>Upload comma separated data from CSV file to a custom database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/upload-comma-separated-data-from-csv-file-to-a-custom-database-table/m-p/729051#M34296</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;I am new to ABAP and currently working on an ABAP program that will read data from a comma separated text file and upload to a custom table that i created.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;After referring to loads of videos in youtube and in Sap community sites, i manged to do half of my requirement. &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;The below code reads the csv file using GUI_UPLOAD function into an Internal table called UTAB. UTAB contains data of format 1 - Name,Address, Contact&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;An other Internal table called DTAB is defined that will read the data from UTAB and splits the value using comma (,) and stores the data like this.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;1.Name&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;2.Address&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;3.Contact&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;Now i need to somehow loop through these values in DTAB and store them in my custom table ZCUST_DETAIL.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;Please help me complete the code.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;REPORT ZZ_UPLOAD_GEACACCOUNT.
PARAMETERS: P_FNAME TYPE STRING OBLIGATORY

DATA UTAB TYPE TABLE OF CHAR300.
FIELD-SYMBOLS &amp;lt;FS_UTAB&amp;gt; LIKE LINE OF UTAB.

CALL METHOD CL_GUI_FRONTEND_SERVICES=&amp;gt;GUI_UPLOAD
    EXPORTING
      FILENAME = P_FNAME
    CHANGING
      DATA_TAB = UTAB
    EXCEPTIONS
      FILE_OPEN_ERROR = 1.
IF SY-SUBRC &amp;lt;&amp;gt; 0.
* Implement suitable error handling here
ENDIF.
* EXCEL DATA IS NOW IN UTAB TABLE
DATA DTAB TYPE TABLE OF CHAR100.
FIELD-SYMBOLS &amp;lt;FS_DTAB&amp;gt; LIKE LINE OF DTAB.
LOOP AT UTAB ASSIGNING &amp;lt;FS_UTAB&amp;gt; FROM 2.  
    SPLIT &amp;lt;FS_UTAB&amp;gt; AT ',' INTO TABLE DTAB
ENDLOOP. 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 07 Oct 2018 05:03:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/upload-comma-separated-data-from-csv-file-to-a-custom-database-table/m-p/729051#M34296</guid>
      <dc:creator>jayaraj2018</dc:creator>
      <dc:date>2018-10-07T05:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Upload comma separated data from CSV file to a custom database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/upload-comma-separated-data-from-csv-file-to-a-custom-database-table/m-p/729052#M34297</link>
      <description>&lt;P&gt;Please in future use the code button when entering code. I've done it for you this time.&lt;/P&gt;&lt;P&gt;Matt Billigham - SAP Community Moderator&lt;/P&gt;</description>
      <pubDate>Sun, 07 Oct 2018 07:09:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/upload-comma-separated-data-from-csv-file-to-a-custom-database-table/m-p/729052#M34297</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2018-10-07T07:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: Upload comma separated data from CSV file to a custom database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/upload-comma-separated-data-from-csv-file-to-a-custom-database-table/m-p/729053#M34298</link>
      <description>&lt;P&gt;Dear M Jay,&lt;/P&gt;&lt;P&gt;Instead of this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SPLIT &amp;lt;FS_UTAB&amp;gt; AT ',' INTO TABLE DTAB&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: Dtab TYPE STANDARD TABLE OF ZCUST_DETAIL,
      wa_dtab TYPE ZCUST_DETAIL.
"(you can also define internal table structure manually instead of using standard table)

............
............
............


SPLIT &amp;lt;FS_UTAB&amp;gt; AT ',' INTO wa_dtab-name wa_dtab-address wa_dtab-contact.
Append wa_dtab INTO dtab.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if you need further clarifications on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Arpan Shukla&lt;/P&gt;</description>
      <pubDate>Mon, 08 Oct 2018 08:41:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/upload-comma-separated-data-from-csv-file-to-a-custom-database-table/m-p/729053#M34298</guid>
      <dc:creator>arpan_shukla</dc:creator>
      <dc:date>2018-10-08T08:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: Upload comma separated data from CSV file to a custom database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/upload-comma-separated-data-from-csv-file-to-a-custom-database-table/m-p/729054#M34299</link>
      <description>&lt;P&gt;Thank you Arpan!&lt;/P&gt;</description>
      <pubDate>Mon, 08 Oct 2018 14:56:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/upload-comma-separated-data-from-csv-file-to-a-custom-database-table/m-p/729054#M34299</guid>
      <dc:creator>jayaraj2018</dc:creator>
      <dc:date>2018-10-08T14:56:54Z</dc:date>
    </item>
  </channel>
</rss>

