<?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: Append statement.. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490769#M562160</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Yes you need to keep appending the data to that internal tables because these data you aregetting from different selects ..&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; sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Jul 2007 05:38:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-13T05:38:14Z</dc:date>
    <item>
      <title>Append statement..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490763#M562154</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; While populating data from different select statements ie. ,from different tables do we need to keep appending the final table after each select statement..or just append after the last select would be suffecient....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Khan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2007 05:31:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490763#M562154</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-13T05:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Append statement..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490764#M562155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;when you loop the 1st table and you can append 2nd table like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS: p_carrid TYPE sflight-carrid, &lt;/P&gt;&lt;P&gt;            p_connid TYPE sflight-connid. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF seats, &lt;/P&gt;&lt;P&gt;        fldate TYPE sflight-fldate, &lt;/P&gt;&lt;P&gt;        seatsocc TYPE sflight-seatsocc, &lt;/P&gt;&lt;P&gt;        seatsmax TYPE sflight-seatsmax, &lt;/P&gt;&lt;P&gt;        seatsfree TYPE sflight-seatsocc, &lt;/P&gt;&lt;P&gt;      END OF seats. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA seats_tab LIKE STANDARD TABLE OF seats &lt;/P&gt;&lt;P&gt;               INITIAL SIZE 3. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT fldate seatsocc seatsmax &lt;/P&gt;&lt;P&gt;       FROM sflight &lt;/P&gt;&lt;P&gt;       INTO seats &lt;/P&gt;&lt;P&gt;       WHERE carrid = p_carrid AND &lt;/P&gt;&lt;P&gt;             connid = p_connid. &lt;/P&gt;&lt;P&gt;  seats-seatsfree = seats-seatsmax - seats-seatsocc. &lt;/P&gt;&lt;P&gt;  APPEND seats TO seats_tab SORTED BY seatsfree. &lt;/P&gt;&lt;P&gt;ENDSELECT. &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;P&gt;DATA: int  TYPE i, &lt;/P&gt;&lt;P&gt;      itab LIKE SORTED TABLE OF int &lt;/P&gt;&lt;P&gt;           WITH UNIQUE KEY table_line. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO 10 TIMES. &lt;/P&gt;&lt;P&gt;  int = sy-index ** 2. &lt;/P&gt;&lt;P&gt;  APPEND int TO itab. &lt;/P&gt;&lt;P&gt;ENDDO. &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;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Alvaro Tejada Galindo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2007 05:34:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490764#M562155</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-13T05:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: Append statement..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490765#M562156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;not required&lt;/P&gt;&lt;P&gt;because you are using&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;select&amp;lt;/b&amp;gt; * from tab1 &amp;lt;b&amp;gt; into&amp;lt;/b&amp;gt; table tab2.&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;prasant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2007 05:35:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490765#M562156</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-13T05:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Append statement..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490766#M562157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Khan,&lt;/P&gt;&lt;P&gt;in that case you use select statement with 'into table' option then u need not append each and every time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u follow this for every select statement if found useful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2007 05:37:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490766#M562157</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-13T05:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Append statement..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490767#M562158</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;1. Creata a work area for ur final internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Select the data from table into these work area fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Finally after All selection append this to final Internal Table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Reshma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2007 05:37:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490767#M562158</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-13T05:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: Append statement..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490768#M562159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;JK , &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select-endselect ---&amp;gt; creates a loop , so u have to append each and every record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;otherwise &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from mara &lt;/P&gt;&lt;P&gt;into corresponding fields of table i_mara.&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;Peram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2007 05:37:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490768#M562159</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-13T05:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Append statement..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490769#M562160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Yes you need to keep appending the data to that internal tables because these data you aregetting from different selects ..&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; sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2007 05:38:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490769#M562160</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-13T05:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: Append statement..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490770#M562161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Appending Table Lines &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are several ways of adding lines to index tables. The following statements have no equivalent that applies to all internal tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appending a Single Line&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To add a line to an index table, use the statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND &amp;lt;line&amp;gt; TO &amp;lt;itab&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;line&amp;gt; is either a work area that is convertible to the line type, or the expression INITIAL LINE. If you use &amp;lt;wa&amp;gt;, the system adds a new line to the internal table &amp;lt;itab&amp;gt; and fills it with the contents of the work area. INITIAL LINE appends a blank line containing the correct initial value for each field of the structure. After each APPEND statement, the system field SY-TABIX contains the index of the appended line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appending lines to standard tables and sorted tables with a non-unique key works regardless of whether lines with the same key already exist in the table. Duplicate entries may occur. A runtime error occurs if you attempt to add a duplicate entry to a sorted table with a unique key. Equally, a runtime error occurs if you violate the sort order of a sorted table by appending to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appending Several Lines&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also append internal tables to index tables using the following statement: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND LINES OF &amp;lt;itab1&amp;gt; TO &amp;lt;itab2&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement appends the whole of ITAB1 to ITAB2. ITAB1 can be any type of table, but its line type must be convertible into the line type of ITAB2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you append an index table to another index table, you can specify the lines to be appended as follows: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND LINES OF &amp;lt;itab1&amp;gt; [FROM &amp;lt;n1&amp;gt;] [TO &amp;lt;n 2&amp;gt;] TO &amp;lt;itab2&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;n 1 &amp;gt; and &amp;lt;n 2 &amp;gt; specify the indexes of the first and last lines of ITAB1 that you want to append to ITAB2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This method of appending lines of one table to another is about 3 to 4 times faster than appending them line by line in a loop. After the APPEND statement, the system field SY-TABIX contains the index of the last line appended. When you append several lines to a sorted table, you must respect the unique key (if defined), and not violate the sort order. Otherwise, a runtime error will occur. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ranked lists&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the APPEND statement to create ranked lists in standard tables. To do this, create an empty table, and then use the statement: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND &amp;lt;wa&amp;gt; TO &amp;lt;itab&amp;gt; SORTED BY &amp;lt;f&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The new line is not added to the end of the internal table &amp;lt;itab&amp;gt;. Instead, the table is sorted by field &amp;lt;f&amp;gt; in descending order. The work area &amp;lt;wa&amp;gt; must be compatible with the line type of the internal table. You cannot use the SORTED BY addition with sorted tables. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you use this technique, the internal table may only contain as many entries as you specified in the INITIAL SIZE parameter of the table declaration. This is an exception to the general rule, where internal tables can be extended dynamically. If you add more lines than specified, the last line is discarded. This is useful for creating ranked lists of limited length (for example "Top Ten"). You can use the APPEND statement to generate ranked lists containing up to 100 entries. When dealing with larger lists, it is advisable to sort tables normally for performance reasons.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Examples&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF WA,&lt;/P&gt;&lt;P&gt;        COL1 TYPE C,&lt;/P&gt;&lt;P&gt;        COL2 TYPE I,&lt;/P&gt;&lt;P&gt;      END OF WA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA ITAB LIKE TABLE OF WA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO 3 TIMES.&lt;/P&gt;&lt;P&gt;  APPEND INITIAL LINE TO ITAB.&lt;/P&gt;&lt;P&gt;  WA-COL1 = SY-INDEX. WA-COL2 = SY-INDEX ** 2.&lt;/P&gt;&lt;P&gt;  APPEND WA TO ITAB.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB INTO WA.&lt;/P&gt;&lt;P&gt;  WRITE: / WA-COL1, WA-COL2.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output is: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          0&lt;/P&gt;&lt;P&gt;1         1&lt;/P&gt;&lt;P&gt;          0&lt;/P&gt;&lt;P&gt;2         4&lt;/P&gt;&lt;P&gt;          0&lt;/P&gt;&lt;P&gt;3         9&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example creates an internal table ITAB with two columns that is filled in the DO loop. Each time the processing passes through the loop, an initialized line is appended and then the table work area is filled with the loop index and the square root of the loop index and appended. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF LINE1,&lt;/P&gt;&lt;P&gt;        COL1(3) TYPE C,&lt;/P&gt;&lt;P&gt;        COL2(2) TYPE N,&lt;/P&gt;&lt;P&gt;        COL3    TYPE I,&lt;/P&gt;&lt;P&gt;      END OF LINE1,&lt;/P&gt;&lt;P&gt;      TAB1 LIKE TABLE OF LINE1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF LINE2,&lt;/P&gt;&lt;P&gt;        FIELD1(1)  TYPE C,&lt;/P&gt;&lt;P&gt;        FIELD2     LIKE TAB1,&lt;/P&gt;&lt;P&gt;      END OF LINE2,&lt;/P&gt;&lt;P&gt;      TAB2 LIKE TABLE OF LINE2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LINE1-COL1 = 'abc'. LINE1-COL2 = '12'. LINE1-COL3 = 3.&lt;/P&gt;&lt;P&gt;APPEND LINE1 TO TAB1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LINE1-COL1 = 'def'. LINE1-COL2 = '34'. LINE1-COL3 = 5.&lt;/P&gt;&lt;P&gt;APPEND LINE1 TO TAB1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LINE2-FIELD1 = 'A'. LINE2-FIELD2 = TAB1.&lt;/P&gt;&lt;P&gt;APPEND LINE2 TO TAB2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REFRESH TAB1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LINE1-COL1 = 'ghi'. LINE1-COL2 = '56'. LINE1-COL3 = 7.&lt;/P&gt;&lt;P&gt;APPEND LINE1 TO TAB1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LINE1-COL1 = 'jkl'. LINE1-COL2 = '78'. LINE1-COL3 = 9.&lt;/P&gt;&lt;P&gt;APPEND LINE1 TO TAB1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LINE2-FIELD1 = 'B'. LINE2-FIELD2 = TAB1.&lt;/P&gt;&lt;P&gt;APPEND LINE2 TO TAB2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT TAB2 INTO LINE2.&lt;/P&gt;&lt;P&gt;  WRITE: / LINE2-FIELD1.&lt;/P&gt;&lt;P&gt;  LOOP AT LINE2-FIELD2 INTO LINE1.&lt;/P&gt;&lt;P&gt;    WRITE: / LINE1-COL1, LINE1-COL2, LINE1-COL3.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output is: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A&lt;/P&gt;&lt;P&gt;abc 12          3&lt;/P&gt;&lt;P&gt;def 34          5&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;&lt;P&gt;ghi 56          7&lt;/P&gt;&lt;P&gt;jkl 78          9&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example creates two internal tables TAB1 and TAB2. TAB2 has a deep structure because the second component of LINE2 has the data type of internal table TAB1. LINE1 is filled and appended to TAB1. Then, LINE2 is filled and appended to TAB2. After clearing TAB1 with the REFRESH statement, the same procedure is repeated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF LINE,&lt;/P&gt;&lt;P&gt;        COL1 TYPE C,&lt;/P&gt;&lt;P&gt;        COL2 TYPE I,&lt;/P&gt;&lt;P&gt;      END OF LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: ITAB LIKE TABLE OF LINE,&lt;/P&gt;&lt;P&gt;      JTAB LIKE ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO 3 TIMES.&lt;/P&gt;&lt;P&gt;  LINE-COL1 = SY-INDEX. LINE-COL2 = SY-INDEX ** 2.&lt;/P&gt;&lt;P&gt;  APPEND LINE TO ITAB.&lt;/P&gt;&lt;P&gt;  LINE-COL1 = SY-INDEX. LINE-COL2 = SY-INDEX ** 3.&lt;/P&gt;&lt;P&gt;  APPEND LINE TO JTAB.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND LINES OF JTAB FROM 2 TO 3 TO ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB INTO LINE.&lt;/P&gt;&lt;P&gt;  WRITE: / LINE-COL1, LINE-COL2.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1         1&lt;/P&gt;&lt;P&gt;2         4&lt;/P&gt;&lt;P&gt;3         9&lt;/P&gt;&lt;P&gt;2         8&lt;/P&gt;&lt;P&gt;3        27&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example creates two internal tables of the same type, ITAB and JTAB. In the DO loop, ITAB is filled with a list of square numbers, and JTAB with a list of cube numbers. Then, the last two lines of JTAB are appended to ITAB. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF LINE,&lt;/P&gt;&lt;P&gt;        COL1 TYPE I,&lt;/P&gt;&lt;P&gt;        COL2 TYPE I,&lt;/P&gt;&lt;P&gt;        COL3 TYPE I,&lt;/P&gt;&lt;P&gt;       END OF LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA ITAB LIKE TABLE OF LINE INITIAL SIZE 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LINE-COL1 = 1. LINE-COL2 = 2. LINE-COL3 = 3.&lt;/P&gt;&lt;P&gt;APPEND LINE TO ITAB SORTED BY COL2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LINE-COL1 = 4. LINE-COL2 = 5. LINE-COL3 = 6.&lt;/P&gt;&lt;P&gt;APPEND LINE TO ITAB SORTED BY COL2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LINE-COL1 = 7. LINE-COL2 = 8. LINE-COL3 = 9.&lt;/P&gt;&lt;P&gt;APPEND LINE TO ITAB SORTED BY COL2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB INTO LINE.&lt;/P&gt;&lt;P&gt;  WRITE: / LINE-COL2.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output is: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         8&lt;/P&gt;&lt;P&gt;         5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The program inserts three lines into the internal table ITAB using the APPEND statement and the SORTED BY addition. The line with the smallest value for the field COL2 is deleted from the table, since the number of lines that can be appended is fixed through the INITIAL SIZE 2 addition in the DATA statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; regards....&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Alvaro Tejada Galindo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2007 05:38:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490770#M562161</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-13T05:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Append statement..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490771#M562162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jareer:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use this SQL as an example. It appends into final table i_results..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  select pa0014~pernr as pernr&lt;/P&gt;&lt;P&gt;         zhrccroll~begda as ccbegda&lt;/P&gt;&lt;P&gt;         zhrccroll~endda as ccendda&lt;/P&gt;&lt;P&gt;         pa0014~aedtm as aedtm&lt;/P&gt;&lt;P&gt;         pa0014~uname as uname&lt;/P&gt;&lt;P&gt;         pa0001~kostl as kostl&lt;/P&gt;&lt;P&gt;         pa0014~begda as itbegda&lt;/P&gt;&lt;P&gt;         pa0014~endda as itendda&lt;/P&gt;&lt;P&gt;  appending corresponding  fields of table i_results&lt;/P&gt;&lt;P&gt;  from pa0014&lt;/P&gt;&lt;P&gt;  inner join pa0001&lt;/P&gt;&lt;P&gt;  on pa0014&lt;SUB&gt;pernr = pa0001&lt;/SUB&gt;pernr&lt;/P&gt;&lt;P&gt;  inner join zhrccroll&lt;/P&gt;&lt;P&gt;  on pa0001&lt;SUB&gt;kostl = zhrccroll&lt;/SUB&gt;kostl&lt;/P&gt;&lt;P&gt;  for all entries in i_it01&lt;/P&gt;&lt;P&gt;  where pa0014~pernr = i_it01-pernr&lt;/P&gt;&lt;P&gt;  and pa0001~kostl = i_it01-kostl&lt;/P&gt;&lt;P&gt;  and zhrccroll~kostl = i_it01-kostl&lt;/P&gt;&lt;P&gt;  and zhrccroll~syst = 'STAFF'&lt;/P&gt;&lt;P&gt;  and pa0014~aedtm = p_date&lt;/P&gt;&lt;P&gt;  and pa0014~uname in so_name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mithun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Sep 2007 15:33:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-statement/m-p/2490771#M562162</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-18T15:33:46Z</dc:date>
    </item>
  </channel>
</rss>

