<?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 up the values in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sum-up-the-values/m-p/3168252#M753803</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;Declare a work area and another internal table same as itab. And declare n1 and n2 as Integer type and if you have decimals declare it as type p decimals 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use below code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : wa_like line of itab,&lt;/P&gt;&lt;P&gt;         itab1 like itab occurs 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here comes to your select table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once table is loaded into itab.&lt;/P&gt;&lt;P&gt;Use the below code to sum up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Loop at itab into wa.
collect wa to newitab.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sriram Ponna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Dec 2007 17:41:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-12-11T17:41:09Z</dc:date>
    <item>
      <title>Sum up the values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sum-up-the-values/m-p/3168250#M753801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data : begin of itab,&lt;/P&gt;&lt;P&gt;         n(3) type c,&lt;/P&gt;&lt;P&gt;	 n1 type n,&lt;/P&gt;&lt;P&gt; 	 n2 type n,&lt;/P&gt;&lt;P&gt;	 k(5) type c,&lt;/P&gt;&lt;P&gt;      end of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select n n1 n2 k from into itab from table /zteest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*internal table has &lt;/P&gt;&lt;P&gt;n      n1    k    n2 &lt;/P&gt;&lt;P&gt;gar    100  uji   2&lt;/P&gt;&lt;P&gt;hae    90   iou   3&lt;/P&gt;&lt;P&gt;gar    90   uji   3&lt;/P&gt;&lt;P&gt;hae    87   iou   4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want &lt;/P&gt;&lt;P&gt;gar 190  uij 5&lt;/P&gt;&lt;P&gt;hae 177  iou 7&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to use collect statement as n1 is n ..?&lt;/P&gt;&lt;P&gt;I want to sum up n1 and n2 if value of k and n is same &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Dec 2007 16:25:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sum-up-the-values/m-p/3168250#M753801</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-11T16:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: Sum up the values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sum-up-the-values/m-p/3168251#M753802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Make one more internal table and use the collect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: BEGIN OF IT_SUM,
N(3) TYPE C,
N1 TYPE I,  " &amp;lt;&amp;lt; should be I, P or F to get sum for that field
K(5) TYPE C,
N2 TYPE I,
END OF IT_SUM.

LOOP AT ITAB.
 MOVE-CORESSPONDING ITAB TO IT_SUM.
 COLLECT IT_SUM.
 CLEAR   IT_SUM.
ENDLOOP.&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>Tue, 11 Dec 2007 16:30:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sum-up-the-values/m-p/3168251#M753802</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2007-12-11T16:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: Sum up the values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sum-up-the-values/m-p/3168252#M753803</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;Declare a work area and another internal table same as itab. And declare n1 and n2 as Integer type and if you have decimals declare it as type p decimals 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use below code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : wa_like line of itab,&lt;/P&gt;&lt;P&gt;         itab1 like itab occurs 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here comes to your select table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once table is loaded into itab.&lt;/P&gt;&lt;P&gt;Use the below code to sum up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Loop at itab into wa.
collect wa to newitab.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sriram Ponna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Dec 2007 17:41:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sum-up-the-values/m-p/3168252#M753803</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-11T17:41:09Z</dc:date>
    </item>
  </channel>
</rss>

