<?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/3080282#M730540</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;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Using Collect Statement&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : BEGIN OF ITAB OCCURS 0,&lt;/P&gt;&lt;P&gt;       COL1(3) TYPE C,&lt;/P&gt;&lt;P&gt;       COL2  TYPE I,&lt;/P&gt;&lt;P&gt;       END OF ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ITAB-COL1 = 'ABC'.&lt;/P&gt;&lt;P&gt;ITAB-COL2 = 50.&lt;/P&gt;&lt;P&gt;COLLECT 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;ITAB-COL1 = 'ABC'.&lt;/P&gt;&lt;P&gt;ITAB-COL2 = 100.&lt;/P&gt;&lt;P&gt;COLLECT ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ITAB-COL1 = 'ABC'.&lt;/P&gt;&lt;P&gt;ITAB-COL2 = 150.&lt;/P&gt;&lt;P&gt;COLLECT ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;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E.&lt;/P&gt;&lt;P&gt;ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Nov 2007 14:44:02 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-11-19T14:44:02Z</dc:date>
    <item>
      <title>collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3080281#M730539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can we use COLLECT statement on character field?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i got one old report. in that it was written collect statement on character field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks in advance,&lt;/P&gt;&lt;P&gt;Ramakrishna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2007 14:40:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3080281#M730539</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-19T14:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3080282#M730540</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;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Using Collect Statement&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : BEGIN OF ITAB OCCURS 0,&lt;/P&gt;&lt;P&gt;       COL1(3) TYPE C,&lt;/P&gt;&lt;P&gt;       COL2  TYPE I,&lt;/P&gt;&lt;P&gt;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lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT FIRST.&lt;/P&gt;&lt;P&gt;WRITE: / 'AT NEW STATEMENT'.&lt;/P&gt;&lt;P&gt;ULINE.&lt;/P&gt;&lt;P&gt;ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT NEW COL1.&lt;/P&gt;&lt;P&gt;WRITE: / ' AT FIRST OF :', ITAB-COL1.&lt;/P&gt;&lt;P&gt;ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE : / ITAB-COL1, ITAB-COL2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT LAST.&lt;/P&gt;&lt;P&gt;ULINE.&lt;/P&gt;&lt;P&gt;ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2007 14:44:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3080282#M730540</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-19T14:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3080283#M730541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Krishna,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; You can use COLLECT on Char field. But values will not get accumulated. It will work as Append statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Satish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2007 14:44:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3080283#M730541</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-19T14:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3080284#M730542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Collect works like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ITAB:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CHAR  CNT
N1     100
N1     200
N2     300
N2     400&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Than collect&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT ITAB.
  MOVE-CORRESPONDING ITAB TO IT_SUM
  COLLECT IT_SUM.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After this IT_SUM will have:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;N1   300
N3   700&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, COLLECT actually collects all the interger, type P and type F values based on the Character fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2007 14:45:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3080284#M730542</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2007-11-19T14:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3080285#M730543</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 allows you to create unique or summarized datasets. &lt;/P&gt;&lt;P&gt;The system first tries to find a table entry corresponding to the table key. &lt;/P&gt;&lt;P&gt;The key values are taken either from the header line of the internal table itab, or from the explicitly-specified work area wa. &lt;/P&gt;&lt;P&gt;The line type of itab must be flat - that is, it cannot itself contain any internal tables. &lt;/P&gt;&lt;P&gt;All the components that do not belong to the key must be numeric types &lt;/P&gt;&lt;P&gt;( ABAP Numeric Types). &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bye,&lt;/P&gt;&lt;P&gt;KC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2007 14:45:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3080285#M730543</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-19T14:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3080286#M730544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi chand,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;situation is there is one structure with &amp;lt;b&amp;gt;&amp;lt;u&amp;gt;only one&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt; character field.&lt;/P&gt;&lt;P&gt;an internal table created with thwt structure in the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and they used collect statement on this internal table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2007 14:51:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3080286#M730544</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-19T14:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: collect</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3080287#M730545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok.. this was done to collect all the unique records for that perticular table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CHAR  char
N1     N1
N1     N1
N2     N4
N2     N3&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Than collect&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT ITAB.
  MOVE-CORRESPONDING ITAB TO IT_SUM
  COLLECT IT_SUM.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After this IT_SUM will have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;N1   N1
N2   N3
N2   N4&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can avoid this COLLECT code by:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SORT ITAB.
DELETE ADJACENT DUPLICATES FROM ITAB.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2007 14:54:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect/m-p/3080287#M730545</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2007-11-19T14:54:27Z</dc:date>
    </item>
  </channel>
</rss>

