<?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: Sum in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sum/m-p/1993675#M405067</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In oder to use SUM, you have to open the loop, so the performance diff would be marginal between onchange of &amp;amp; the AT END OF control breaks (inside which you can SUM the values). The other option is to COLLECT the itab insteadof APPENDing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 Mar 2007 19:01:22 GMT</pubDate>
    <dc:creator>suresh_datti</dc:creator>
    <dc:date>2007-03-26T19:01:22Z</dc:date>
    <item>
      <title>Sum</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sum/m-p/1993674#M405066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello friends,&lt;/P&gt;&lt;P&gt;I have 5 rows in my Internal table.&lt;/P&gt;&lt;P&gt;the 4th and 5th is quantity field.&lt;/P&gt;&lt;P&gt; I need to sum up the 4th and 5th field for same first 3 fields, so I am sorting and using on change of statement and is working good.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was wondering if I can use a sum statement for better performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Madhu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2007 18:57:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sum/m-p/1993674#M405066</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-26T18:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Sum</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sum/m-p/1993675#M405067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In oder to use SUM, you have to open the loop, so the performance diff would be marginal between onchange of &amp;amp; the AT END OF control breaks (inside which you can SUM the values). The other option is to COLLECT the itab insteadof APPENDing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2007 19:01:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sum/m-p/1993675#M405067</guid>
      <dc:creator>suresh_datti</dc:creator>
      <dc:date>2007-03-26T19:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: Sum</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sum/m-p/1993676#M405068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Madhu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, You are correct and You can use SUM statement for better performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT the internal table on the three fields.&lt;/P&gt;&lt;P&gt;LOOP the intenrnal table and use SUM to get the total AT END OF control command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, You can go for COLLECT statement as specified by Suresh, COLLECT will sum up of the numeric fields in the internal table if all other non-numeric fields of the internal table are same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT ITAB BY F1 F2 F3.&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;AT END OF F3.&lt;/P&gt;&lt;P&gt;SUM.&lt;/P&gt;&lt;P&gt;ENDAT.&lt;/P&gt;&lt;P&gt;(OR) &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;Thanks,&lt;/P&gt;&lt;P&gt;Vinay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2007 19:04:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sum/m-p/1993676#M405068</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-26T19:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: Sum</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sum/m-p/1993677#M405069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As far as performance is concern, using the sum statement inside loop is always better.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As its defined for this perpose by SAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also use :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB INTO WA_ITAB. &lt;/P&gt;&lt;P&gt;  AT FIRST. &lt;/P&gt;&lt;P&gt;    SUM. &lt;/P&gt;&lt;P&gt;{ the fields  u want to put for addition at once for whole internal table }&lt;/P&gt;&lt;P&gt;ENDAT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also&lt;/P&gt;&lt;P&gt;AT END OF CODE. &lt;/P&gt;&lt;P&gt;    SUM. &lt;/P&gt;&lt;P&gt;{ at loop wise WA addition }     &lt;/P&gt;&lt;P&gt;  ENDAT. &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 this ll be helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank-You.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;vinsee&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2007 19:19:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sum/m-p/1993677#M405069</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-26T19:19:30Z</dc:date>
    </item>
  </channel>
</rss>

