<?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: Count the Records in  an internal table without a loop. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466784#M1416537</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;Here is some code to calculate sum of a field in an internal table without LOOP...ENDLOOP&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select * from mard into table @data(lta_data).

 select sum( a~labst ) from @lta_data as a into @data(lv_sum).

 write lv_sum.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;NOTE:-&lt;/STRONG&gt; This code has been successfully executed in ABAP 7.4 version, and this feature has to be supported by your database. &lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Even though it's been long since this question has posted. we just want to share. it may help some one!! &lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;ABAP Newbies&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jul 2019 08:07:09 GMT</pubDate>
    <dc:creator>srikar_poshetti</dc:creator>
    <dc:date>2019-07-23T08:07:09Z</dc:date>
    <item>
      <title>Count the Records in  an internal table without a loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466773#M1416526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How do i count the number of records in an internal table without using the loop  statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Describe statement give the total no. of records in the internal table.But i want the count of the key fields in the internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For eg &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Row Field&lt;/P&gt;&lt;P&gt;1       A&lt;/P&gt;&lt;P&gt;2       A&lt;/P&gt;&lt;P&gt;3       A&lt;/P&gt;&lt;P&gt;4       B&lt;/P&gt;&lt;P&gt;5       B&lt;/P&gt;&lt;P&gt;6       C &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count of A = 3&lt;/P&gt;&lt;P&gt;Count of B = 2&lt;/P&gt;&lt;P&gt;Count of C = 1&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jan 2010 04:45:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466773#M1416526</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-05T04:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: Count the Records in  an internal table without a loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466774#M1416527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want number of key fields in the internal table which you will get from the inetral table defination &lt;/P&gt;&lt;P&gt;ie suppose if mara&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it_mara type standard table of mara..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so if you can check the mara table you will get the number of key fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Satish Boguda&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jan 2010 15:44:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466774#M1416527</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-05T15:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: Count the Records in  an internal table without a loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466775#M1416528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The key fields of a internal table are the non numeric fields.&lt;/P&gt;&lt;P&gt;Its not the key field count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it must be count based on unique data in internal table.&lt;/P&gt;&lt;P&gt;Without a loop its not possible because its a manipulation with the number of records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

types:begin of ty,
field1 type c,
row type i.
end of ty.

data:it type table of ty,
wa type ty.

loop at itab into wa1. "itab holds your data
wa-field1 = wa1-field1 "Here 'A' for ex.
wa-row = 1.
collect wa into it.
clear wa.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jan 2010 16:01:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466775#M1416528</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-01-05T16:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: Count the Records in  an internal table without a loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466776#M1416529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dilip, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  I think isn't posible. Only 3 ideas:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1ª, make other table "table2", similar to your actual table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     table2[] = yourtable[].&lt;/P&gt;&lt;P&gt;     delete table2 where key &amp;lt;&amp;gt; 'A'.&lt;/P&gt;&lt;P&gt;     describe table table2 lines contA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    But depending the amount of data, you may have problems in performance or memory consumption...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2ª, make other table, only with the keys fields and a count field,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    data begin table2&lt;/P&gt;&lt;P&gt;       key_field1,&lt;/P&gt;&lt;P&gt;       ...&lt;/P&gt;&lt;P&gt;       cont type i.&lt;/P&gt;&lt;P&gt;    end data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   when you append lines to yourdata, make a collect to this table:&lt;/P&gt;&lt;P&gt;    table2-keys = yourtable-keys.&lt;/P&gt;&lt;P&gt;    table2-cont = 1.&lt;/P&gt;&lt;P&gt;   collect table2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   But only works if you can modify the program where data is appended, and you may be carefull when data is deleted :-(...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3ª if your data if filled in a select, you may fill the table2 of point 2ª, making a similar select but:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   select keyfields count( * ) into table table2&lt;/P&gt;&lt;P&gt;  from ...&lt;/P&gt;&lt;P&gt;  where (the same you have to fill your original table...)&lt;/P&gt;&lt;P&gt;   group by keys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; But you have the same problem is data is deleted later...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope that any of the three is useful for you...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Diego Alvarez on Jan 5, 2010 5:09 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jan 2010 16:08:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466776#M1416529</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-05T16:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Count the Records in  an internal table without a loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466777#M1416530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the READ or DO statements instead, but it won't help much if at all. One way or another, each record has to be checked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jan 2010 16:10:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466777#M1416530</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-05T16:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: Count the Records in  an internal table without a loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466778#M1416531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dilip,&lt;/P&gt;&lt;P&gt;             I think u should go for collect statment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if ur taking data from DB then use collect stat between select and endselect.&lt;/P&gt;&lt;P&gt;If ur appending the data instead of append write collect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will give u count for ur default char field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then display this with the help of Loop and endloop.&lt;/P&gt;&lt;P&gt;U have to use loop and endloop atleast for displying.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Anmol&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jan 2010 20:03:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466778#M1416531</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-05T20:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Count the Records in  an internal table without a loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466779#M1416532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dilip,&lt;/P&gt;&lt;P&gt;It appears you will have to use one or the other type of loop (do/while/loop) to get your result. I do not see any other go.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However Iu2019d like to know what is your exact requirement so that we may find any other option which is not very obvious with the given example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Pritam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jan 2010 21:57:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466779#M1416532</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-05T21:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: Count the Records in  an internal table without a loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466780#M1416533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks kesavdas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;its working perfactly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 11:13:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466780#M1416533</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-19T11:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: Count the Records in  an internal table without a loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466781#M1416534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;read help.sap document&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_470/helpdata/en/fc/eb381a358411d1829f0000e829fbfe/content.htm" title="http://help.sap.com/saphelp_470/helpdata/en/fc/eb381a358411d1829f0000e829fbfe/content.htm"&gt;http://help.sap.com/saphelp_470/helpdata/en/fc/eb381a358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 20 Jul 2013 06:18:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466781#M1416534</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-20T06:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: Count the Records in  an internal table without a loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466782#M1416535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use collect but ensure you have characters and numeric fields in your internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can preparing an internal table with two fields as shown below by moving details from the first table using collect statement.&lt;/P&gt;&lt;P&gt;Char&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Num&lt;/P&gt;&lt;P&gt;Field 1&amp;nbsp;&amp;nbsp; Field&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Jul 2013 21:27:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466782#M1416535</guid>
      <dc:creator>former_member193284</dc:creator>
      <dc:date>2013-07-21T21:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Count the Records in  an internal table without a loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466783#M1416536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dilip,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For your scenario, you can use &lt;STRONG&gt;Group by in Query &lt;/STRONG&gt;for this, if have data into more than one table you can also use sub-query.&amp;nbsp; I think there is no option to count group by from internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ram Shanker&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jul 2013 07:09:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466783#M1416536</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-22T07:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: Count the Records in  an internal table without a loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466784#M1416537</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;Here is some code to calculate sum of a field in an internal table without LOOP...ENDLOOP&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select * from mard into table @data(lta_data).

 select sum( a~labst ) from @lta_data as a into @data(lv_sum).

 write lv_sum.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;NOTE:-&lt;/STRONG&gt; This code has been successfully executed in ABAP 7.4 version, and this feature has to be supported by your database. &lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Even though it's been long since this question has posted. we just want to share. it may help some one!! &lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;ABAP Newbies&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 08:07:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466784#M1416537</guid>
      <dc:creator>srikar_poshetti</dc:creator>
      <dc:date>2019-07-23T08:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: Count the Records in  an internal table without a loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466785#M1416538</link>
      <description>&lt;P&gt;Why not using the shorter code below? (it used to work for last 20 years in all the ABAP versions I used)&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select sum( labst ) from mard into lv_sum.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Jul 2019 13:57:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466785#M1416538</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2019-07-23T13:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: Count the Records in  an internal table without a loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466786#M1416539</link>
      <description>&lt;P&gt;Hi Sandra, I can't speak for Srikar, but I &lt;STRONG&gt;&lt;EM&gt;think&lt;/EM&gt; &lt;/STRONG&gt;the point is to show the SELECT from internal table as a data source. Very useful if you have data coming from a file.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2019 01:50:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466786#M1416539</guid>
      <dc:creator>custodio_deoliveira</dc:creator>
      <dc:date>2019-07-25T01:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: Count the Records in  an internal table without a loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466787#M1416540</link>
      <description>&lt;P&gt;&lt;A href="https://answers.sap.com/users/429/custodio.deoliveira.html"&gt;Custodio de Oliveira&lt;/A&gt; Thanks. I realize now what the question was (counting the number of distinct values of a column in a internal table) and I just looked at the answer's code without the context and felt that the proposed code was non-sense (and now I see that it used SUM instead of COUNT GROUP BY if it really wants to answer the question). But beware of performance drop versus classic ABAP: for the simple aggregation "sum( labst )" I did a test of SELECT FROM  @itab versus REDUCE which gives REDUCE: 2566.29 &amp;lt; SELECT FROM @itab: 3362.21. Well I must say I'm impressed by SELECT, it's only 35% slower for this simple query, the compiler seems good, but it might be worse for more complex SELECT queries.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2019 05:21:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-the-records-in-an-internal-table-without-a-loop/m-p/6466787#M1416540</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2019-07-25T05:21:02Z</dc:date>
    </item>
  </channel>
</rss>

