<?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/6152293#M1368784</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Example&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES: BEGIN OF COMPANY, 
        NAME(20) TYPE C, 
        SALES    TYPE I, 
      END OF COMPANY. 

DATA: COMP    TYPE COMPANY, 
      COMPTAB TYPE HASHED TABLE OF COMPANY 
                                WITH UNIQUE KEY NAME. 

COMP-NAME = 'Duck'.  COMP-SALES = 10. COLLECT COMP INTO COMPTAB. 
COMP-NAME = 'Tiger'. COMP-SALES = 20. COLLECT COMP INTO COMPTAB. 
COMP-NAME = 'Duck'.  COMP-SALES = 30. COLLECT COMP INTO COMPTAB. 
Table COMPTAB now has the following contents: 

          NAME    | SALES 
          --------------- 
          Duck    |   40 
          Tiger   |   20 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Sep 2009 05:05:58 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-09-23T05:05:58Z</dc:date>
    <item>
      <title>Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152280#M1368771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a internal table with material number,material size and cartonwgt fields.&lt;/P&gt;&lt;P&gt;For the combination of mat.no and size there are different carton weights.So I want to add all the  carton weights where mat no and size is same.I thought of using collect statement.Pls can ny one explain how to use that or is there any other solution for this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Kumar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2009 04:56:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152280#M1368771</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-18T04:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152281#M1368772</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;Use this example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you have data in internal table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then declare itab1 same as itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;collect itab into itab1.&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;Regards,&lt;/P&gt;&lt;P&gt;Vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2009 05:00:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152281#M1368772</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-18T05:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152282#M1368773</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;Yes you can use collect statement. Just loop at the table and use collect. Make sure that the fields which you sum up are numeric and others are type c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at itab.
collect itab.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2009 05:01:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152282#M1368773</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-18T05:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152283#M1368774</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;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;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;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;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;ITAB-COL1 = 'PQR'.&lt;/P&gt;&lt;P&gt;ITAB-COL2 = 100.&lt;/P&gt;&lt;P&gt;COLLECT ITAB.&lt;/P&gt;&lt;P&gt;ITAB-COL1 = 'PQR'.&lt;/P&gt;&lt;P&gt;ITAB-COL2 = 100.&lt;/P&gt;&lt;P&gt;COLLECT ITAB.&lt;/P&gt;&lt;P&gt;ITAB-COL1 = 'XYZ'.&lt;/P&gt;&lt;P&gt;ITAB-COL2 = 200.&lt;/P&gt;&lt;P&gt;COLLECT ITAB.&lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;WRITE : / ITAB-COL1, ITAB-COL2.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;SORT ITAB.&lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&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;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;WRITE : / ITAB-COL1, ITAB-COL2.&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;ENDLOOP.&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;Sreeram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2009 05:04:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152283#M1368774</guid>
      <dc:creator>sreeramkumar_madisetty</dc:creator>
      <dc:date>2009-09-18T05:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152284#M1368775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi kumar,&lt;/P&gt;&lt;P&gt;welcome to SDN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when a table itab2 is of type&lt;/P&gt;&lt;P&gt;|matnr__ |size__ |weight &lt;/P&gt;&lt;P&gt;chartype|chartype|numeric type&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at itab into is.
  is2- matnr = is-matnr.
  is2-size = is-size.
  is2-weight = is-weight..
  collect is2 into itab2.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;collect keeps the char fields intact and adds the numeric type. please take a note of this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Soumyaprakash Mishra on Sep 18, 2009 10:35 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2009 05:05:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152284#M1368775</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-18T05:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152285#M1368776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Kumarn290,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Collect statement is used to store records in internal table while summing up their numeric fields. So it will serve your requirement. Simply read each record in an work area and then use "COLLECT WA INTO ITAB" so that you will get expected result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Vaibhav Pendse&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2009 05:07:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152285#M1368776</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-18T05:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152286#M1368777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a tonn for all your replies My carton weight field is of type QUAN.&lt;/P&gt;&lt;P&gt;Actually I need to frame a formula i.e..,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Per unit  net weight  = Sum of CARWGT(Carton weight) Divided by sum of MENGE(Quantity) &lt;/P&gt;&lt;P&gt;        Where Material &amp;amp; size Value is same .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MENGE(Quantity) is also of same QUAN type..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can ny one give an idea to how to do this..plz&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Kumar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2009 05:27:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152286#M1368777</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-18T05:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152287#M1368778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;say itab1 has matnr, size, carwgt,menge. which has multiple records for one matnr and size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and itab2 is what we need of type matnr, size, perunit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;sort itab1 by matnr, size.
data: gv_matnr type matnr,
   size like itab1-size.

loop at itab1 into is1.
  if is1-matnr = gv_matnr and is1-size = gv_size.
     gv_wt =gv_wt + is1-carwgt.
     gv_men = gv_men + is1-menge.
     clear is1.
    continue.
  endif.
  "when a new record comes.. 
   gv_net = gv_wt / gv_men.
    is2-matnr = gv_matnr.
    is2-size = gv_size.
    is2-perunit = gv_net.
    append is2 to itab2. " new record inserted.
    clear: gv_net, gv_matnr,gv_size, gv_wt, gv_men, is2.

   "now for current new records in itab1.
     gv_matnr = is1-matnr.
     gv_size = is1-size.
     clear : is1.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2009 05:42:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152287#M1368778</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-18T05:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152288#M1368779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But is there a way to use collect statement and solve the issue.So that the performance also wil be improved I guess.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2009 07:01:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152288#M1368779</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-18T07:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152289#M1368780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the code provided me will do without any performance issue. because any ways you will loop one more time to get the perunit.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2009 07:17:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152289#M1368780</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-18T07:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152290#M1368781</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;Yes you can use collect statement for better performance here. look at this sample code,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

data: begin of itab occurs 0,
      matnr(10) type c,
      val1 type i,
      val2 type i,
      end of itab.

data: begin of itab1 occurs 0,
      matnr(10) type c,
      val1 type i,
      val2 type i,
      avg(3) type p decimals 2,
      end of itab1.

      itab-matnr = 'm1'.
       itab-val1 = '30'.
       itab-val2 = '40'.
       append itab.
       clear itab.

       itab-matnr = 'm1'.
       itab-val1 = '30'.
       itab-val2 = '40'.
       append itab.
       clear itab.
       itab-matnr = 'm1'.
       itab-val1 = '70'.
       itab-val2 = '30'.
       append itab.
       clear itab.
       itab-matnr = 'm1'.
       itab-val1 = '80'.
       itab-val2 = '30'.
       append itab.
       clear itab.
      itab-matnr = 'm2'.
       itab-val1 = '70'.
       itab-val2 = '10'.
       append itab.
       clear itab.
       itab-matnr = 'm2'.
       itab-val1 = '90'.
       itab-val2 = '20'.
       append itab.
       clear itab.

       loop at itab.
       move-corresponding itab to itab1.
       collect itab1.
       endloop.

       loop at itab1.
       itab1-avg = itab1-val1 / itab1-val2.
       modify itab1.
       endloop.

       loop at itab1.
       write:/ itab1-matnr, itab1-val1, itab1-val2, itab1-avg.
       endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vikranth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2009 07:24:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152290#M1368781</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-18T07:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152291#M1368782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; HI,&lt;/P&gt;&lt;P&gt;&amp;gt; Yes you can use collect statement for better performance here. look at this sample code,&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;/CODE&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;CODE&gt;
&amp;gt;"FIRST LOOP
&amp;gt;        loop at itab.
&amp;gt;        move-corresponding itab to itab1.
&amp;gt;        collect itab1.
&amp;gt;        endloop.
&amp;gt;"SECOND LOOP
&amp;gt;        loop at itab1.
&amp;gt;        itab1-avg = itab1-val1 / itab1-val2.
&amp;gt;        modify itab1. """
&amp;gt;        endloop.
&amp;gt; &lt;/CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;do you think this will increase the performance? rather than doing the entire thing in one single loop?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2009 14:07:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152291#M1368782</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-18T14:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152292#M1368783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is atleast better than manually summing up with messy coding rather than let the collect statement do the work for us. I should have said more programmer friendly rather than performance though i dont see any critical performance degradation looping on distinct entries.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2009 16:14:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152292#M1368783</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-18T16:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152293#M1368784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Example&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES: BEGIN OF COMPANY, 
        NAME(20) TYPE C, 
        SALES    TYPE I, 
      END OF COMPANY. 

DATA: COMP    TYPE COMPANY, 
      COMPTAB TYPE HASHED TABLE OF COMPANY 
                                WITH UNIQUE KEY NAME. 

COMP-NAME = 'Duck'.  COMP-SALES = 10. COLLECT COMP INTO COMPTAB. 
COMP-NAME = 'Tiger'. COMP-SALES = 20. COLLECT COMP INTO COMPTAB. 
COMP-NAME = 'Duck'.  COMP-SALES = 30. COLLECT COMP INTO COMPTAB. 
Table COMPTAB now has the following contents: 

          NAME    | SALES 
          --------------- 
          Duck    |   40 
          Tiger   |   20 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Sep 2009 05:05:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152293#M1368784</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-23T05:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: Collect statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152294#M1368785</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;its better  u  use   AT NEW     and AT END OF..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EX :&lt;/P&gt;&lt;P&gt;LOOP.&lt;/P&gt;&lt;P&gt;AT NEW   2ND FIELD.&lt;/P&gt;&lt;P&gt;MOVE IST FIELD  TO WA.&lt;/P&gt;&lt;P&gt;2ND FIELD  TO   WA..&lt;/P&gt;&lt;P&gt;ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TAKE A COUNTER VARIBALE .TO GET  ADDITION  OF ALL WEIGHTS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT END OF  2ND FIELD.&lt;/P&gt;&lt;P&gt;APPEND.&lt;/P&gt;&lt;P&gt;ENDAT......&lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOW IF THE COMBINATION OF THE FIELDS  CHANGE THEN ANOTHER ROW WLD BE APPENDED  IN TABLE .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THANKS &lt;/P&gt;&lt;P&gt;DHRUV&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Sep 2009 05:29:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/collect-statement/m-p/6152294#M1368785</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-23T05:29:58Z</dc:date>
    </item>
  </channel>
</rss>

