<?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: OPEN DATASET in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/7700265#M1577947</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 should first read the file content in the application server into an internal table and then process those records by looping through the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET filename FOR INPUT IN TEXT MODE.  "Opens the file in app server in input mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   DO.&lt;/P&gt;&lt;P&gt;     READ DATASET filename INTO tab.    "Read the contents line by line into int.table tab&lt;/P&gt;&lt;P&gt;     CASE sy-subrc.&lt;/P&gt;&lt;P&gt;       WHEN '00'.&lt;/P&gt;&lt;P&gt;         APPEND tab.&lt;/P&gt;&lt;P&gt;         ADD   1           TO  ws_recs_read.&lt;/P&gt;&lt;P&gt;       WHEN '04'.&lt;/P&gt;&lt;P&gt;         EXIT.&lt;/P&gt;&lt;P&gt;     ENDCASE.&lt;/P&gt;&lt;P&gt;   ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The contents in internal  table can be procesed now.&lt;/P&gt;&lt;P&gt;CLOSE DATASET filename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Soumya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Feb 2011 08:40:26 GMT</pubDate>
    <dc:creator>soumya_jose3</dc:creator>
    <dc:date>2011-02-03T08:40:26Z</dc:date>
    <item>
      <title>OPEN DATASET</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/7700264#M1577946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had a requirement, where i have to read a file from Application server and will store it in a Internal table for further process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope, most of us  usually do in the same way. But i came across an option, where the File from application server requires to be  read, do the validations and post the Document FB01 for the records found in the file. Then close the Dataset once all the records are read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly advice, which is the best way Using OPEN DATASET(Consider 100 records for examples).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a) Read all datas from Application server into an Internal table &amp;amp; then process the records as required.&lt;/P&gt;&lt;P&gt;b) Read record by record from the Application server &amp;amp; process the records as required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Awaiting for your valubale reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anbalagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Feb 2011 08:22:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/7700264#M1577946</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-03T08:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: OPEN DATASET</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/7700265#M1577947</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 should first read the file content in the application server into an internal table and then process those records by looping through the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET filename FOR INPUT IN TEXT MODE.  "Opens the file in app server in input mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   DO.&lt;/P&gt;&lt;P&gt;     READ DATASET filename INTO tab.    "Read the contents line by line into int.table tab&lt;/P&gt;&lt;P&gt;     CASE sy-subrc.&lt;/P&gt;&lt;P&gt;       WHEN '00'.&lt;/P&gt;&lt;P&gt;         APPEND tab.&lt;/P&gt;&lt;P&gt;         ADD   1           TO  ws_recs_read.&lt;/P&gt;&lt;P&gt;       WHEN '04'.&lt;/P&gt;&lt;P&gt;         EXIT.&lt;/P&gt;&lt;P&gt;     ENDCASE.&lt;/P&gt;&lt;P&gt;   ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The contents in internal  table can be procesed now.&lt;/P&gt;&lt;P&gt;CLOSE DATASET filename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Soumya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Feb 2011 08:40:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/7700265#M1577947</guid>
      <dc:creator>soumya_jose3</dc:creator>
      <dc:date>2011-02-03T08:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: OPEN DATASET</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/7700266#M1577948</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;u can read the file content from the application server and then store it to internal table.Then download the Data into Presentation server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 open dataset w_filename for input in text mode
                                        encoding default.
**    Reading one by one record
  while sy-subrc eq 0.
    read dataset w_filename into w_readline.
    if sy-subrc ne 0.
      exit.
    endif.                             " IF sy-subrc NE 0.
    wa = w_readline.
    insert wa into table t_itab.
  endwhile.                            " WHILE sy-subrc eq 0

*" Closing the w_filename
  close dataset w_filename.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you can read the data from t_itab by using loop or you can download into presentation server by using function module GUI_DOWNLOAD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Suvajit.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Feb 2011 08:52:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/7700266#M1577948</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-03T08:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: OPEN DATASET</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/7700267#M1577949</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;&lt;/P&gt;&lt;P&gt;Go through the Below link.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3d42358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3d42358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With Regards,&lt;/P&gt;&lt;P&gt;Sumodh.P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Feb 2011 08:54:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/7700267#M1577949</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-03T08:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: OPEN DATASET</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/7700268#M1577950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Anbalagan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not see much of a difference between the two approaches whether you open the file, process record by record and then close or open the file, collect all records, close file and then process all records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could chose any of these approaches, since the number of records in your input file are not very high.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ofcourse if the number of records in your file are very high and your input file can not be kept open for such a long time (since it might be needed by other programs), in that case, I would advice the 2nd approach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Anand|http://www.saptraininghouse.com/2011/append-structure/]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Feb 2011 09:11:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/7700268#M1577950</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-03T09:11:17Z</dc:date>
    </item>
  </channel>
</rss>

