<?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 GUI_UPLOAD reads csv as one line. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload-reads-csv-as-one-line/m-p/12247250#M1985778</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
  &lt;P&gt;I have a requirement of reading a .csv file, in an ABAP report, that looks like this(dummy values are used for obvious reasons):&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1837673-abap-issue.png" /&gt;&lt;/P&gt;
  &lt;P&gt;Notice that each row is stored in the first column cell.&lt;/P&gt;
  &lt;P&gt;I am currently using the GUI_UPLOAD function module to do the above operation. It is called as following:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'GUI_UPLOAD'EXPORTING&amp;lt;br&amp;gt;
 filename = lv_filename&amp;lt;br&amp;gt;
 filetype = 'ASC'TABLES&amp;lt;br&amp;gt;
 data_tab = lt_filedataEXCEPTIONS&amp;lt;br&amp;gt;
 file_open_error = 1&amp;lt;br&amp;gt;
 file_read_error = 2&amp;lt;br&amp;gt;
 no_batch = 3&amp;lt;br&amp;gt;
 gui_refuse_filetransfer = 4&amp;lt;br&amp;gt;
 invalid_type = 5&amp;lt;br&amp;gt;
 no_authority = 6&amp;lt;br&amp;gt;
 unknown_error = 7&amp;lt;br&amp;gt;
 bad_data_format = 8&amp;lt;br&amp;gt;
 header_not_allowed = 9&amp;lt;br&amp;gt;
 separator_not_allowed = 10&amp;lt;br&amp;gt;
 header_too_long = 11&amp;lt;br&amp;gt;
 unknown_dp_error = 12&amp;lt;br&amp;gt;
 access_denied = 13&amp;lt;br&amp;gt;
 dp_out_of_memory = 14&amp;lt;br&amp;gt;
 disk_full = 15&amp;lt;br&amp;gt;
 dp_timeout = 16OTHERS = 17.
 filename = lv_filename
 filetype = 'ASC'TABLES
 data_tab = lt_filedataEXCEPTIONS
 file_open_error = 1
 file_read_error = 2
 no_batch = 3
 gui_refuse_filetransfer = 4
 invalid_type = 5
 no_authority = 6
 unknown_error = 7
 bad_data_format = 8
 header_not_allowed = 9
 separator_not_allowed = 10
 header_too_long = 11
 unknown_dp_error = 12
 access_denied = 13
 dp_out_of_memory = 14
 disk_full = 15
 dp_timeout = 16OTHERS = 17.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I would expect lt_filedata to have 4 rows, each one containing one line from the above .csv file.&lt;/P&gt;
  &lt;P&gt;However, it contains only one line, consisting of all above lines as a single continuous line, as such:&lt;/P&gt;
  &lt;P&gt;&lt;EM&gt;val1,val2,"val3","val4" &lt;STRONG&gt;#&lt;/STRONG&gt; val5,val6,"val7","val8"&lt;STRONG&gt;#&lt;/STRONG&gt; val9,"val10","val11"&lt;STRONG&gt;#&lt;/STRONG&gt; val12,"val13","","","","val14"&lt;/EM&gt;&lt;/P&gt;
  &lt;P&gt;Notice that, in the positions where the line breaks should be, they are replaced by the ‘#’ character.&lt;/P&gt;
  &lt;P&gt;Any ideas on what could be responsible for this behavior and how to make the function module parse the file correctly and output a table with a row for each of the lines in the .csv file?&lt;/P&gt;
  &lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
    <pubDate>Fri, 21 Aug 2020 15:11:45 GMT</pubDate>
    <dc:creator>former_member698033</dc:creator>
    <dc:date>2020-08-21T15:11:45Z</dc:date>
    <item>
      <title>GUI_UPLOAD reads csv as one line.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload-reads-csv-as-one-line/m-p/12247250#M1985778</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
  &lt;P&gt;I have a requirement of reading a .csv file, in an ABAP report, that looks like this(dummy values are used for obvious reasons):&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1837673-abap-issue.png" /&gt;&lt;/P&gt;
  &lt;P&gt;Notice that each row is stored in the first column cell.&lt;/P&gt;
  &lt;P&gt;I am currently using the GUI_UPLOAD function module to do the above operation. It is called as following:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'GUI_UPLOAD'EXPORTING&amp;lt;br&amp;gt;
 filename = lv_filename&amp;lt;br&amp;gt;
 filetype = 'ASC'TABLES&amp;lt;br&amp;gt;
 data_tab = lt_filedataEXCEPTIONS&amp;lt;br&amp;gt;
 file_open_error = 1&amp;lt;br&amp;gt;
 file_read_error = 2&amp;lt;br&amp;gt;
 no_batch = 3&amp;lt;br&amp;gt;
 gui_refuse_filetransfer = 4&amp;lt;br&amp;gt;
 invalid_type = 5&amp;lt;br&amp;gt;
 no_authority = 6&amp;lt;br&amp;gt;
 unknown_error = 7&amp;lt;br&amp;gt;
 bad_data_format = 8&amp;lt;br&amp;gt;
 header_not_allowed = 9&amp;lt;br&amp;gt;
 separator_not_allowed = 10&amp;lt;br&amp;gt;
 header_too_long = 11&amp;lt;br&amp;gt;
 unknown_dp_error = 12&amp;lt;br&amp;gt;
 access_denied = 13&amp;lt;br&amp;gt;
 dp_out_of_memory = 14&amp;lt;br&amp;gt;
 disk_full = 15&amp;lt;br&amp;gt;
 dp_timeout = 16OTHERS = 17.
 filename = lv_filename
 filetype = 'ASC'TABLES
 data_tab = lt_filedataEXCEPTIONS
 file_open_error = 1
 file_read_error = 2
 no_batch = 3
 gui_refuse_filetransfer = 4
 invalid_type = 5
 no_authority = 6
 unknown_error = 7
 bad_data_format = 8
 header_not_allowed = 9
 separator_not_allowed = 10
 header_too_long = 11
 unknown_dp_error = 12
 access_denied = 13
 dp_out_of_memory = 14
 disk_full = 15
 dp_timeout = 16OTHERS = 17.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I would expect lt_filedata to have 4 rows, each one containing one line from the above .csv file.&lt;/P&gt;
  &lt;P&gt;However, it contains only one line, consisting of all above lines as a single continuous line, as such:&lt;/P&gt;
  &lt;P&gt;&lt;EM&gt;val1,val2,"val3","val4" &lt;STRONG&gt;#&lt;/STRONG&gt; val5,val6,"val7","val8"&lt;STRONG&gt;#&lt;/STRONG&gt; val9,"val10","val11"&lt;STRONG&gt;#&lt;/STRONG&gt; val12,"val13","","","","val14"&lt;/EM&gt;&lt;/P&gt;
  &lt;P&gt;Notice that, in the positions where the line breaks should be, they are replaced by the ‘#’ character.&lt;/P&gt;
  &lt;P&gt;Any ideas on what could be responsible for this behavior and how to make the function module parse the file correctly and output a table with a row for each of the lines in the .csv file?&lt;/P&gt;
  &lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 15:11:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload-reads-csv-as-one-line/m-p/12247250#M1985778</guid>
      <dc:creator>former_member698033</dc:creator>
      <dc:date>2020-08-21T15:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: GUI_UPLOAD reads csv as one line.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload-reads-csv-as-one-line/m-p/12247251#M1985779</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Looking at your CSV file you have multiple lines but with a different amount of columns. According to the documentation this is not supported. (info available in function module GUI_UPLOAD parameter &lt;STRONG&gt;HAS_FIELD_SEPARATOR)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1837679-doc.png" /&gt;&lt;/P&gt;&lt;P&gt;This might be a matter of formatting your CSV file properly so that each line contains an equal number of columns.&lt;/P&gt;&lt;P&gt;Another thing that caught my eye is that your fields are sometimes surrounded by quotes and sometimes they're not. I would suggest to format your CSV file in a uniform way (either all fields are surrounded by quotes or none of them are). &lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Geert-Jan Klaps&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 15:22:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload-reads-csv-as-one-line/m-p/12247251#M1985779</guid>
      <dc:creator>geert-janklaps</dc:creator>
      <dc:date>2020-08-21T15:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: GUI_UPLOAD reads csv as one line.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload-reads-csv-as-one-line/m-p/12247252#M1985780</link>
      <description>&lt;P&gt;Run your program in debug, display &lt;STRONG&gt;lt_filedata[1]&lt;/STRONG&gt;, what hexadecimal value do you see for the character &lt;STRONG&gt;#&lt;/STRONG&gt; ?&lt;/P&gt;&lt;P&gt;I suspect that it's 000A or 0A00 (character known as Line Feed or LF, or even newline).&lt;/P&gt;&lt;P&gt;It's possible that SAP expects two characters CR/LF (Carriage Return/Line Feed).&lt;/P&gt;&lt;P&gt;Recreate the CSV file with Notepad application for Windows for instance, press Enter at the end of the line, and save it. Try again.&lt;/P&gt;&lt;P&gt;If you want to leave the file unchanged, you may split the lines using:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA(one_line) = lt_filedata[ 1 ].
SPLIT one_line AT cl_abap_char_utilities=&amp;gt;newline INTO TABLE DATA(lines).&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 22 Aug 2020 01:51:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload-reads-csv-as-one-line/m-p/12247252#M1985780</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-08-22T01:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: GUI_UPLOAD reads csv as one line.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload-reads-csv-as-one-line/m-p/12247253#M1985781</link>
      <description>&lt;P&gt;Thanks a lot for Your help. It was really fruitful. &lt;/P&gt;&lt;P&gt;Best regards, &lt;/P&gt;&lt;P&gt;Elena &lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2020 07:12:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload-reads-csv-as-one-line/m-p/12247253#M1985781</guid>
      <dc:creator>former_member698033</dc:creator>
      <dc:date>2020-09-08T07:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: GUI_UPLOAD reads csv as one line.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload-reads-csv-as-one-line/m-p/12247254#M1985782</link>
      <description>&lt;P&gt;Thanks a lot for Your help. It was really fruitful. &lt;/P&gt;&lt;P&gt;Best regards, &lt;/P&gt;&lt;P&gt;Elena &lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2020 07:12:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/gui-upload-reads-csv-as-one-line/m-p/12247254#M1985782</guid>
      <dc:creator>former_member698033</dc:creator>
      <dc:date>2020-09-08T07:12:34Z</dc:date>
    </item>
  </channel>
</rss>

