<?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: How to write file to application server? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978047#M400480</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;Please check example codes from help.sap.com&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3c8c358411d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3c8c358411d1829f0000e829fbfe/frameset.htm&lt;/A&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;Ferry Lianto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 Feb 2007 20:25:54 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-02-26T20:25:54Z</dc:date>
    <item>
      <title>How to write file to application server?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978041#M400474</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 pass the sample code for writing file to Application server and Reading file from application server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want sample code for writing the file and reading the file from applicatioin server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Balaji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Feb 2007 20:18:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978041#M400474</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-26T20:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to write file to application server?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978042#M400475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is a sample.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001.

parameters: d1 type localfile default '/usr/sap/TST/SYS/Test.txt'.

data: begin of itab occurs 0,
      field1(20) type c,
      field2(20) type c,
      field3(20) type c,
      end of itab.
data: str type string.

constants: con_tab type x value '09'.

* if you have a newer version, then you can use this instead.
*constants:
*    con_tab  type c value cl_abap_char_utilities=&amp;gt;HORIZONTAL_TAB.

start-of-selection.

itab-field1 = 'ABC'.
itab-field2 = 'DEF'.
itab-field3 = 'GHI'.
append itab.

itab-field1 = '123'.
itab-field2 = '456'.
itab-field3 = '789'.
append itab.

  open dataset d1 for output in text mode.
  loop at itab.
    concatenate itab-field1 itab-field2 itab-field2 into str
                  separated by con_tab.
    transfer str to d1.
  endloop.
  close dataset d1.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Feb 2007 20:20:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978042#M400475</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-02-26T20:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to write file to application server?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978043#M400476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check these out for the same&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/file/file_downloadsap.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/file/file_downloadsap.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/file/file_uptabsap.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/file/file_uptabsap.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Feb 2007 20:21:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978043#M400476</guid>
      <dc:creator>former_member187255</dc:creator>
      <dc:date>2007-02-26T20:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to write file to application server?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978044#M400477</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;&amp;lt;b&amp;gt;For reading the file.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: &lt;/P&gt;&lt;P&gt;  dsn(20) VALUE '/usr/test.dat', &lt;/P&gt;&lt;P&gt;  rec(80) OCCURS 0 WITH HEADER LINE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET dsn. &lt;/P&gt;&lt;P&gt;IF sy-subrc = 0. &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 &amp;lt;&amp;gt; 0. &lt;/P&gt;&lt;P&gt;      EXIT. &lt;/P&gt;&lt;P&gt;    ELSE. &lt;/P&gt;&lt;P&gt;      APPEND rec.&lt;/P&gt;&lt;P&gt;    ENDIF. &lt;/P&gt;&lt;P&gt;  ENDDO. &lt;/P&gt;&lt;P&gt;ENDIF. &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;&amp;lt;b&amp;gt;For writing file&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: &lt;/P&gt;&lt;P&gt;  dsn(20) VALUE '/usr/test.dat', &lt;/P&gt;&lt;P&gt;  rec(80) OCCURS 0 WITH HEADER LINE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET dsn FOR OUTPUT. &lt;/P&gt;&lt;P&gt;IF sy-subrc = 0. &lt;/P&gt;&lt;P&gt;   LOOP AT REC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Write the file from the internal table.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      TRANSFER rec TO dsn. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   ENDLOOP. &lt;/P&gt;&lt;P&gt;ENDIF. &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;Thanks,&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Feb 2007 20:22:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978044#M400477</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-26T20:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to write file to application server?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978045#M400478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is another which is sort of like an application server file browser, you can click on each file and it will be read and displayed in a list display,  you can see how to read a file in the last part of this code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001 .

data: begin of itab occurs 0,
      rec(1000) type c,
      end of itab.
data: wa(1000) type c.

data: p_file type localfile.
data: ifile type table of  salfldir with header line.

parameters: p_path type salfile-longname
                    default '/usr/sap/TST/DVEBMGS01/data/'.


call function 'RZL_READ_DIR_LOCAL'
     exporting
          name           = p_path
     tables
          file_tbl       = ifile
     exceptions
          argument_error = 1
          not_found      = 2
          others         = 3.

loop at ifile.
  format hotspot on.
  write:/ ifile-name.
  hide ifile-name.
  format hotspot off.
endloop.


at line-selection.

  concatenate p_path ifile-name into p_file.

  clear itab.  refresh itab.
  open dataset p_file for input in text mode.
  if sy-subrc = 0.
    do.
      read dataset p_file into wa.
      if sy-subrc &amp;lt;&amp;gt; 0.
        exit.
      endif.
      itab-rec = wa.
      append itab.
    enddo.
  endif.
  close dataset p_file.

  loop at itab.
    write:/ itab.
  endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;RIch Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Feb 2007 20:23:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978045#M400478</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-02-26T20:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to write file to application server?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978046#M400479</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;Follow following path:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create A Logical Path On the server... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Open a DATA SEt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Transfer u r string to Data Site.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Close Data Set.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Feb 2007 20:25:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978046#M400479</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-26T20:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to write file to application server?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978047#M400480</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;Please check example codes from help.sap.com&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3c8c358411d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3c8c358411d1829f0000e829fbfe/frameset.htm&lt;/A&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;Ferry Lianto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Feb 2007 20:25:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978047#M400480</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-26T20:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to write file to application server?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978048#M400481</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;try these,Try with the following Code&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 ZTRAINING_FILE_UPLOAD_APPL *&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 ZTRAINING_FILE_UPLOAD_APPL message-id ztraining .&lt;/P&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;types&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;**-- types for data to be downloaded&lt;/P&gt;&lt;P&gt;types: begin of tp_kna1,&lt;/P&gt;&lt;P&gt;KUNNR type kna1-kunnr, " customer number&lt;/P&gt;&lt;P&gt;LAND1 type kna1-land1, " Country Key&lt;/P&gt;&lt;P&gt;NAME1 type kna1-name1, " customer name&lt;/P&gt;&lt;P&gt;ORT01 type kna1-ort01, " city&lt;/P&gt;&lt;P&gt;PSTLZ type kna1-pstlz, " postal code&lt;/P&gt;&lt;P&gt;REGIO type kna1-regio, " region&lt;/P&gt;&lt;P&gt;end of tp_kna1.&lt;/P&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;I n t e r n a l T a b l e s&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;**-- Internal table for data to be downloaded&lt;/P&gt;&lt;P&gt;data: it_kna1 type standard table of tp_kna1 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&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;S e l e c t i o n S c r e e n&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;selection-screen begin of block b1 with frame title text-001.&lt;/P&gt;&lt;P&gt;parameters: p_afile type rlgrap-filename&lt;/P&gt;&lt;P&gt;default 'customer.txt'.&lt;/P&gt;&lt;P&gt;selection-screen end of block b1.&lt;/P&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;&lt;/P&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;S t a r t o f s e l e c t i o n&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;start-of-selection.&lt;/P&gt;&lt;P&gt;*-- Upload the data from Sales Deal file&lt;/P&gt;&lt;P&gt;perform upload_app_file.&lt;/P&gt;&lt;P&gt;end-of-selection.&lt;/P&gt;&lt;P&gt;perform write_data.&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;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form upload_app_file&lt;/P&gt;&lt;P&gt;*&amp;amp;----&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;Upload the application server file data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form upload_app_file.&lt;/P&gt;&lt;P&gt;data: l_msg(100). " error message&lt;/P&gt;&lt;P&gt;open dataset p_afile for input in text mode encoding default message&lt;/P&gt;&lt;P&gt;l_msg.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message i004 with l_msg.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;do.&lt;/P&gt;&lt;P&gt;read dataset p_afile into it_kna1.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;append it_kna1.&lt;/P&gt;&lt;P&gt;clear it_kna1.&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 p_afile.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endform. " upload_app_file&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 write_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 write_data .&lt;/P&gt;&lt;P&gt;loop at it_kna1.&lt;/P&gt;&lt;P&gt;write:/ it_kna1-kunnr,&lt;/P&gt;&lt;P&gt;it_kna1-land1,&lt;/P&gt;&lt;P&gt;it_kna1-name1,&lt;/P&gt;&lt;P&gt;it_kna1-ort01,&lt;/P&gt;&lt;P&gt;it_kna1-pstlz,&lt;/P&gt;&lt;P&gt;it_kna1-regio.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;ENDFORM. " write_data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;__________________________________________________________________________________________________________________&lt;/P&gt;&lt;P&gt;Use the following code to achieve this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: lv_string TYPE string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONSTANTS : lc_comma TYPE char1 VALUE ','.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Open the file to write the output&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;GV_DSN is your file path &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;OPEN DATASET gv_dsn FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Display error if the path specified is incorrect&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;MESSAGE ID gc_msg_class&lt;/P&gt;&lt;P&gt;TYPE gc_error&lt;/P&gt;&lt;P&gt;NUMBER gc_msgno_266.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Prepare the Column Heading for the file&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CONCATENATE text-009&lt;/P&gt;&lt;P&gt;text-010&lt;/P&gt;&lt;P&gt;text-011&lt;/P&gt;&lt;P&gt;text-012&lt;/P&gt;&lt;P&gt;text-013&lt;/P&gt;&lt;P&gt;text-014&lt;/P&gt;&lt;P&gt;text-015&lt;/P&gt;&lt;P&gt;text-016&lt;/P&gt;&lt;P&gt;text-017&lt;/P&gt;&lt;P&gt;text-018&lt;/P&gt;&lt;P&gt;text-019&lt;/P&gt;&lt;P&gt;INTO lv_string&lt;/P&gt;&lt;P&gt;SEPARATED BY lc_comma .&lt;/P&gt;&lt;P&gt;TRANSFER lv_string TO gv_dsn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Start Writing into the file&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal table Git_Contract_data contains your data to * be written on the application server&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;LOOP AT git_contract_det INTO wa_contract_det.&lt;/P&gt;&lt;P&gt;CONCATENATE wa_contract_det-cust_ref&lt;/P&gt;&lt;P&gt;wa_contract_det-cont_acct_ref&lt;/P&gt;&lt;P&gt;wa_contract_det-cont_line_item_ref&lt;/P&gt;&lt;P&gt;wa_contract_det-sap_site_ref&lt;/P&gt;&lt;P&gt;wa_contract_det-user_site_ref&lt;/P&gt;&lt;P&gt;wa_contract_det-mprn&lt;/P&gt;&lt;P&gt;wa_contract_det-contract_status&lt;/P&gt;&lt;P&gt;wa_contract_det-selection_criteria&lt;/P&gt;&lt;P&gt;wa_contract_det-credit_score&lt;/P&gt;&lt;P&gt;wa_contract_det-pl_cont_stdate&lt;/P&gt;&lt;P&gt;wa_contract_det-cont_stdate&lt;/P&gt;&lt;P&gt;INTO lv_string&lt;/P&gt;&lt;P&gt;SEPARATED BY lc_comma .&lt;/P&gt;&lt;P&gt;TRANSFER lv_string TO gv_dsn.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Close the File&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CLOSE DATASET gv_dsn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM. " f7000_write_output&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;___________________________________________________________________________________________________________________&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To read data from App server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;open dataset p_fleunx for input in text mode.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;write: / 'Process will be aborted.'.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Load internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;do.&lt;/P&gt;&lt;P&gt;read dataset p_fleunx into fltab.&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;append fltab.&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To write to App. server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;open dataset p_fleunx for output in text mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at fltab.&lt;/P&gt;&lt;P&gt;transfer fltab to p_fleunx.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;close dataset p_fleunx. &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;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;P&gt;&lt;/P&gt;&lt;P&gt;___________________________________________________________________________________________________________________&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Feb 2007 00:59:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978048#M400481</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-27T00:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to write file to application server?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978049#M400482</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;check out this code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  znavneeth1_seq.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="--------------------------" /&gt;&lt;P&gt;*TABLES&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="--------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES : zvh4479 ,&lt;/P&gt;&lt;P&gt;         vbap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : i_tab1 LIKE STANDARD TABLE OF zvh4479s WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;DATA : i_tab2 LIKE STANDARD TABLE OF zvh4479  WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;DATA : i_tab3 LIKE STANDARD TABLE OF zvh4479s WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="--------------------------" /&gt;&lt;P&gt;*VARIABLES&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="--------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : ds1 TYPE string VALUE 'SEQ1.DAT'.&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;/P&gt;&lt;HR originaltext="--------------------------" /&gt;&lt;P&gt;*START-OF-SELECTION&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="--------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; SELECT *&lt;/P&gt;&lt;P&gt;  INTO TABLE I_TAB2&lt;/P&gt;&lt;P&gt;  FROM ZVH4479.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at i_tab2.&lt;/P&gt;&lt;P&gt;move-corresponding i_tab2 to i_tab1.&lt;/P&gt;&lt;P&gt;append i_tab1.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  MESSAGE 'NO HEADER DATA' TYPE 'E'.&lt;/P&gt;&lt;P&gt;&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;*----&lt;/P&gt;&lt;HR originaltext="-------------------------" /&gt;&lt;P&gt;*DATASET OPERATIONS&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET ds1&lt;/P&gt;&lt;P&gt; FOR OUTPUT&lt;/P&gt;&lt;P&gt;  IN TEXT MODE ENCODING NON-UNICODE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT i_tab1.&lt;/P&gt;&lt;P&gt;    TRANSFER i_tab1 TO ds1.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  MESSAGE 'DATASET COULD NOT BE OPENED 1' TYPE 'E'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLOSE DATASET ds1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET ds1&lt;/P&gt;&lt;P&gt; FOR INPUT&lt;/P&gt;&lt;P&gt;  IN TEXT MODE ENCODING DEFAULT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  BREAK-POINT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DO.&lt;/P&gt;&lt;P&gt;    READ DATASET ds1 INTO i_tab3.&lt;/P&gt;&lt;P&gt;    IF sy-subrc EQ 4.&lt;/P&gt;&lt;P&gt;      EXIT.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;    APPEND i_tab3.&lt;/P&gt;&lt;P&gt;    CLEAR i_tab3.&lt;/P&gt;&lt;P&gt;  ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  MESSAGE 'DATASET COULD NOT BE OPENED 2' TYPE 'E'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLOSE DATASET ds1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="--------------------------" /&gt;&lt;P&gt;*END-OF-SELECTION&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="--------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE :/1 'INTRENAL TABLE 1'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT i_tab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  WRITE :/1 i_tab1-vbeln ,&lt;/P&gt;&lt;P&gt;         10 i_tab1-erdat ,&lt;/P&gt;&lt;P&gt;         20 i_tab1-ernam ,&lt;/P&gt;&lt;P&gt;         30 i_tab1-lifnr ,&lt;/P&gt;&lt;P&gt;         40 i_tab1-name1 ,&lt;/P&gt;&lt;P&gt;         50 i_tab1-netwr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE :/1 'INTRENAL TABLE 3'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT i_tab3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  WRITE :/1 i_tab3-vbeln ,&lt;/P&gt;&lt;P&gt;         10 i_tab3-erdat ,&lt;/P&gt;&lt;P&gt;         20 i_tab3-ernam ,&lt;/P&gt;&lt;P&gt;         30 i_tab3-lifnr ,&lt;/P&gt;&lt;P&gt;         40 i_tab3-name1 ,&lt;/P&gt;&lt;P&gt;         50 i_tab3-netwr.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the table declard here may not be present in your system just replace it with any of your tables&lt;/P&gt;&lt;P&gt;reward points if helpfull&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Feb 2007 03:05:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978049#M400482</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-27T03:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to write file to application server?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978050#M400483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Balaji,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the simple example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : V_COUNTR LIKE EDIDS-COUNTR,&lt;/P&gt;&lt;P&gt;            FNAME(255) TYPE C VALUE '/data/sapdata/eu_ums/astdetails'.&lt;/P&gt;&lt;P&gt;           CONSTANTS : C_COMMA TYPE C VALUE ','.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Column Headings for output.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------" /&gt;&lt;P&gt;I_FINAL-DOCNUM = 'IDOCNO'.&lt;/P&gt;&lt;P&gt;I_FINAL-STATXT = 'ERROR TEXT'.&lt;/P&gt;&lt;P&gt;I_FINAL-STAPA1 = 'ERROR DETAILS'.&lt;/P&gt;&lt;P&gt;I_FINAL-QMNUM = 'NOTIFICATION'.&lt;/P&gt;&lt;P&gt;I_FINAL-ZASSETCLASS = 'ASSETCLASS'.&lt;/P&gt;&lt;P&gt;I_FINAL-ZDATACODE = 'DATACODE'.&lt;/P&gt;&lt;P&gt;I_FINAL-ZMFRCODE = 'MANUFACTURER'.&lt;/P&gt;&lt;P&gt;I_FINAL-ZMODELCODE = 'MODELCODE'.&lt;/P&gt;&lt;P&gt;I_FINAL-ZSERNO = 'SERIALNO'.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;INSERT I_FINAL INDEX 1.&lt;/P&gt;&lt;P&gt;CLEAR I_FINAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Moving the records to file&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT I_FINAL.&lt;/P&gt;&lt;P&gt;    CONCATENATE&lt;/P&gt;&lt;P&gt;        I_FINAL-DOCNUM&lt;/P&gt;&lt;P&gt;        I_FINAL-STATXT&lt;/P&gt;&lt;P&gt;        I_FINAL-STAPA1&lt;/P&gt;&lt;P&gt;        I_FINAL-QMNUM&lt;/P&gt;&lt;P&gt;        I_FINAL-ZASSETCLASS&lt;/P&gt;&lt;P&gt;        I_FINAL-ZDATACODE&lt;/P&gt;&lt;P&gt;        I_FINAL-ZMFRCODE&lt;/P&gt;&lt;P&gt;        I_FINAL-ZMODELCODE&lt;/P&gt;&lt;P&gt;        I_FINAL-ZSERNO&lt;/P&gt;&lt;P&gt;          into I_DISPLAY-REC SEPARATED BY C_COMMA.&lt;/P&gt;&lt;P&gt;     APPEND I_DISPLAY.&lt;/P&gt;&lt;P&gt;     CLEAR I_DISPLAY.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt; OPEN DATASET FNAME FOR OUTPUT IN TEXT MODE.&lt;/P&gt;&lt;P&gt;      LOOP AT I_DISPLAY.&lt;/P&gt;&lt;P&gt;        TRANSFER I_DISPLAY TO  FNAME.&lt;/P&gt;&lt;P&gt;      ENDLOOP.&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;Pls. Reward for all useful answers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Feb 2007 03:10:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978050#M400483</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-27T03:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to write file to application server?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978051#M400484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;    Below is my code for writing file to application server.I am getting the error as below 'System tried to access the file 'E:\usr\sap\PMG\D00\data' but it is not opened.Open the file before accessing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: d1(80) type C value 'E:\usr\sap\PMG\D00\data'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of itab occurs 0,&lt;/P&gt;&lt;P&gt;      field1(20) type c,&lt;/P&gt;&lt;P&gt;      field2(20) type c,&lt;/P&gt;&lt;P&gt;      field3(20) type c,&lt;/P&gt;&lt;P&gt;      end of itab.&lt;/P&gt;&lt;P&gt;data: str type string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*constants: con_tab type x value '09'.&lt;/P&gt;&lt;P&gt;&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;itab-field1 = 'ABC'.&lt;/P&gt;&lt;P&gt;itab-field2 = 'DEF'.&lt;/P&gt;&lt;P&gt;itab-field3 = 'GHI'.&lt;/P&gt;&lt;P&gt;append itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab-field1 = '123'.&lt;/P&gt;&lt;P&gt;itab-field2 = '456'.&lt;/P&gt;&lt;P&gt;itab-field3 = '789'.&lt;/P&gt;&lt;P&gt;append itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  open dataset d1 for output in text mode encoding default.&lt;/P&gt;&lt;P&gt;  loop at itab.&lt;/P&gt;&lt;P&gt;    concatenate itab-field1 itab-field2 itab-field2 into str&lt;/P&gt;&lt;P&gt;                  separated by space.&lt;/P&gt;&lt;P&gt;    transfer str to d1.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you any one please suggest me what might be the error.This path 'E:\usr\sap\PMG\D00\data' is there in AL11.How to place file in that location and what should be the extension for that file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Balaji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Feb 2007 20:42:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978051#M400484</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-28T20:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to write file to application server?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978052#M400485</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;Please try to declare like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: d1(80) type C value '/usr/sap/PMG/D00/data'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ferry Lianto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Feb 2007 20:46:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978052#M400485</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-28T20:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to write file to application server?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978053#M400486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This works for us:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: dsn(40) VALUE '&lt;BR /&gt;sapdev1\Filename.txt'.&lt;/P&gt;&lt;P&gt;DATA: wa_itab like line of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET dsn FOR APPENDING IN TEXT MODE.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;LOOP AT ITAB INTO wa_itab.&lt;/P&gt;&lt;P&gt;  &amp;lt;&amp;lt; code removed&amp;gt;&amp;gt;&lt;/P&gt;&lt;P&gt;  TRANSFER wa_itab TO '&lt;BR /&gt;sapdev1\Filename.txt'.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;CLOSE DATASET dsn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Feb 2007 21:12:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978053#M400486</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-28T21:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to write file to application server?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978054#M400487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try specifying a filename instead of a directory name&lt;/P&gt;&lt;P&gt;use &amp;lt;b&amp;gt;E:\usr\sap\PMG\D00\data.txt&amp;lt;/b&amp;gt; instead of E:\usr\sap\PMG\D00\data&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Mar 2007 06:05:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978054#M400487</guid>
      <dc:creator>former_member189059</dc:creator>
      <dc:date>2007-03-05T06:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to write file to application server?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978055#M400488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi every one..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it was really great code..but i've a question regarding the same so why i did not open the new thread. My question is how do we come to know whether the data from the internal table is successful transferred to the DSN on the application server..plz tell me except using sy-subrc or the tcode AL11.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;shamim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Mar 2007 07:35:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978055#M400488</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-05T07:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to write file to application server?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978056#M400489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use transaction CG3Y to transfer the file to your presentation server and then view the file to see if the data in it is correct&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Mar 2007 07:42:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-write-file-to-application-server/m-p/1978056#M400489</guid>
      <dc:creator>former_member189059</dc:creator>
      <dc:date>2007-03-05T07:42:08Z</dc:date>
    </item>
  </channel>
</rss>

