<?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: How to do Count in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-count/m-p/1725439#M316308</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sort itab.&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;  at end of bschl.&lt;/P&gt;&lt;P&gt;     sum.&lt;/P&gt;&lt;P&gt;     move-corresponding itab to iout.&lt;/P&gt;&lt;P&gt;     append out.&lt;/P&gt;&lt;P&gt;  endat.&lt;/P&gt;&lt;P&gt;  at end of blart.&lt;/P&gt;&lt;P&gt;     sum.&lt;/P&gt;&lt;P&gt;     move-corresponding itab to iout.&lt;/P&gt;&lt;P&gt;     translate iout using '* '.&lt;/P&gt;&lt;P&gt;     append out.&lt;/P&gt;&lt;P&gt;  endat.&lt;/P&gt;&lt;P&gt;  at end of hkont.&lt;/P&gt;&lt;P&gt;     sum.&lt;/P&gt;&lt;P&gt;     move-corresponding itab to iout.&lt;/P&gt;&lt;P&gt;     translate iout using '* '.&lt;/P&gt;&lt;P&gt;     append out.&lt;/P&gt;&lt;P&gt;  endat.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;sort iout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;iout has the relevant data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Oct 2006 17:08:05 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-10-30T17:08:05Z</dc:date>
    <item>
      <title>How to do Count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-count/m-p/1725437#M316306</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;I have got HKONT BLART BSCHL in a itab now I want to use an another field count where count of all the selected records is made per hkont at level 1, blart at level 2 and bschl at level 3&lt;/P&gt;&lt;P&gt;eg&lt;/P&gt;&lt;P&gt;hkont    blart    bschl    count&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;766000   blank    blank    55&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;766000   SA       blank    40&lt;/P&gt;&lt;P&gt;766000   SA       40       15&lt;/P&gt;&lt;P&gt;766000   SA       50       25&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;766000   AB       blank    15&lt;/P&gt;&lt;P&gt;766000   AB       40       5&lt;/P&gt;&lt;P&gt;766000   AB       50       10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in this for blart = AB 10 records of 50 bschl and 5 records of 40 bschl so total 15 , in that bschl shows blank, same for Blart = SA.&lt;/P&gt;&lt;P&gt;and the total of hkont shows 55 that is 15+40&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ur help will be highly appreciate&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Oct 2006 16:12:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-count/m-p/1725437#M316306</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-30T16:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to do Count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-count/m-p/1725438#M316307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
SORT itab.

LOOP AT itab.
  AT END OF bschl.
    SUM.
    tot_bschl = itab-bschl.
  ENDAT.

  AT END OF blart.
    SUM.
    tot_blart = itab-blart.
  ENDAT.

  AT END OF hkont.
    SUM.
    tot_hkont = itab-hkont.
  ENDAT.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fields starting with 'tot_' would contain subtotals for a given value in the field.  You can capture these along with the corresponding bschl, blart and hkont and store in another table, write to the screen, etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Oct 2006 16:41:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-count/m-p/1725438#M316307</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-30T16:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to do Count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-count/m-p/1725439#M316308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sort itab.&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;  at end of bschl.&lt;/P&gt;&lt;P&gt;     sum.&lt;/P&gt;&lt;P&gt;     move-corresponding itab to iout.&lt;/P&gt;&lt;P&gt;     append out.&lt;/P&gt;&lt;P&gt;  endat.&lt;/P&gt;&lt;P&gt;  at end of blart.&lt;/P&gt;&lt;P&gt;     sum.&lt;/P&gt;&lt;P&gt;     move-corresponding itab to iout.&lt;/P&gt;&lt;P&gt;     translate iout using '* '.&lt;/P&gt;&lt;P&gt;     append out.&lt;/P&gt;&lt;P&gt;  endat.&lt;/P&gt;&lt;P&gt;  at end of hkont.&lt;/P&gt;&lt;P&gt;     sum.&lt;/P&gt;&lt;P&gt;     move-corresponding itab to iout.&lt;/P&gt;&lt;P&gt;     translate iout using '* '.&lt;/P&gt;&lt;P&gt;     append out.&lt;/P&gt;&lt;P&gt;  endat.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;sort iout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;iout has the relevant data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Oct 2006 17:08:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-count/m-p/1725439#M316308</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-30T17:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to do Count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-count/m-p/1725440#M316309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In my opinion, the easies way is to COLLECT the data.  Here's a working example...   ...Mike&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Report ZCreateStats .

Data : Begin of iTab Occurs 0 ,
       HKont Type HKont ,
       Blart Type Blart ,
       BSChl Type BSCHl ,
       End Of iTab .

Data : Begin of Stats Occurs 0 ,
       HKont Type HKont ,
       Blart Type Blart ,
       BSChl Type BSCHl ,
       n     Type I     ,
       End Of Stats     .

*---------------------------------------------------*

Perform Create_Your_Data .

*********************************************
* Just Collect The Data At Different Levels *
*********************************************

Loop at iTab Into Stats .
  Stats-N = 1 .          Collect Stats .
  Clear Stats-BsChl .    Collect Stats .
  Clear Stats-Blart .    Collect Stats .
EndLoop .


Perform Write_Stats .

*&amp;amp;--------------------------------------------------*
*&amp;amp;      Form  Create_Your_Data
*&amp;amp;--------------------------------------------------*
FORM Create_Your_Data .
  iTab-hKont = '0000766000' . 
  iTab-Blart = 'SA' .
  Do 15 Times .
   iTab-BsChl = '40' . Append iTab .
  EndDo .
       
  Do 25 Times .
   iTab-BsChl = '50' . Append iTab .
  EndDo .

  iTab-Blart = 'AB' .

  Do 5 Times .
   iTab-BsChl = '40' . Append iTab .
  EndDo .
       
  Do 10 Times .
   iTab-BsChl = '50' . Append iTab .
  EndDo .

ENDFORM.

*&amp;amp;------------------------------------------*
*&amp;amp;      Form  Write_Stats          
*&amp;amp;------------------------------------------*
FORM Write_Stats .              
  Sort Stats .
  Loop at Stats .
    Write : /1 Stats-HKont , Stats-Blart , 
               Stats-BSChl , Stats-n .
  EndLoop .    

ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Oct 2006 21:06:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-do-count/m-p/1725440#M316309</guid>
      <dc:creator>mike_mcinerney</dc:creator>
      <dc:date>2006-10-30T21:06:21Z</dc:date>
    </item>
  </channel>
</rss>

