<?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 STATEMENT in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sum-statement/m-p/3121487#M741281</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am sorry santhosh, i am not gettng what ur sayng?&lt;/P&gt;&lt;P&gt;can u plz explain me in brief?&lt;/P&gt;&lt;P&gt;or can u tell me correction in my prog so that i will come to know correctly about SUM statement&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Dec 2007 05:24:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-12-03T05:24:01Z</dc:date>
    <item>
      <title>SUM STATEMENT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sum-statement/m-p/3121484#M741278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI GURU'S,&lt;/P&gt;&lt;P&gt;Please can anybody explains me&lt;/P&gt;&lt;P&gt; what is significance of using SUM statement inside the AT AND ENDAT statement.&lt;/P&gt;&lt;P&gt;what i understood about sum is: The statement SUM calculates the component total with the numeric data type (i, p, f)&lt;/P&gt;&lt;P&gt; of all rows in the current control level and assigns these to the components of the work area wa. In the control levels &lt;/P&gt;&lt;P&gt;FIRST, LAST, and outside of an AT-ENDAT control structure, the system calculates the sum of numeric components&lt;/P&gt;&lt;P&gt; of all rows in the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but in below program which i did, its not doing that&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF companies_type,&lt;/P&gt;&lt;P&gt;        name(30),&lt;/P&gt;&lt;P&gt;        product(20),&lt;/P&gt;&lt;P&gt;        sales TYPE i,&lt;/P&gt;&lt;P&gt;        SALES1 TYPE I,&lt;/P&gt;&lt;P&gt;      END   OF companies_type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: companies TYPE STANDARD TABLE OF companies_type WITH&lt;/P&gt;&lt;P&gt;                     NON-UNIQUE DEFAULT KEY INITIAL SIZE 20,&lt;/P&gt;&lt;P&gt;      wa_companies TYPE companies_type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_companies-name = 'XYZ'.&lt;/P&gt;&lt;P&gt;wa_companies-product = 'SAP'.&lt;/P&gt;&lt;P&gt;wa_companies-sales = '1'.&lt;/P&gt;&lt;P&gt;wa_companies-sales1 = '1'.&lt;/P&gt;&lt;P&gt;APPEND wa_companies TO companies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_companies-name = 'ABC'.&lt;/P&gt;&lt;P&gt;wa_companies-product = 'ABAP'.&lt;/P&gt;&lt;P&gt;wa_companies-sales = '4'.&lt;/P&gt;&lt;P&gt;wa_companies-sales1 = '4'.&lt;/P&gt;&lt;P&gt;APPEND wa_companies TO companies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_companies-name = 'PQR'.&lt;/P&gt;&lt;P&gt;wa_companies-product = 'HR'.&lt;/P&gt;&lt;P&gt;wa_companies-sales = '3'.&lt;/P&gt;&lt;P&gt;wa_companies-sales1 = '3'.&lt;/P&gt;&lt;P&gt;APPEND wa_companies TO companies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT companies INTO wa_companies.&lt;/P&gt;&lt;P&gt;  AT NEW name.&lt;/P&gt;&lt;P&gt;  sum.&lt;/P&gt;&lt;P&gt;    NEW-PAGE.&lt;/P&gt;&lt;P&gt;    WRITE / wa_companies-name.&lt;/P&gt;&lt;P&gt;  ENDAT.&lt;/P&gt;&lt;P&gt;  WRITE: / wa_companies-product, wa_companies-sales,wa_companies-sales1.&lt;/P&gt;&lt;P&gt;  AT END OF NAME.&lt;/P&gt;&lt;P&gt;    SUM.&lt;/P&gt;&lt;P&gt;    WRITE: / wa_companies-name, wa_companies-sales,wa_companies-sales1 .&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;Thanks&lt;/P&gt;&lt;P&gt;Priya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2007 05:07:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sum-statement/m-p/3121484#M741278</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-03T05:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: SUM STATEMENT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sum-statement/m-p/3121485#M741279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;      Sum statement will give the sum of Sales and Sales1 field after end of the particular field, ie name. for using control break statement the internal table should be sorted .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;of eg.&lt;/P&gt;&lt;P&gt; field1 field2&lt;/P&gt;&lt;P&gt; ch 1&lt;/P&gt;&lt;P&gt; ch 3&lt;/P&gt;&lt;P&gt; sa 2&lt;/P&gt;&lt;P&gt; sa 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at end of field1.&lt;/P&gt;&lt;P&gt;sum statement will add the value 1 &amp;amp; 3 of first field1 and the 2 &amp;amp; 2 of 2nd field.&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;Santosh Thorat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2007 05:12:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sum-statement/m-p/3121485#M741279</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-03T05:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: SUM STATEMENT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sum-statement/m-p/3121486#M741280</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;Try using "collect" statement in your case... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if usefull...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2007 05:21:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sum-statement/m-p/3121486#M741280</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-03T05:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: SUM STATEMENT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sum-statement/m-p/3121487#M741281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am sorry santhosh, i am not gettng what ur sayng?&lt;/P&gt;&lt;P&gt;can u plz explain me in brief?&lt;/P&gt;&lt;P&gt;or can u tell me correction in my prog so that i will come to know correctly about SUM statement&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2007 05:24:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sum-statement/m-p/3121487#M741281</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-03T05:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: SUM STATEMENT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sum-statement/m-p/3121488#M741282</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 control statements should be used inside a loop, the internal table should be sorted before using the control statements. &lt;/P&gt;&lt;P&gt; loop...&lt;/P&gt;&lt;P&gt;At new name.&lt;/P&gt;&lt;P&gt; sum.&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;Sum of the numeric values will be calculated when the name changes. At new  is triggered at the begining itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop...&lt;/P&gt;&lt;P&gt;At end of name.&lt;/P&gt;&lt;P&gt; sum.&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;  Sum of the numeric values will be calculated when the name changes . &lt;/P&gt;&lt;P&gt;Just a simple example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ID no    Name    Salary.&lt;/P&gt;&lt;P&gt;100       Ram     5000&lt;/P&gt;&lt;P&gt;100       Ravi      6000&lt;/P&gt;&lt;P&gt;200       Prajn    7000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; loop at itab.&lt;/P&gt;&lt;P&gt;  At new idno.&lt;/P&gt;&lt;P&gt;     sum&lt;/P&gt;&lt;P&gt;  write:/ itab-idno , itab-name, itab-salaty.&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;O/p will be : &lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;      100  Ram 11000&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;The sum will trigger when the number idno is changing .&lt;/P&gt;&lt;P&gt;Similarly AT end  also works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vani&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2007 05:37:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sum-statement/m-p/3121488#M741282</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-03T05:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: SUM STATEMENT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sum-statement/m-p/3121489#M741283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi vani,&lt;/P&gt;&lt;P&gt;according to your explanation,I think in u need to write AT NEW NAME.&lt;/P&gt;&lt;P&gt;Please correct me if i am wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum of the numeric values will be calculated when the name changes . &lt;/P&gt;&lt;P&gt;Just a simple example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ID no Name Salary.&lt;/P&gt;&lt;P&gt;100 Ram 5000&lt;/P&gt;&lt;P&gt;100 Ravi 6000&lt;/P&gt;&lt;P&gt;200 Prajn 7000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;At new idno.                                  "AT NEW NAME.&lt;/P&gt;&lt;P&gt;sum&lt;/P&gt;&lt;P&gt;write:/ itab-idno , itab-name, itab-salaty.&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;O/p will be : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;100 Ram 11000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sum will trigger when the number idno is changing .&lt;/P&gt;&lt;P&gt;Similarly AT end also works.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2007 06:00:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sum-statement/m-p/3121489#M741283</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-03T06:00:43Z</dc:date>
    </item>
  </channel>
</rss>

