<?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/3556732#M855836</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi check this example..,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report  ZTESTPROGRAMFORDOWNLOAD&lt;/P&gt;&lt;P&gt;*&amp;amp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;&lt;/P&gt;&lt;P&gt;*&amp;amp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report  ztestprogramfordownload.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tables:zupload.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:it_pa0002(200).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types: begin of ty_pa0002 ,&lt;/P&gt;&lt;P&gt;       pernr like pa0002-pernr,&lt;/P&gt;&lt;P&gt;       begda like pa0002-begda,&lt;/P&gt;&lt;P&gt;       endda like pa0002-endda,&lt;/P&gt;&lt;P&gt;       vorna like pa0002-vorna,&lt;/P&gt;&lt;P&gt;       nachn like pa0002-nachn,&lt;/P&gt;&lt;P&gt;       end of ty_pa0002.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:begin of it_error  occurs 0 ,&lt;/P&gt;&lt;P&gt;     pernr like pa0000-pernr,&lt;/P&gt;&lt;P&gt;     end of it_error .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:it_final type standard table of ty_pa0002 with header line.&lt;/P&gt;&lt;P&gt;data:it_temp type standard table of ty_pa0002 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters:p_file like rlgrap-filename default 'F:\usr\sap\EC6\DVEBMGS00\work\entiraledu1'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;open dataset p_file for input in text mode   encoding default.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  read dataset p_file into it_pa0002.&lt;/P&gt;&lt;P&gt;  if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; it_final-pernr = it_pa0002+0(8).&lt;/P&gt;&lt;P&gt; it_final-begda = it_pa0002+18(8).&lt;/P&gt;&lt;P&gt; it_final-endda = it_pa0002+36(8).&lt;/P&gt;&lt;P&gt; it_final-vorna = it_pa0002+54(40).&lt;/P&gt;&lt;P&gt; it_final-nachn = it_pa0002+104(40).&lt;/P&gt;&lt;P&gt; append it_final.&lt;/P&gt;&lt;P&gt; clear it_final.&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;&lt;/P&gt;&lt;P&gt;if not it_final[] is initial.&lt;/P&gt;&lt;P&gt;sort it_final by pernr begda descending.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from it_final comparing pernr .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select pernr&lt;/P&gt;&lt;P&gt;       begda&lt;/P&gt;&lt;P&gt;       endda&lt;/P&gt;&lt;P&gt;       vorna&lt;/P&gt;&lt;P&gt;       nachn&lt;/P&gt;&lt;P&gt;       from pa0002&lt;/P&gt;&lt;P&gt;       into table it_temp&lt;/P&gt;&lt;P&gt;       for all entries in it_final&lt;/P&gt;&lt;P&gt;       where pernr = it_final-pernr.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; loop at it_temp.&lt;/P&gt;&lt;P&gt; zupload-pernr = it_temp-pernr.&lt;/P&gt;&lt;P&gt; zupload-begda = it_temp-begda.&lt;/P&gt;&lt;P&gt; zupload-endda = it_temp-endda.&lt;/P&gt;&lt;P&gt; zupload-vorna = it_temp-vorna.&lt;/P&gt;&lt;P&gt; zupload-nachn = it_temp-nachn.&lt;/P&gt;&lt;P&gt; insert zupload.&lt;/P&gt;&lt;P&gt; clear it_temp.&lt;/P&gt;&lt;P&gt; clear zupload.&lt;/P&gt;&lt;P&gt; endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;close dataset p_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;venkat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 15 Mar 2008 10:01:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-15T10:01:55Z</dc:date>
    <item>
      <title>Open dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/3556731#M855835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to store file in Application layer ?&lt;/P&gt;&lt;P&gt;how to use Open Dataset, Close Dataset&lt;/P&gt;&lt;P&gt;with an example please ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Point assured&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Mar 2008 09:52:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/3556731#M855835</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-15T09:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Open dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/3556732#M855836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi check this example..,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report  ZTESTPROGRAMFORDOWNLOAD&lt;/P&gt;&lt;P&gt;*&amp;amp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;&lt;/P&gt;&lt;P&gt;*&amp;amp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report  ztestprogramfordownload.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tables:zupload.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:it_pa0002(200).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types: begin of ty_pa0002 ,&lt;/P&gt;&lt;P&gt;       pernr like pa0002-pernr,&lt;/P&gt;&lt;P&gt;       begda like pa0002-begda,&lt;/P&gt;&lt;P&gt;       endda like pa0002-endda,&lt;/P&gt;&lt;P&gt;       vorna like pa0002-vorna,&lt;/P&gt;&lt;P&gt;       nachn like pa0002-nachn,&lt;/P&gt;&lt;P&gt;       end of ty_pa0002.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:begin of it_error  occurs 0 ,&lt;/P&gt;&lt;P&gt;     pernr like pa0000-pernr,&lt;/P&gt;&lt;P&gt;     end of it_error .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:it_final type standard table of ty_pa0002 with header line.&lt;/P&gt;&lt;P&gt;data:it_temp type standard table of ty_pa0002 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters:p_file like rlgrap-filename default 'F:\usr\sap\EC6\DVEBMGS00\work\entiraledu1'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;open dataset p_file for input in text mode   encoding default.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  read dataset p_file into it_pa0002.&lt;/P&gt;&lt;P&gt;  if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; it_final-pernr = it_pa0002+0(8).&lt;/P&gt;&lt;P&gt; it_final-begda = it_pa0002+18(8).&lt;/P&gt;&lt;P&gt; it_final-endda = it_pa0002+36(8).&lt;/P&gt;&lt;P&gt; it_final-vorna = it_pa0002+54(40).&lt;/P&gt;&lt;P&gt; it_final-nachn = it_pa0002+104(40).&lt;/P&gt;&lt;P&gt; append it_final.&lt;/P&gt;&lt;P&gt; clear it_final.&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;&lt;/P&gt;&lt;P&gt;if not it_final[] is initial.&lt;/P&gt;&lt;P&gt;sort it_final by pernr begda descending.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from it_final comparing pernr .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select pernr&lt;/P&gt;&lt;P&gt;       begda&lt;/P&gt;&lt;P&gt;       endda&lt;/P&gt;&lt;P&gt;       vorna&lt;/P&gt;&lt;P&gt;       nachn&lt;/P&gt;&lt;P&gt;       from pa0002&lt;/P&gt;&lt;P&gt;       into table it_temp&lt;/P&gt;&lt;P&gt;       for all entries in it_final&lt;/P&gt;&lt;P&gt;       where pernr = it_final-pernr.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; loop at it_temp.&lt;/P&gt;&lt;P&gt; zupload-pernr = it_temp-pernr.&lt;/P&gt;&lt;P&gt; zupload-begda = it_temp-begda.&lt;/P&gt;&lt;P&gt; zupload-endda = it_temp-endda.&lt;/P&gt;&lt;P&gt; zupload-vorna = it_temp-vorna.&lt;/P&gt;&lt;P&gt; zupload-nachn = it_temp-nachn.&lt;/P&gt;&lt;P&gt; insert zupload.&lt;/P&gt;&lt;P&gt; clear it_temp.&lt;/P&gt;&lt;P&gt; clear zupload.&lt;/P&gt;&lt;P&gt; endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;close dataset p_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;venkat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Mar 2008 10:01:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/3556732#M855836</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-15T10:01: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/3556733#M855837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai  &lt;STRONG&gt;Monica&lt;/STRONG&gt;,&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basic Form of the OPEN DATASET Statement &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To open a file on the application server, use the OPEN statement as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET &amp;lt;dsn&amp;gt; [Additions].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement opens the file &amp;lt;dsn&amp;gt;. If you do not specify any additions for the mode, the file is opened in binary mode for reading. SY-SUBRC returns 0 if the system opens the file. Otherwise, SY-SUBRC is set to 8.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You enter the filename &amp;lt;dsn&amp;gt; either as a literal or as a field containing the actual name of the file. If you do not specify a path, the system opens the file in the directory in which the R/3 System is running on the application server. To open a file, the user under which the R/3 System is running must have the requisite authorizations at operating system level. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Filenames are platform-specific. You must therefore use file- and pathnames that conform to the rules of the operating system under which your R/3 System is running. However, you can also use logical filenames to ensure that your programs are not operating system-specific. For further information, refer to Using Platform-Independent Filenames.&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 FNAME(60).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FNAME = '/tmp/myfile'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET 'myfile'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example works as long as your R/3 System is running under UNIX. The program opens the file "myfile" in the directory in which the R/3 System is running, and also opens the file "myfile" in directory "/tmp". However, you would have to change the filename for other operating systems. For example, for OpenVMS, you could write the following: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FNAME = '[TMP]myfile.BIN'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET 'myfile.BIN'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Opening a File for Write Access &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To open a file for writing, use the FOR OUTPUT addition to the OPEN DATASET statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET &amp;lt;dsn&amp;gt; FOR OUTPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the file does not already exist, it is created automatically. If it does already exist, but is closed, its contents are overwritten. If the file exists and is already open (for read or write access, or for appending), the position is reset to the beginning of the file. If the system can open the file &amp;lt;dsn&amp;gt; successfully, SY-SUBRC is set to 0. If not, it is set to 8.&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: MESS(60),&lt;/P&gt;&lt;P&gt;      FNAME(10) VALUE '/tmp'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR OUTPUT MESSAGE MESS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;  WRITE: 'SY-SUBRC:', SY-SUBRC,&lt;/P&gt;&lt;P&gt;       / 'System Message:', MESS.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the R/3 System is ruining under UNIX, the output looks like this: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The system cannot open the file, since the name you specified is that of a directory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following program shows how the system sets the position when you open a file for writing. However, it is better programming style to close files that are already open before you reopen them for a different operation (for further information about closing files, refer to Closing a File).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA FNAME(60) VALUE 'myfile'.&lt;/P&gt;&lt;P&gt;DATA NUM TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR OUTPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO 10 TIMES.&lt;/P&gt;&lt;P&gt;  NUM = NUM + 1.&lt;/P&gt;&lt;P&gt;  TRANSFER NUM TO FNAME.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM INPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR OUTPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NUM = 0.&lt;/P&gt;&lt;P&gt;DO 5 TIMES.&lt;/P&gt;&lt;P&gt;  NUM = NUM + 10.&lt;/P&gt;&lt;P&gt;  TRANSFER NUM TO FNAME.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM INPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLOSE DATASET FNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR OUTPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NUM = 0.&lt;/P&gt;&lt;P&gt;DO 5 TIMES.&lt;/P&gt;&lt;P&gt;  NUM = NUM + 20.&lt;/P&gt;&lt;P&gt;  TRANSFER NUM TO FNAME.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM INPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM INPUT.&lt;/P&gt;&lt;P&gt;  SKIP.&lt;/P&gt;&lt;P&gt;  OPEN DATASET FNAME FOR INPUT.&lt;/P&gt;&lt;P&gt;  DO.&lt;/P&gt;&lt;P&gt;    READ DATASET FNAME INTO NUM.&lt;/P&gt;&lt;P&gt;    IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;      EXIT.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;    WRITE / NUM.&lt;/P&gt;&lt;P&gt;  ENDDO.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output appears as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;6&lt;/P&gt;&lt;P&gt;7&lt;/P&gt;&lt;P&gt;8&lt;/P&gt;&lt;P&gt;9&lt;/P&gt;&lt;P&gt;10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;10&lt;/P&gt;&lt;P&gt;20&lt;/P&gt;&lt;P&gt;30&lt;/P&gt;&lt;P&gt;40&lt;/P&gt;&lt;P&gt;50&lt;/P&gt;&lt;P&gt;6&lt;/P&gt;&lt;P&gt;7&lt;/P&gt;&lt;P&gt;8&lt;/P&gt;&lt;P&gt;9&lt;/P&gt;&lt;P&gt;10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;20&lt;/P&gt;&lt;P&gt;40&lt;/P&gt;&lt;P&gt;60&lt;/P&gt;&lt;P&gt;80&lt;/P&gt;&lt;P&gt;100&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example performs the following steps using the file "myfile":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is opened for writing &lt;/P&gt;&lt;P&gt;It is filled with 10 integers (for information about the TRANSFER statement, refer to Writing Data to Files) &lt;/P&gt;&lt;P&gt;It is then opened for reading. The position is reset accordingly to the beginning of the file. &lt;/P&gt;&lt;P&gt;It is read into the field NUM. For information about the READ DATASET statement, refer to Reading Data from Files. The values of NUM are displayed on the screen. &lt;/P&gt;&lt;P&gt;It is reopened for writing The position is reset to the beginning of the file. &lt;/P&gt;&lt;P&gt;It is filled with five integers, which overwrite the previous contents of the file. &lt;/P&gt;&lt;P&gt;It is then reopened for reading. The position is reset to the beginning of the file. &lt;/P&gt;&lt;P&gt;The file is read into the field NUM. The values of NUM are displayed on the screen. &lt;/P&gt;&lt;P&gt;It is closed (for information about the CLOSE DATASET statement, refer to Closing a File). &lt;/P&gt;&lt;P&gt;It is then reopened for writing. The system deletes the existing contents of the file. &lt;/P&gt;&lt;P&gt;It is filled with 5 integers. &lt;/P&gt;&lt;P&gt;It is then opened for reading. The position is reset to the beginning of the file. &lt;/P&gt;&lt;P&gt;The file is read into the field NUM. The values of NUM are displayed on the screen. &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Closing a File &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To close a file on the application server, use the close statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLOSE DATASET &amp;lt;dsn&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement closes the file &amp;lt;dsn&amp;gt;. The naming convention is described in the section Opening a File.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You only need to close a file if you want to delete its contents the next time you open it for write access. For further information and an example, refer to Opening a File for Write Access.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, to avoid errors, and to make your programs easier to read, you should always close a file before the next OPEN DATASET statement. The CLOSE statement divides your program into logical blocks, and makes them easier to maintain. &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 FNAME(60) VALUE 'myfile'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR OUTPUT.&lt;/P&gt;&lt;P&gt;  .....&lt;/P&gt;&lt;P&gt;CLOSE FNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR INPUT.&lt;/P&gt;&lt;P&gt;  .....&lt;/P&gt;&lt;P&gt;CLOSE FNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR INPUT AT POSITION &amp;lt;pos&amp;gt;.&lt;/P&gt;&lt;P&gt;  .....&lt;/P&gt;&lt;P&gt;CLOSE FNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The CLOSE statement is not obligatory in this example, but it does improve the layout of the program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Regards.&lt;/P&gt;&lt;P&gt; Eshwar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Mar 2008 10:18:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/3556733#M855837</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-15T10:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: Open dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/3556734#M855838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Monica,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use following code...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{CONCATENATE '/tmp/dms/' ufile INTO dsn.&lt;/P&gt;&lt;P&gt;OPEN DATASET dsn FOR INPUT IN TEXT MODE ENCODING DEFAULT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR : it_upd_dt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DO.&lt;/P&gt;&lt;P&gt;    READ DATASET dsn INTO rec.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      wa_upd_dt-msg = rec.&lt;/P&gt;&lt;P&gt;      APPEND wa_upd_dt TO it_upd_dt.&lt;/P&gt;&lt;P&gt;      CLEAR wa_upd_dt.&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;&lt;/P&gt;&lt;P&gt;  CLOSE  DATASET dsn.}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dharmesh vyas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Mar 2008 10:19:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/3556734#M855838</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-15T10:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: Open dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/3556735#M855839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;THANKS TO ALL POINT HAS BEEN GIVEN&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2008 06:04:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/3556735#M855839</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-07T06:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: Open dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/3556736#M855840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2008 07:13:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/3556736#M855840</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-24T07:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Open dataset</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/3556737#M855841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hiii !!&lt;/P&gt;&lt;P&gt;  Just try out this program. and after executing this program&lt;/P&gt;&lt;P&gt;Call transaction AL11. Now you'll get a long list, in that list,&lt;/P&gt;&lt;P&gt;Open a directory with its path as  DIR_SAPUSERS   .\&lt;/P&gt;&lt;P&gt;Double click it then press ctr F there type this filename which you have mentioned in fname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report  YH1146_FILE2                                                *&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  YH1146_FILE2.&lt;/P&gt;&lt;P&gt;DATA: fname(40),&lt;/P&gt;&lt;P&gt;      w_line TYPE i VALUE 1.&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;  BEGIN OF fs_flight,&lt;/P&gt;&lt;P&gt;    carrid   LIKE sflight-carrid,&lt;/P&gt;&lt;P&gt;    connid   LIKE sflight-connid,&lt;/P&gt;&lt;P&gt;    fldate   LIKE sflight-fldate,&lt;/P&gt;&lt;P&gt;  END OF fs_flight.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;  t_flight LIKE&lt;/P&gt;&lt;P&gt;     TABLE OF&lt;/P&gt;&lt;P&gt;           fs_flight.&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;  t_flight1 LIKE&lt;/P&gt;&lt;P&gt;      TABLE OF&lt;/P&gt;&lt;P&gt;            fs_flight.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS:&lt;/P&gt;&lt;P&gt;  s_carrid FOR fs_flight-carrid,&lt;/P&gt;&lt;P&gt;  s_connid FOR fs_flight-connid.&lt;/P&gt;&lt;P&gt;fname = '.\YH1146test.xls'.&lt;/P&gt;&lt;P&gt;PERFORM get_flight_data.&lt;/P&gt;&lt;P&gt;OPEN DATASET fname FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.&lt;/P&gt;&lt;P&gt;LOOP AT t_flight INTO fs_flight.&lt;/P&gt;&lt;P&gt;  TRANSFER fs_flight TO fname.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;  WRITE: 'File Opened On Apps Server'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;  WRITE: 'File could not be opened'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;CLOSE DATASET fname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  get_flight_data&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; --&amp;gt;  p1        text&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; &amp;lt;--  p2        text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form get_flight_data .&lt;/P&gt;&lt;P&gt;    SELECT carrid&lt;/P&gt;&lt;P&gt;           connid&lt;/P&gt;&lt;P&gt;           fldate&lt;/P&gt;&lt;P&gt;      FROM sflight&lt;/P&gt;&lt;P&gt;      INTO TABLE t_flight&lt;/P&gt;&lt;P&gt;     WHERE carrid IN s_carrid&lt;/P&gt;&lt;P&gt;       AND connid IN s_connid.&lt;/P&gt;&lt;P&gt;endform.                    " get_flight_data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Abhijeet Kulshreshtha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2008 07:33:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/open-dataset/m-p/3556737#M855841</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-24T07:33:49Z</dc:date>
    </item>
  </channel>
</rss>

