<?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: Working with File in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/working-with-file/m-p/1448166#M212445</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the following &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basic form 1 &lt;/P&gt;&lt;P&gt;OPEN DATASET dsn. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Extras: &lt;/P&gt;&lt;P&gt;1a. ... FOR INPUT &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1b. ... FOR OUTPUT &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1c. ... FOR APPENDING &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1d. ... FOR UPDATE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2a. ... IN BINARY MODE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2b. ... IN TEXT MODE [ENCODING (DEFAULT|UTF-8|NON-UNICODE)] &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2c. ... IN LEGACY BINARY MODE [(BIG|LITTLE) ENDIAN] [CODE PAGE cp] &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2d. ... IN LEGACY TEXT MODE [(BIG|LITTLE) ENDIAN] [CODE PAGE cp] &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. ... REPLACEMENT CHARACTER rc &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. ... IGNORING CONVERSION ERRORS &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. ... AT POSITION p &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6. ... TYPE c &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;7. ... MESSAGE m &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;8. ... FILTER f &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. For details see the section File Interface. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;Opens the specified file. If you do not specify a directory, the system uses the directory defined in the profile parameter DIR_HOME. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In programs without active Unicode check, the file is opened for reading in binary mode if you do not use any additions for OPENDATASET. To ensure downward compatibility with Releases &amp;lt;= 4.6, file names containing blanks are truncated at the position of the first blank. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In programs with active Unicode check, you must specify the access type (such as ... FOR INPUT, ... FOR OUTPUT, and so on) and the mode (such as ... IN TEXT MODE, ... IN BINARY MODE, and so on). If the file is opened using ... IN TEXT MODE, you must still use the addition ... ENCODING. If the Unicode check is enabled, it is possible to use file names containing blanks. Applying OPEN DATASET to a file already opened - in the same internal mode - triggers an exception of the type CX_SY_FILE_OPEN. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Return Code is set as follows: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SY-SUBRC = 0: &lt;/P&gt;&lt;P&gt;The file was opened. &lt;/P&gt;&lt;P&gt;SY-SUBRC = 8: &lt;/P&gt;&lt;P&gt;The file could not be opened. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go through the following Example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: v_hex type x,&lt;/P&gt;&lt;P&gt;v_bit type n.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;open dataset file_name for input in binary mode encoding default.&lt;/P&gt;&lt;P&gt;do.&lt;/P&gt;&lt;P&gt;read dataset file_name into v_hex.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;close dataset file_name&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do 8 times.&lt;/P&gt;&lt;P&gt;get bit sy-index of v_hex into v_bit.&lt;/P&gt;&lt;P&gt;write v_bit no-gap.&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards&lt;/P&gt;&lt;P&gt;Sreeni&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Jul 2006 07:42:35 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-07-12T07:42:35Z</dc:date>
    <item>
      <title>Working with File</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/working-with-file/m-p/1448161#M212440</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;Can any one tell me how to open ,write and close on SAP file on App.Server&lt;/P&gt;&lt;P&gt;Thanks Advance.&lt;/P&gt;&lt;P&gt;Ankur Garg.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jul 2006 07:12:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/working-with-file/m-p/1448161#M212440</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-12T07:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: Working with File</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/working-with-file/m-p/1448162#M212441</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;Use dataset&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Check this link&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/open_dat.htm" target="test_blank"&gt;http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/open_dat.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basic form 1 &lt;/P&gt;&lt;P&gt;OPEN DATASET dsn. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Extras: &lt;/P&gt;&lt;P&gt;1a. ... FOR INPUT &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1b. ... FOR OUTPUT &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1c. ... FOR APPENDING &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1d. ... FOR UPDATE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2a. ... IN BINARY MODE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2b. ... IN TEXT MODE [ENCODING (DEFAULT|UTF-8|NON-UNICODE)] &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2c. ... IN LEGACY BINARY MODE [(BIG|LITTLE) ENDIAN] [CODE PAGE cp] &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2d. ... IN LEGACY TEXT MODE [(BIG|LITTLE) ENDIAN] [CODE PAGE cp] &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. ... REPLACEMENT CHARACTER rc &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. ... IGNORING CONVERSION ERRORS &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. ... AT POSITION p &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6. ... TYPE c &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;7. ... MESSAGE m &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;8. ... FILTER f &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. For details see the section File Interface. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;Opens the specified file. If you do not specify a directory, the system uses the directory defined in the profile parameter DIR_HOME. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In programs without active Unicode check, the file is opened for reading in binary mode if you do not use any additions for OPENDATASET. To ensure downward compatibility with Releases &amp;lt;= 4.6, file names containing blanks are truncated at the position of the first blank. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In programs with active Unicode check, you must specify the access type (such as ... FOR INPUT, ... FOR OUTPUT, and so on) and the mode (such as ... IN TEXT MODE, ... IN BINARY MODE, and so on). If the file is opened using ... IN TEXT MODE, you must still use the addition ... ENCODING. If the Unicode check is enabled, it is possible to use file names containing blanks. Applying OPEN DATASET to a file already opened - in the same internal mode - triggers an exception of the type CX_SY_FILE_OPEN. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Return Code is set as follows: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SY-SUBRC = 0: &lt;/P&gt;&lt;P&gt;The file was opened. &lt;/P&gt;&lt;P&gt;SY-SUBRC = 8: &lt;/P&gt;&lt;P&gt;The file could not be opened. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;DATA: &lt;/P&gt;&lt;P&gt;  dsn(20) TYPE C VALUE '/usr/test.dat', &lt;/P&gt;&lt;P&gt;  rec(80) TYPE C. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET dsn FOR INPUT IN TEXT MODE ENCODING DEFAULT. &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;&lt;/P&gt;&lt;P&gt;READ DATASET dsn INTO rec. &lt;/P&gt;&lt;P&gt;WHILE sy-subrc &amp;lt;&amp;gt; 0. &lt;/P&gt;&lt;P&gt;  WRITE / rec.   READ DATASET dsn INTO rec. &lt;/P&gt;&lt;P&gt;ENDWHILE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLOSE DATASET dsn.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jul 2006 07:14:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/working-with-file/m-p/1448162#M212441</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-12T07:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: Working with File</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/working-with-file/m-p/1448163#M212442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First you get your data into an internal table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then copy the following code. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM write_to_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="18" type="ul"&gt;&lt;P&gt;Setting the file name ************************&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONCATENATE 'zfiapimg_' sy-datum '.txt' INTO wa_filename.&lt;/P&gt;&lt;P&gt;wa_filepath = '/data/ftp/out/'.&lt;/P&gt;&lt;P&gt;CONCATENATE wa_filepath wa_filename INTO wa_c_filename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="18" type="ul"&gt;&lt;P&gt;Open the file for output **********************&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;OPEN DATASET wa_c_filename FOR OUTPUT IN TEXT MODE.&lt;/P&gt;&lt;P&gt;IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;MESSAGE a999 WITH 'The file could not be created'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="16" type="ul"&gt;&lt;P&gt;Write header data to file ************************&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;TRANSFER header TO wa_c_filename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="16" type="ul"&gt;&lt;P&gt;Write line items to file ************************&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;LOOP AT i_final_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRANSFER i_final_file TO wa_c_filename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="21" type="ul"&gt;&lt;P&gt;Close the file ******************************&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;CLOSE DATASET wa_c_filename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will have the contents in the file name and file path as specified.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jul 2006 07:15:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/working-with-file/m-p/1448163#M212442</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-12T07:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: Working with File</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/working-with-file/m-p/1448164#M212443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ankur,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ABAP has the Keywords OPEN/READ/CLOSE DATASET for serverbased file actions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is an example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  open dataset w_fname for input in text mode   " get input data&lt;/P&gt;&lt;P&gt;                              message lw_msg.   " any errors place here&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    message i002 with lw_msg.&lt;/P&gt;&lt;P&gt;    stop.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;   read dataset w_fname into lw_row.&lt;/P&gt;&lt;P&gt;    if sy-subrc &amp;lt;&amp;gt; 0.                           " end of file reached&lt;/P&gt;&lt;P&gt;      exit.                                     " leave do loop&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  loop at lt_files.&lt;/P&gt;&lt;P&gt;    delete dataset lt_files-name.&lt;/P&gt;&lt;P&gt;    if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      t_body-line = lt_files-name.&lt;/P&gt;&lt;P&gt;      append t_body.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form write_unix_file.&lt;/P&gt;&lt;P&gt;  open dataset myfile for output in text mode.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.                                         &lt;/P&gt;&lt;P&gt;    write sy-subrc to w_subrc.                              &lt;/P&gt;&lt;P&gt;    concatenate 'Problem opening' myfile 'to UNIX.' w_subrc&lt;/P&gt;&lt;P&gt;                    into t_body-line separated by space.      &lt;/P&gt;&lt;P&gt;    append t_body.                                            &lt;/P&gt;&lt;P&gt;    concatenate p_maber 'Invoice Load problems encountered'&lt;/P&gt;&lt;P&gt;                       into w_subject.                      &lt;/P&gt;&lt;P&gt;    perform send_mail.                                      &lt;/P&gt;&lt;P&gt;    message a000 with 'Problem opening UNIX.' sy-subrc." stop processing because transfer will short dump&lt;/P&gt;&lt;P&gt;  endif.                              "problem with open &lt;/P&gt;&lt;P&gt;  loop at t_invoice.&lt;/P&gt;&lt;P&gt;    transfer t_invoice to myfile.&lt;/P&gt;&lt;P&gt;  endloop.                            "loop through invoices&lt;/P&gt;&lt;P&gt;  close dataset myfile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For further details take a look into your ABAP online help for keyword DATASET.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps,&lt;/P&gt;&lt;P&gt;  Oliver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jul 2006 07:20:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/working-with-file/m-p/1448164#M212443</guid>
      <dc:creator>oliver</dc:creator>
      <dc:date>2006-07-12T07:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: Working with File</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/working-with-file/m-p/1448165#M212444</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;You can do that with the help of OPEN DATASET(to open the file for open an existing or to create new one), READ DATASET (to read the file), Transafer to transfer the content, Close dataset to close the file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this will write the content of itab to application server.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;open dataset ds for output in text mode endcoding default.

if sy-subrc  = 0.

loop at itab.
transfer itab to ds.
endloop.
endif. 

close dataset ds.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jul 2006 07:35:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/working-with-file/m-p/1448165#M212444</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-12T07:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: Working with File</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/working-with-file/m-p/1448166#M212445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the following &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basic form 1 &lt;/P&gt;&lt;P&gt;OPEN DATASET dsn. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Extras: &lt;/P&gt;&lt;P&gt;1a. ... FOR INPUT &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1b. ... FOR OUTPUT &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1c. ... FOR APPENDING &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1d. ... FOR UPDATE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2a. ... IN BINARY MODE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2b. ... IN TEXT MODE [ENCODING (DEFAULT|UTF-8|NON-UNICODE)] &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2c. ... IN LEGACY BINARY MODE [(BIG|LITTLE) ENDIAN] [CODE PAGE cp] &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2d. ... IN LEGACY TEXT MODE [(BIG|LITTLE) ENDIAN] [CODE PAGE cp] &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. ... REPLACEMENT CHARACTER rc &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. ... IGNORING CONVERSION ERRORS &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. ... AT POSITION p &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6. ... TYPE c &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;7. ... MESSAGE m &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;8. ... FILTER f &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. For details see the section File Interface. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;Opens the specified file. If you do not specify a directory, the system uses the directory defined in the profile parameter DIR_HOME. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In programs without active Unicode check, the file is opened for reading in binary mode if you do not use any additions for OPENDATASET. To ensure downward compatibility with Releases &amp;lt;= 4.6, file names containing blanks are truncated at the position of the first blank. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In programs with active Unicode check, you must specify the access type (such as ... FOR INPUT, ... FOR OUTPUT, and so on) and the mode (such as ... IN TEXT MODE, ... IN BINARY MODE, and so on). If the file is opened using ... IN TEXT MODE, you must still use the addition ... ENCODING. If the Unicode check is enabled, it is possible to use file names containing blanks. Applying OPEN DATASET to a file already opened - in the same internal mode - triggers an exception of the type CX_SY_FILE_OPEN. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Return Code is set as follows: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SY-SUBRC = 0: &lt;/P&gt;&lt;P&gt;The file was opened. &lt;/P&gt;&lt;P&gt;SY-SUBRC = 8: &lt;/P&gt;&lt;P&gt;The file could not be opened. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go through the following Example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: v_hex type x,&lt;/P&gt;&lt;P&gt;v_bit type n.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;open dataset file_name for input in binary mode encoding default.&lt;/P&gt;&lt;P&gt;do.&lt;/P&gt;&lt;P&gt;read dataset file_name into v_hex.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;close dataset file_name&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do 8 times.&lt;/P&gt;&lt;P&gt;get bit sy-index of v_hex into v_bit.&lt;/P&gt;&lt;P&gt;write v_bit no-gap.&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards&lt;/P&gt;&lt;P&gt;Sreeni&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jul 2006 07:42:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/working-with-file/m-p/1448166#M212445</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-12T07:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: Working with File</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/working-with-file/m-p/1448167#M212446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ankur,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check help of following commands :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. OPEN DATASET  ( To open file in application server )&lt;/P&gt;&lt;P&gt;2. TRANSFER      ( Write text to file )&lt;/P&gt;&lt;P&gt;3. READ DATASET  ( Read from file )&lt;/P&gt;&lt;P&gt;4. CLOSE DATASET ( Close file in application server )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jul 2006 08:35:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/working-with-file/m-p/1448167#M212446</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-12T08:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: Working with File</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/working-with-file/m-p/1448168#M212447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;whenever u want to open a file for Reading (Input) or Writing (output) to a file .....&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;use the statement &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Open Dataset &amp;lt;Datasetname&amp;gt; for  [input or output] in [Textmode or Binary Mode] encoding Default.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;for example u declare as this&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Data : File_09(20) type c.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;File_09  is a Dataset in other terms its a Temporary buffer in which ur file is stored in application server ...&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;u assign some file to this ... say &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;File_09 = 'C:\DATA_01.TXT'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;this file path is just an example the file however is created in Appl. Server  ok...&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;then u open that dataset which points to the file C:\DATA_01.TXT&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;open Dataset File_09 for ouput in text mode encoding default .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;this says that u want to open a file pointed out by or referneced by file_09 for writing something into that file in text mode.  ok.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;suppose u have declared a internal table itab which u want to write to the file, then use ...&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;Transfer itab to file_09.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;then u need to close the dataset using &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;close dataset file_09.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sangeeta.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jul 2006 08:50:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/working-with-file/m-p/1448168#M212447</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-12T08:50:42Z</dc:date>
    </item>
  </channel>
</rss>

