<?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: Collect statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/925523#M59775</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; hey guys,&lt;/P&gt;&lt;P&gt;&amp;gt; Can we use collect statement in same internal table?&lt;/P&gt;&lt;P&gt;&amp;gt; loop at itab_list.&lt;/P&gt;&lt;P&gt;&amp;gt; collect itab_list.&lt;/P&gt;&lt;P&gt;&amp;gt; endloop.&lt;/P&gt;&lt;P&gt;&amp;gt; is it correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&amp;gt; no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA itab_collect LIKE itab_list OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; loop at itab_list.&lt;/P&gt;&lt;P&gt;  collect itab_list into itab_collect. &lt;/P&gt;&lt;P&gt; endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Mar 2005 08:20:56 GMT</pubDate>
    <dc:creator>andreas_mann3</dc:creator>
    <dc:date>2005-03-29T08:20:56Z</dc:date>
    <item>
      <title>Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/925521#M59773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hey guys,&lt;/P&gt;&lt;P&gt;Can we use collect statement in same internal table?&lt;/P&gt;&lt;P&gt;loop at itab_list.&lt;/P&gt;&lt;P&gt;collect itab_list.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;is it correct?&lt;/P&gt;&lt;P&gt;ambichan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2005 07:58:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/925521#M59773</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-03-29T07:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/925522#M59774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ambi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is an official explanation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;"When the line is inserted, the system checks whether there is already a table entry that matches the key. If there is no corresponding entry already in the table, the COLLECT statement has the same effect as inserting the new line. If an entry with the same key already exists, the COLLECT statement does not append a new line, but adds the contents of the numeric fields in the work area to the contents of the numeric fields in the existing entry. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should only use the COLLECT statement if you want to create summarized tables. If you use other statements to insert table entries, you may end up with duplicate entries."&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, do not forget that, all of the non-key fields of your internal table must have a numeric type (F, I, or P). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--Serdar &amp;lt;a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d"&amp;gt;[ BC ]&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2005 08:16:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/925522#M59774</guid>
      <dc:creator>ssimsekler</dc:creator>
      <dc:date>2005-03-29T08:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/925523#M59775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; hey guys,&lt;/P&gt;&lt;P&gt;&amp;gt; Can we use collect statement in same internal table?&lt;/P&gt;&lt;P&gt;&amp;gt; loop at itab_list.&lt;/P&gt;&lt;P&gt;&amp;gt; collect itab_list.&lt;/P&gt;&lt;P&gt;&amp;gt; endloop.&lt;/P&gt;&lt;P&gt;&amp;gt; is it correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&amp;gt; no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA itab_collect LIKE itab_list OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; loop at itab_list.&lt;/P&gt;&lt;P&gt;  collect itab_list into itab_collect. &lt;/P&gt;&lt;P&gt; endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2005 08:20:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/925523#M59775</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2005-03-29T08:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/925524#M59776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you can do this... the question rather is: what do you want to achieve?&lt;/P&gt;&lt;P&gt;Suppose your internal (standard) table contains two entries with the same key where the non-key part is just an integer with value 1 in the first line and value 2 in the second line.&lt;/P&gt;&lt;P&gt;After running your little piece of code on this internal table the non-key part of the first line will be 4 and the second line will stay as is.&lt;/P&gt;&lt;P&gt;By the way: COLLECT should rather be used to fill 'empty' tables for performance reasons.&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2005 14:27:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/925524#M59776</guid>
      <dc:creator>nitschket</dc:creator>
      <dc:date>2005-03-29T14:27:15Z</dc:date>
    </item>
  </channel>
</rss>

