<?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: A Select statement with Appending table statement in it. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-select-statement-with-appending-table-statement-in-it/m-p/3382146#M812004</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dharma Raju,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; When you are using below statement there should be Endselect.Reason is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex: Your program is running very slow because of huge data(say 100000) in Database table and going Dump because of select statement into itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To come out from this problem You have to use PACKAGE SIZE in select statement .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PACKAGE SIZE : means every time your taking 20000 records and appending the records to ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That time you have to use APPENDING TABLE .&lt;/P&gt;&lt;P&gt;So every select statement will run with in time and append the records to itab.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Feb 2008 04:06:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-21T04:06:51Z</dc:date>
    <item>
      <title>A Select statement with Appending table statement in it.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-select-statement-with-appending-table-statement-in-it/m-p/3382142#M812000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  How can I use a select statement with a &amp;lt;Appening table&amp;gt; statement in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT DISTINCT &amp;lt;field Name&amp;gt;&lt;/P&gt;&lt;P&gt;                FROM &amp;lt;DB table name&amp;gt;&lt;/P&gt;&lt;P&gt;                APPENDING TABLE &amp;lt;itab&amp;gt;&lt;/P&gt;&lt;P&gt;                WHERE &amp;lt;fieldname&amp;gt; EQ &amp;lt;Itab1-fieldname&amp;gt;&lt;/P&gt;&lt;P&gt;                  AND &amp;lt;fieldname&amp;gt; EQ &amp;lt;itab2-fieldname&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I use the above select statement.If I'm using this...how this works?&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;Dharmaraju&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Feb 2008 01:17:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/a-select-statement-with-appending-table-statement-in-it/m-p/3382142#M812000</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-21T01:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: A Select statement with Appending table statement in it.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-select-statement-with-appending-table-statement-in-it/m-p/3382143#M812001</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 this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT LTAB1.&lt;/P&gt;&lt;P&gt;READ TABLE ITAB2 with KEY field1 = 'UR Value' or LTAB1-F1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT DISTINCT &amp;lt;field Name&amp;gt;&lt;/P&gt;&lt;P&gt;FROM &amp;lt;DB table name&amp;gt;&lt;/P&gt;&lt;P&gt;APPENDING TABLE &amp;lt;itab&amp;gt;&lt;/P&gt;&lt;P&gt;WHERE &amp;lt;fieldname&amp;gt; EQ &amp;lt;Itab1-fieldname&amp;gt;&lt;/P&gt;&lt;P&gt;AND &amp;lt;fieldname&amp;gt; EQ &amp;lt;itab2-fieldname&amp;gt;.&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;Hope it helps else..let us know ur reqmt..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Praveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Feb 2008 01:26:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/a-select-statement-with-appending-table-statement-in-it/m-p/3382143#M812001</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-21T01:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: A Select statement with Appending table statement in it.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-select-statement-with-appending-table-statement-in-it/m-p/3382144#M812002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Appending table will append the records (to an existing internal table with records in it) that are fetched from that select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For ex : see this below&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    SELECT bukrs kunnr umskz zuonr gjahr belnr bldat
           xblnr shkzg dmbtr wrbtr sgtxt zfbdt
           FROM bsid
           INTO TABLE it_accnt
           FOR ALL ENTRIES IN it_tab1
           WHERE bukrs EQ 'JTC1'
             AND kunnr EQ it_tab1-kunnr
             AND umskz IN so_umskz
             AND zuonr EQ it_tab1-zuonr
             AND bldat LE p_date.

 " when executed the above statement it_accnt might contain 10 records

    SELECT bukrs kunnr umskz zuonr gjahr belnr bldat
           xblnr shkzg dmbtr wrbtr sgtxt zfbdt
           FROM bsad
           APPENDING TABLE it_accnt
           FOR ALL ENTRIES IN it_tab1
           WHERE bukrs EQ 'JTC1'
             AND kunnr EQ it_tab1-kunnr
             AND umskz IN so_umskz
             AND zuonr EQ it_tab1-zuonr
             AND bldat LE p_date
             AND augdt GE p_date.
 " and now when this statement executed retrieves 10 more records from the table BSAD, 
 " then totally it_accnt contains 20 records.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this is clear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Gopi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Feb 2008 01:30:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/a-select-statement-with-appending-table-statement-in-it/m-p/3382144#M812002</guid>
      <dc:creator>gopi_narendra</dc:creator>
      <dc:date>2008-02-21T01:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: A Select statement with Appending table statement in it.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-select-statement-with-appending-table-statement-in-it/m-p/3382145#M812003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Dharma Raju Kondeti.&lt;/P&gt;&lt;P&gt;I found this in the SAP online help, hope this can help you.&lt;/P&gt;&lt;P&gt;Specifying Internal Tables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you read several lines of a database table, you can place them in an internal table. To do this, use the following in the INTO clause:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ... INTO|APPENDING [CORRESPONDING FIELDS OF] TABLE &amp;lt;itab&amp;gt;&lt;/P&gt;&lt;P&gt;                          [PACKAGE SIZE &amp;lt;n&amp;gt;] ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The same applies to the line type of &amp;lt;itab&amp;gt;, the way in which the data for a line of the database table are assigned to a table line, and the CORRESPONDING FIELDS addition as for flat work areas (see above).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The internal table is filled with all of the lines of the selection. When you use INTO, all existing lines in the table are deleted. When you use APPENDING; the new lines are added to the existing internal table &amp;lt;itab&amp;gt;. With APPENDING, the system adds the lines to the internal table appropriately for the table type. Fields in the internal table not affected by the selection are filled with initial values.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use the PACKAGE SIZE addition, the lines of the selection are not written into the internal table at once, but in packets. You can define packets of &amp;lt;n&amp;gt; lines that are written one after the other into the internal table. If you use INTO, each packet replaces the preceding one. If you use APPENDING, the packets are inserted one after the other. This is only possible in a loop that ends with ENDSELECT. Outside the SELECT loop, the contents of the internal table are undetermined. You must process the selected lines within the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;feng.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: feng zhang on Feb 21, 2008 10:20 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Feb 2008 02:20:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/a-select-statement-with-appending-table-statement-in-it/m-p/3382145#M812003</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-21T02:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: A Select statement with Appending table statement in it.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-select-statement-with-appending-table-statement-in-it/m-p/3382146#M812004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dharma Raju,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; When you are using below statement there should be Endselect.Reason is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex: Your program is running very slow because of huge data(say 100000) in Database table and going Dump because of select statement into itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To come out from this problem You have to use PACKAGE SIZE in select statement .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PACKAGE SIZE : means every time your taking 20000 records and appending the records to ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That time you have to use APPENDING TABLE .&lt;/P&gt;&lt;P&gt;So every select statement will run with in time and append the records to itab.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Feb 2008 04:06:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/a-select-statement-with-appending-table-statement-in-it/m-p/3382146#M812004</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-21T04:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: A Select statement with Appending table statement in it.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-select-statement-with-appending-table-statement-in-it/m-p/3382147#M812005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Apr 2016 12:48:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/a-select-statement-with-appending-table-statement-in-it/m-p/3382147#M812005</guid>
      <dc:creator>former_member647103</dc:creator>
      <dc:date>2016-04-16T12:48:29Z</dc:date>
    </item>
  </channel>
</rss>

