<?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: Totals Problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014700#M959278</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;you do not need the AT END OF QTR, the AT END OF statement uses all fields before and with the field specified as the key. The below exapme gives the result you want:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: begin of gs_data,
        qtr(1) type n,
        cob(2) type n,
        price type p,
      end of gs_data,
      gt_data like Standard TABLE OF gs_data.

start-of-selection.

  gs_data-qtr = '1'.
  gs_data-cob = '22'.
  gs_data-price = '70.00'.
  append gs_data to gt_data.
  gs_data-qtr = '1'.
  gs_data-cob = '22'.
  gs_data-price = '30.00'.
  append gs_data to gt_data.
  gs_data-qtr = '1'.
  gs_data-cob = '36'.
  gs_data-price = '50.00'.
  append gs_data to gt_data.
  gs_data-qtr = '1'.
  gs_data-cob = '36'.
  gs_data-price = '10.00'.
  append gs_data to gt_data.
  gs_data-qtr = '2'.
  gs_data-cob = '22'.
  gs_data-price = '25.00'.
  append gs_data to gt_data.

 loop at gt_data into gs_data.
   at end of cob.
     sum.
     write: / gs_data-qtr,
              gs_data-cob,
              gs_data-price.
   endat.
 endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Jun 2008 19:56:52 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-10T19:56:52Z</dc:date>
    <item>
      <title>Totals Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014695#M959273</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  I have a table with several cols the 2 key are Quarter and COB ( class of business) I want to have a third col total by end of Quarter and end of COB. If I use AT END of Quarter it will only sum for the quarter. Is it possible to do something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT END OF quarter&lt;/P&gt;&lt;P&gt;    AT END OF COB&lt;/P&gt;&lt;P&gt;      SUM&lt;/P&gt;&lt;P&gt;      .....&lt;/P&gt;&lt;P&gt;      .....&lt;/P&gt;&lt;P&gt;      ....&lt;/P&gt;&lt;P&gt;   END AT&lt;/P&gt;&lt;P&gt;END AT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or is this going to have to be done manually?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;George&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2008 19:00:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014695#M959273</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-10T19:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: Totals Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014696#M959274</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you can nest the AT..ENDATs.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2008 19:19:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014696#M959274</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-10T19:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: Totals Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014697#M959275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi George,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:begin of wa_1,&lt;/P&gt;&lt;P&gt;       quarter(10) type c,&lt;/P&gt;&lt;P&gt;       COB(5) type n,&lt;/P&gt;&lt;P&gt;       tot  type i,&lt;/P&gt;&lt;P&gt;       end of wa_1,&lt;/P&gt;&lt;P&gt;   itab1 like standard table of wa_1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at itab1 into wa_1.&lt;/P&gt;&lt;P&gt;wa_2 = wa_1.&lt;/P&gt;&lt;P&gt;At end of COB.&lt;/P&gt;&lt;P&gt;sum.&lt;/P&gt;&lt;P&gt;wa2-tot = wa_1-tot.&lt;/P&gt;&lt;P&gt;append wa2 to itab2.&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;This above code will sum up based on both Quarter and COB.Meaning that even if any one of the field*quarter or COB) changes,the Block of statment beteween AT and ENDAT will be executed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For eg:ITAB1&lt;/P&gt;&lt;P&gt;Quarter   COB   tot&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------" /&gt;&lt;P&gt;A1011    340     2&lt;/P&gt;&lt;P&gt;A1011    340     3&lt;/P&gt;&lt;P&gt;A1011    341     11&lt;/P&gt;&lt;P&gt;A1012    341     6&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;O/P:ITAB2&lt;/P&gt;&lt;P&gt;Quarter   COB   tot&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------" /&gt;&lt;P&gt;A1011    340     5&lt;/P&gt;&lt;P&gt;A1011    341     11&lt;/P&gt;&lt;P&gt;A1012    341     6&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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;Vigneswaran S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2008 19:29:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014697#M959275</guid>
      <dc:creator>former_member491305</dc:creator>
      <dc:date>2008-06-10T19:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: Totals Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014698#M959276</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the replies, not sure if that is the answer though&lt;/P&gt;&lt;P&gt;Let's say for instance the data is like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;QTR  COB  Price&lt;/P&gt;&lt;P&gt;1       22       70.00&lt;/P&gt;&lt;P&gt;1       22        30.00&lt;/P&gt;&lt;P&gt;1       36        50.00&lt;/P&gt;&lt;P&gt;1       36       10.00&lt;/P&gt;&lt;P&gt;2       22        25.00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would want totals like&lt;/P&gt;&lt;P&gt;Qtr     COB     Price&lt;/P&gt;&lt;P&gt;1         22        100.00&lt;/P&gt;&lt;P&gt;1         36        60.00&lt;/P&gt;&lt;P&gt;2         22        25.00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried the above code but it did not return the needed result&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a fairly urgent matter so all input is appreciated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2008 19:44:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014698#M959276</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-10T19:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: Totals Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014699#M959277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Can u paste ur code here along with the itab declaration here?.Because the one which i shown in the Eg.is similar as the one which u have shown here.It will give the same result.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2008 19:49:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014699#M959277</guid>
      <dc:creator>former_member491305</dc:creator>
      <dc:date>2008-06-10T19:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: Totals Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014700#M959278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;you do not need the AT END OF QTR, the AT END OF statement uses all fields before and with the field specified as the key. The below exapme gives the result you want:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: begin of gs_data,
        qtr(1) type n,
        cob(2) type n,
        price type p,
      end of gs_data,
      gt_data like Standard TABLE OF gs_data.

start-of-selection.

  gs_data-qtr = '1'.
  gs_data-cob = '22'.
  gs_data-price = '70.00'.
  append gs_data to gt_data.
  gs_data-qtr = '1'.
  gs_data-cob = '22'.
  gs_data-price = '30.00'.
  append gs_data to gt_data.
  gs_data-qtr = '1'.
  gs_data-cob = '36'.
  gs_data-price = '50.00'.
  append gs_data to gt_data.
  gs_data-qtr = '1'.
  gs_data-cob = '36'.
  gs_data-price = '10.00'.
  append gs_data to gt_data.
  gs_data-qtr = '2'.
  gs_data-cob = '22'.
  gs_data-price = '25.00'.
  append gs_data to gt_data.

 loop at gt_data into gs_data.
   at end of cob.
     sum.
     write: / gs_data-qtr,
              gs_data-cob,
              gs_data-price.
   endat.
 endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2008 19:56:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014700#M959278</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-10T19:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: Totals Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014701#M959279</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;PRE&gt;&lt;CODE&gt;Loop at itab.
At end of COB.
sum.
 write: / ITAB_data-qtr,
           ITAB_data-cob,
           ITAB_data-price.
ENDAT.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Please reward points if it helps&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Vikranth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2008 19:58:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014701#M959279</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-10T19:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: Totals Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014702#M959280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is what I have &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF ST_COLL_1,&lt;/P&gt;&lt;P&gt;       QTR(2)         TYPE N,&lt;/P&gt;&lt;P&gt;       BRCHNR         LIKE /MSG/RD_ABR_BU-BRCHNR,  "COB&lt;/P&gt;&lt;P&gt;       ABRNR          LIKE /MSG/RD_ABR_BU-ABRNR,&lt;/P&gt;&lt;P&gt;       ZJJ            LIKE /MSG/RD_ABR_BU-ZJJ,&lt;/P&gt;&lt;P&gt;       BIL_PERIOD     LIKE /MSG/RD_ABR_BU-BIL_PERIOD,&lt;/P&gt;&lt;P&gt;       BIL_DAT        LIKE /MSG/RD_ABR_BU-BIL_DAT,&lt;/P&gt;&lt;P&gt;       BUCONR         LIKE /MSG/RD_ABR_BU-BUCONR,&lt;/P&gt;&lt;P&gt;       OW_BETR        LIKE /MSG/RD_ABR_BU-OW_BETR,       &lt;/P&gt;&lt;P&gt;       END OF ST_COLL_1.&lt;/P&gt;&lt;P&gt;DATA: T_COLL_1       TYPE ST_COLL_1 OCCURS 0,&lt;/P&gt;&lt;P&gt;           WA_T_CO           LIKE LINE OF T_COLL_1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  qtr_tot1 = 0.&lt;/P&gt;&lt;P&gt;  qtr_tot2 = 0.&lt;/P&gt;&lt;P&gt;  qtr_tot3 = 0.&lt;/P&gt;&lt;P&gt;  LOOP AT t_coll_1 INTO wa_t_co.&lt;/P&gt;&lt;P&gt;    AT END OF qtr.&lt;/P&gt;&lt;P&gt;      SUM.&lt;/P&gt;&lt;P&gt;      qtr_tot1 = qtr_tot1 + wa_t_co-ow_betr.&lt;/P&gt;&lt;P&gt;      qtr_tot2 = qtr_tot2 + wa_t_co-ow_betr2.&lt;/P&gt;&lt;P&gt;      qtr_tot3 = qtr_tot3 + wa_t_co-ow_betr3.&lt;/P&gt;&lt;P&gt;      MOVE wa_t_co-qtr TO wa_t_cal-qtr.&lt;/P&gt;&lt;P&gt;      MOVE qtr_tot1 TO wa_t_cal-earnprem.&lt;/P&gt;&lt;P&gt;      MOVE qtr_tot2 TO wa_t_cal-paidloss.&lt;/P&gt;&lt;P&gt;      MOVE qtr_tot3 TO wa_t_cal-oslr.&lt;/P&gt;&lt;P&gt;      APPEND wa_t_cal TO t_yr_calc.&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;This is when I was just totaling by Quarter and it works fine, however I now need it to total by Quarter and Brchnr&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2008 20:10:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014702#M959280</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-10T20:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: Totals Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014703#M959281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi George,&lt;/P&gt;&lt;P&gt;THe summation will be done by system itself.You dont have to do it your program.&lt;/P&gt;&lt;P&gt;One more thing.You have to use at end of BRCHNR instead of At ENd of QTR ,if u want to have a sum based on both these fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chk out this.&lt;/P&gt;&lt;P&gt;LOOP AT t_coll_1 INTO wa_t_co.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AT END OF BRCHNR.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SUM.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MOVE wa_t_co-qtr TO wa_t_cal-qtr.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MOVE wa_t_co-ow_betr TO wa_t_cal-earnprem.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MOVE wa_t_co-ow_betr2 TO wa_t_cal-paidloss.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MOVE wa_t_co-ow_betrTO wa_t_cal-oslr.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;APPEND wa_t_cal TO t_yr_calc.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ENDAT.&lt;/STRONG&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vigneswaran S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2008 20:17:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/totals-problem/m-p/4014703#M959281</guid>
      <dc:creator>former_member491305</dc:creator>
      <dc:date>2008-06-10T20:17:47Z</dc:date>
    </item>
  </channel>
</rss>

