<?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 Archive Program needed in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/archive-program-needed/m-p/2645218#M609217</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;   I had two tables ZCUST (100 records) and ZCUST_ARCH. I want to acrhive data from ZCUST to ZCUST_ARCH or to flat file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Aug 2007 10:31:46 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-24T10:31:46Z</dc:date>
    <item>
      <title>Archive Program needed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/archive-program-needed/m-p/2645218#M609217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;   I had two tables ZCUST (100 records) and ZCUST_ARCH. I want to acrhive data from ZCUST to ZCUST_ARCH or to flat file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2007 10:31:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/archive-program-needed/m-p/2645218#M609217</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-24T10:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: Archive Program needed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/archive-program-needed/m-p/2645219#M609218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;write one simple program like this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from into table itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;modify zztable from itab1.&lt;/P&gt;&lt;P&gt;commit work.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2007 10:35:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/archive-program-needed/m-p/2645219#M609218</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-24T10:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Archive Program needed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/archive-program-needed/m-p/2645220#M609219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt; copy this code and execute. in the output write ur program name ZCUST and it will automatically archive ur program to flat file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;infact with this code u can archive any flat file.See the beautity of the code as it also separates all includes in the program&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  Z71754_RAVISH
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

report  z71754_ravish.


tables: trdir, tadir.

types: type_levels like slevel occurs 0.
types: t_srclin type abaptxt255.
types: t_srccod type standard table of t_srclin.

data: i_replist type table of program,
      wa_replist like line of i_replist.
data :include_name type string.


data: buffer type t_srccod.

data: itab like buffer occurs 0,
      wa_itab like buffer.

data: i_stmnt type standard table of sstmnt,
      i_incl type standard table of program,
      i_token type standard table of stokes,
      levels type type_levels with header line,
      wa_token like line of i_token,
      wa_stmnt like line of i_stmnt.
data : inum type i value 0.

data: wa_itoken type stokes.
select-options : so_name for trdir-name.
parameters : pathname(40)    .                         "LIKE rlgrap-filename.

start-of-selection.

  select name
         from trdir
         into table i_replist
         where
               name in so_name.

  loop at i_replist into wa_replist.

    read report wa_replist into buffer.

    scan abap-source buffer
                         statements into i_stmnt
                         tokens into i_token
                         levels into levels
                         with includes.

    perform download_prog
*                TABLES
*                   buffer
                using
                   wa_replist.


    loop at levels where type eq 'P'.
      clear buffer[].
      read report levels-name into buffer.

      perform download_prog
*                  TABLES
*                     buffer
                  using
                     levels-name.
      clear levels.
    endloop.
  endloop.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  download_prog
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;PI_SRCCODE text
*      --&amp;gt;P_PROG     text
*----------------------------------------------------------------------*
form download_prog "TABLES buffer TYPE STANDARD TABLE
                    using p_fname.

  data: l_file type string.
  concatenate pathname p_fname '.TXT' into l_file.

  condense l_file no-gaps.

  call method cl_gui_frontend_services=&amp;gt;gui_download
    exporting
*    BIN_FILESIZE              =
      filename                  = l_file
      filetype                  = 'ASC'
      append                    = space
*    WRITE_FIELD_SEPARATOR     = SPACE
*    HEADER                    = '00'
*    TRUNC_TRAILING_BLANKS     = SPACE
*    WRITE_LF                  = 'X'
*    COL_SELECT                = SPACE
*    COL_SELECT_MASK           = SPACE
*    DAT_MODE                  = SPACE
*    CONFIRM_OVERWRITE         = SPACE
*    NO_AUTH_CHECK             = SPACE
*    CODEPAGE                  = SPACE
*    IGNORE_CERR               = ABAP_TRUE
*    REPLACEMENT               = '#'
*    WRITE_BOM                 = SPACE
*    TRUNC_TRAILING_BLANKS_EOL = 'X'
*  IMPORTING
*    FILELENGTH                =
    changing
      data_tab                  = buffer
    exceptions
      file_write_error          = 1
      no_batch                  = 2
      gui_refuse_filetransfer   = 3
      invalid_type              = 4
      no_authority              = 5
      unknown_error             = 6
      header_not_allowed        = 7
      separator_not_allowed     = 8
      filesize_not_allowed      = 9
      header_too_long           = 10
      dp_error_create           = 11
      dp_error_send             = 12
      dp_error_write            = 13
      unknown_dp_error          = 14
      access_denied             = 15
      dp_out_of_memory          = 16
      disk_full                 = 17
      dp_timeout                = 18
      file_not_found            = 19
      dataprovider_exception    = 20
      control_flush_error       = 21
      not_supported_by_gui      = 22
      error_no_gui              = 23
      others                    = 24
          .
  if sy-subrc &amp;lt;&amp;gt; 0.
    message id sy-msgid type sy-msgty number sy-msgno
               with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.
endform.                    "download_prog

&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;ravish&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;plz dont forget to reward points if helpful&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2007 10:37:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/archive-program-needed/m-p/2645220#M609219</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-24T10:37:14Z</dc:date>
    </item>
  </channel>
</rss>

