<?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: Problem to read data set from flat file in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043461#M1351234</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Question was answered&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Sep 2009 12:31:32 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-09-25T12:31:32Z</dc:date>
    <item>
      <title>Problem to read data set from flat file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043452#M1351225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              I'm getting problem in reading data from the flat file  using the READ DATASET statement. &lt;/P&gt;&lt;P&gt;              I have include coding below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With Regards,&lt;/P&gt;&lt;P&gt;Baskaran&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: X_INPUT_REC,&lt;/P&gt;&lt;P&gt;      REC_TYPE(4) TYPE C.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF ITAB OCCURS 0,&lt;/P&gt;&lt;P&gt;      LEN(6),&lt;/P&gt;&lt;P&gt;      WED(6),&lt;/P&gt;&lt;P&gt;      END OF ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: G_INREC(80) .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: FILEN TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: L_EOF(50) VALUE 'C_FALSE'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS: FILENAME(80) DEFAULT 'C:\Documents and Settings\Administrator.ACERMATELP1\Desktop\sample.txt' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONCATENATE FILEN INTO FILENAME NO-GAP.&lt;/P&gt;&lt;P&gt;OPEN DATASET FILENAME FOR INPUT IN TEXT MODE." MESSAGE L_MSG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHILE L_EOF NE C_TRUE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    READ DATASET FILENAME INTO G_INREC.&lt;/P&gt;&lt;P&gt;    CONCATENATE G_INREC INTO G_INREC NO GAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;        MOVE G_INREC TO ITAB.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       ENDCASE.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      ELSE.&lt;/P&gt;&lt;P&gt;        L_EOF = C_TRUE.&lt;/P&gt;&lt;P&gt;        CONTINUE.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;ENDWHILE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2009 09:51:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043452#M1351225</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-24T09:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to read data set from flat file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043453#M1351226</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;READ DATASET is used to read file from Application server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U r trying to read data from presentation server i.e. from PC for this u have to use FM GUI_UPLOAD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rahul Wagh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2009 09:55:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043453#M1351226</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-24T09:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to read data set from flat file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043454#M1351227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI:&lt;/P&gt;&lt;P&gt;Read dataset is being used if you read data directly from Application server.&lt;/P&gt;&lt;P&gt;Here you are reading data from presentation server so Read dataset would not work.&lt;/P&gt;&lt;P&gt;Use the function module GUI_UPLOAD for it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Shashi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2009 09:58:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043454#M1351227</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-24T09:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to read data set from flat file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043455#M1351228</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 dont think read data set will work for out side flat file, it only reads the data in application server.      if need to get data from flat file u should use ws_upload etc function modules, get f1 help at the open dataset and read data set statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; thanq,&lt;/P&gt;&lt;P&gt;rajesh.k&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2009 10:00:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043455#M1351228</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-24T10:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to read data set from flat file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043456#M1351229</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 gui_upload instead of read dataset&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try this link&lt;/P&gt;&lt;P&gt;&lt;A href="http://saplab.blogspot.com/2007/10/sample-abap-program-to-upload-table.html" target="test_blank"&gt;http://saplab.blogspot.com/2007/10/sample-abap-program-to-upload-table.html&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2009 10:01:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043456#M1351229</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-24T10:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to read data set from flat file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043457#M1351230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2009 10:09:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043457#M1351230</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2009-08-24T10:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to read data set from flat file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043458#M1351231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Baskaran&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should not use the READ DATASET statement to read from presentation server. It should be used only for reading data from files on application server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your case you should use the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: lt_data TYPE STANDARD TABLE OF char80.

CALL METHOD cl_gui_frontend_services=&amp;gt;gui_upload
  EXPORTING
    filename                = 'C:\Documents and Settings\Administrator.ACERMATELP1\Desktop\sample.txt'
  CHANGING
    data_tab                = lt_data
  EXCEPTIONS
    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              = 16
    not_supported_by_gui    = 17
    error_no_gui            = 18
    OTHERS                  = 19.
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.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lt_data contains the entire data of file in it. You can then process it further as you wish.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and best regards&lt;/P&gt;&lt;P&gt;Anand.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2009 10:10:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043458#M1351231</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-24T10:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to read data set from flat file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043459#M1351232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Read dataset statement is use to read the file from application server, to read the frile file from presentation server use FM GUI_Upload. In this FM you need to pass full file name (i.e. c:\text.txt) and you can get the contents of file into a internal table as output.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2009 10:37:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043459#M1351232</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-24T10:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to read data set from flat file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043460#M1351233</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;To read the data from application server:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: lv_app_server_file TYPE string.&lt;/P&gt;&lt;P&gt;lv_app_server_file = pa_afile.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;To read file from Application server&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;OPEN DATASET lv_app_server_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.&lt;/P&gt;&lt;P&gt;DO.&lt;/P&gt;&lt;P&gt;READ DATASET lv_app_server_file INTO wa_file_data.&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;APPEND wa_file_data TO gi_file_data.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;CLOSE DATASET lv_app_server_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To upload the data from text file from machine:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lv_filetype = 'ASC'.&lt;/P&gt;&lt;P&gt;lv_gui_sep = 'X'.&lt;/P&gt;&lt;P&gt;lv_file_name = pa_dfile.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;FM call to upload file&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL FUNCTION 'GUI_UPLOAD'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;filename = lv_file_name&lt;/P&gt;&lt;P&gt;filetype = lv_filetype&lt;/P&gt;&lt;P&gt;has_field_separator = lv_gui_sep&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;data_tab = gi_zhralcon_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rajesh Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2009 11:18:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043460#M1351233</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-24T11:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to read data set from flat file</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043461#M1351234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Question was answered&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2009 12:31:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-to-read-data-set-from-flat-file/m-p/6043461#M1351234</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-25T12:31:32Z</dc:date>
    </item>
  </channel>
</rss>

