<?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: App Server Dnld in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414656#M199546</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If there are decimals, I would suggest that you out put the data to a str first then transfer the string.  Here is a sample program.&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.
&amp;lt;b&amp;gt;    concatenate itab-field1 itab-field2 itab-field2 into str
                  separated by con_tab.
    transfer str to d1.&amp;lt;/b&amp;gt;
  endloop.
  close dataset d1.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Transfering "TEST" will give you garbage for packed fields.&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;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Jul 2006 20:46:39 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2006-07-18T20:46:39Z</dc:date>
    <item>
      <title>App Server Dnld</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414654#M199544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     I need to do an App server download for data in a table. For example, to download data from PA0008 here is what i have.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: test type pa0008 occurs 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from pa0008 into table test up to 10 rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: e_file like rlgrap-filename value '/usr/sap/tmp/test1.txt'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;open dataset e_file for output in text mode encoding default.&lt;/P&gt;&lt;P&gt;lOOP AT test.&lt;/P&gt;&lt;P&gt;transfer ????? to e_file.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;close dataset e_file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what should i write after transfer?. I need all columns from pa0008. It has columns of type decimal too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sandeep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jul 2006 20:43:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414654#M199544</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-18T20:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: App Server Dnld</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414655#M199545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try as below&lt;/P&gt;&lt;P&gt;lOOP AT test.&lt;/P&gt;&lt;P&gt;transfer &amp;lt;b&amp;gt;test&amp;lt;/b&amp;gt; to e_file.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regds&lt;/P&gt;&lt;P&gt;Manohar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jul 2006 20:46:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414655#M199545</guid>
      <dc:creator>Manohar2u</dc:creator>
      <dc:date>2006-07-18T20:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: App Server Dnld</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414656#M199546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If there are decimals, I would suggest that you out put the data to a str first then transfer the string.  Here is a sample program.&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.
&amp;lt;b&amp;gt;    concatenate itab-field1 itab-field2 itab-field2 into str
                  separated by con_tab.
    transfer str to d1.&amp;lt;/b&amp;gt;
  endloop.
  close dataset d1.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Transfering "TEST" will give you garbage for packed fields.&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;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jul 2006 20:46:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414656#M199546</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-07-18T20:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: App Server Dnld</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414657#M199547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works only if its char type. Doesnt work with decimals.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jul 2006 20:46:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414657#M199547</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-18T20:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: App Server Dnld</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414658#M199548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Concatenate all fields of itab to char fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regds&lt;/P&gt;&lt;P&gt;Manohar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jul 2006 20:48:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414658#M199548</guid>
      <dc:creator>Manohar2u</dc:creator>
      <dc:date>2006-07-18T20:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: App Server Dnld</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414659#M199549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried that earlier with field symbols. In other words assigning field value to a string and then writing it to app server. It worked fine with decimals, but then i faced an issue with date. It writes date in 1.1.2000 format rather than 20000101.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    do.&lt;/P&gt;&lt;P&gt;      assign component sy-index of structure &amp;lt;w_wa&amp;gt; to &amp;lt;w_field&amp;gt;.&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;      describe field &amp;lt;w_field&amp;gt; output-length v_len.&lt;/P&gt;&lt;P&gt;      write &amp;lt;w_field&amp;gt; to &amp;lt;w_data&amp;gt;+v_offset(v_len).&lt;/P&gt;&lt;P&gt;      v_offset = v_offset + v_len.&lt;/P&gt;&lt;P&gt;    enddo.&lt;/P&gt;&lt;P&gt;transfer &amp;lt;w_data&amp;gt; to p_file.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jul 2006 20:51:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414659#M199549</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-18T20:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: App Server Dnld</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414660#M199550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might be able to do this also.&lt;/P&gt;&lt;P&gt;&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: itab type table of pa0008 with header line.
data: str type string.

field-symbols: &amp;lt;fs&amp;gt;.
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.

  select * into table itab from pa0008 up to 100 rows.


  open dataset d1 for output in text mode.
  loop at itab.

    do .
      assign component sy-index of structure itab to &amp;lt;fs&amp;gt;.
      if sy-subrc &amp;lt;&amp;gt; 0.
        exit.
      endif.
      if sy-index = 1.
        str = &amp;lt;fs&amp;gt;.
      else.
        concatenate str &amp;lt;fs&amp;gt; into str
                    separated by con_tab.
      endif.
    enddo.

    transfer str to d1.
  endloop.
  close dataset d1.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&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>Tue, 18 Jul 2006 20:55:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414660#M199550</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-07-18T20:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: App Server Dnld</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414661#M199551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about we move the value to a type C field first.&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: itab type table of pa0008 with header line.
data: str type string.

field-symbols: &amp;lt;fs&amp;gt;.
&amp;lt;b&amp;gt;data: c(100) type c.&amp;lt;/b&amp;gt;
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.

  select * into table itab from pa0008 up to 100 rows.


  open dataset d1 for output in text mode.
  loop at itab.

    do .
      assign component sy-index of structure itab to &amp;lt;fs&amp;gt;.
      if sy-subrc &amp;lt;&amp;gt; 0.
        exit.
      endif.
&amp;lt;b&amp;gt;      c = &amp;lt;fs&amp;gt;.
      if sy-index = 1.
        str = c.
      else.
        concatenate str c into str
                    separated by con_tab.

      endif.&amp;lt;/b&amp;gt;
    enddo.
&amp;lt;b&amp;gt;    condense str no-gaps.&amp;lt;/b&amp;gt;
    transfer str to d1.
  endloop.
  close dataset d1.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This seems to work for me in my system.&lt;/P&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>Tue, 18 Jul 2006 21:01:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414661#M199551</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-07-18T21:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: App Server Dnld</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414662#M199552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are going to read the appserver file into sap again, use open dataset in binary mode for writing and reading.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use function module SAP_CONVERT_TO_TXT_FORMAT to write to file and when reading file use TEXT_CONVERT_TXT_TO_SAP to convert into PA0008 format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;type-pools: truxs.
data: itab_txt type truxs_t_text_data,
      itab_line like line of itab_txt.

data: test type pa0008 occurs 0 with header line.

data: e_file like rlgrap-filename value '/tmp/testpa8.txt'.

select * from pa0008 into table test up to 10 rows.

call function 'SAP_CONVERT_TO_TXT_FORMAT'
  tables
    i_tab_sap_data             =  test[]
 CHANGING
   I_TAB_CONVERTED_DATA       = itab_txt
 EXCEPTIONS
   CONVERSION_FAILED          = 1
   OTHERS                     = 2
          .

open dataset e_file for output in binary mode.

loop at itab_txt into itab_line.
  transfer itab_line to e_file.
endloop.

close dataset e_file.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are other function modules in func group TRUX, see if you can use them to write and read files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sridhar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Sridhar K&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jul 2006 21:42:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/app-server-dnld/m-p/1414662#M199552</guid>
      <dc:creator>sridhar_k1</dc:creator>
      <dc:date>2006-07-18T21:42:14Z</dc:date>
    </item>
  </channel>
</rss>

