<?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 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3185268#M758437</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if we append rows to an ITAB , the row will be appended at the end of teh ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if we collect the rows of an ITAB, the numeric fields get added, if the generic key (all non numeric fields) matches with the existing row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Narendra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Dec 2007 08:31:32 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-12-26T08:31:32Z</dc:date>
    <item>
      <title>Collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3185263#M758432</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;Whats the use of collect statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THanks,&lt;/P&gt;&lt;P&gt;King.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Dec 2007 07:27:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3185263#M758432</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-26T07:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3185264#M758433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi King,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Regards,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Azhar&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Dec 2007 07:29:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3185264#M758433</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-26T07:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: Collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3185265#M758434</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;  if all non-numberic keys of a two records are same then collect will add the numberic key values of two records and makes it as a single record.&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;pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Dec 2007 07:31:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3185265#M758434</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-26T07:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: Collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3185266#M758435</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;The following special statement allows you to summate entries in an internal table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COLLECT wa INTO itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab must have a flat line type, and all of the fields that are not part of the table key must have a numeric type (f, i, p). You specify the line wathat you want to add as a work area that is compatible with the line type of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT demo_int_tables_COLLECT .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF line,&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 line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA itab LIKE SORTED TABLE OF line&lt;/P&gt;&lt;P&gt;          WITH NON-UNIQUE KEY col1 col2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;line-col1 = 'abc'. line-col2 = '12'. line-col3 = 3.&lt;/P&gt;&lt;P&gt;COLLECT line INTO itab.&lt;/P&gt;&lt;P&gt;WRITE / sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;line-col1 = 'def'. line-col2 = '34'. line-col3 = 5.&lt;/P&gt;&lt;P&gt;COLLECT line INTO itab.&lt;/P&gt;&lt;P&gt;WRITE / sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;line-col1 = 'abc'. line-col2 = '12'. line-col3 = 7.&lt;/P&gt;&lt;P&gt;COLLECT line INTO itab.&lt;/P&gt;&lt;P&gt;WRITE / sy-tabix.&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, line-col3.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The list output is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abc 12          10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def 34          5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example fills a sorted table. The first two COLLECT statements work like normal insertion statements. In the third COLLECTstatement, the first line of itab is modified.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nagaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Dec 2007 07:34:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3185266#M758435</guid>
      <dc:creator>former_member404244</dc:creator>
      <dc:date>2007-12-26T07:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: Collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3185267#M758436</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;Collect statement is basically used to sum up all the non-character fields(technically). It is particularly useful when we need to add multiple rows for same primary key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regs,&lt;/P&gt;&lt;P&gt;Saurabh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Dec 2007 07:35:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3185267#M758436</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-26T07:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3185268#M758437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if we append rows to an ITAB , the row will be appended at the end of teh ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if we collect the rows of an ITAB, the numeric fields get added, if the generic key (all non numeric fields) matches with the existing row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Narendra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Dec 2007 08:31:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3185268#M758437</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-26T08:31:32Z</dc:date>
    </item>
  </channel>
</rss>

