<?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: select count in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596353#M866083</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check for the value in sy-dbcnt after getting the entries in &lt;/P&gt;&lt;P&gt;internal table  ..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Mar 2008 08:18:48 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-25T08:18:48Z</dc:date>
    <item>
      <title>select count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596348#M866078</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 wont to do select count but with for all entries there is way to &lt;/P&gt;&lt;P&gt;do it in different way because in table proj i have many projects?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT  dimybproject COUNT(*) AS cnt
  FROM /bic/0czempl
  INTO CORRESPONDING FIELDS OF TABLE it_e
  FOR ALL ENTRIES IN proj
  WHERE dimybproject EQ proj-project   
  GROUP BY dimybproject.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Mar 2008 08:02:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596348#M866078</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-25T08:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: select count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596349#M866079</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;after  the query has been executed u will get the Number of Records in the sy-dbcnt that will give u the count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Balakumar.G&lt;/P&gt;&lt;P&gt;Reward Points if helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Mar 2008 08:11:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596349#M866079</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-25T08:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: select count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596350#M866080</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 try to do like i write above and i have &lt;STRONG&gt;error&lt;/STRONG&gt; that i &lt;STRONG&gt;cant&lt;/STRONG&gt; use for all enries for select count&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Mar 2008 08:14:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596350#M866080</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-25T08:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: select count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596351#M866081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ricardo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a way to achieve your functionality but not like the way that you've mentioned above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you need to populate the table using Select ...Endselect within which you need to populate the project name into the internal table. i.e.. write only count(*) inside the Select query. But this is an obsolete and a worst way to achieve this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, you need to write a logic after populating the internal table with project names for counting them. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you add a field which is an integer and collect the internal table so that that field adds up to the count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reward points if this helps,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Kiran&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Mar 2008 08:15:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596351#M866081</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-25T08:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: select count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596352#M866082</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;this is the error :&lt;/P&gt;&lt;P&gt;The addition "FOR ALL ENTRIES" excludes all aggregate functions with the exception of "COUNT( * )" as the single element of the SELECT	clause.		&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Mar 2008 08:16:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596352#M866082</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-25T08:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: select count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596353#M866083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check for the value in sy-dbcnt after getting the entries in &lt;/P&gt;&lt;P&gt;internal table  ..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Mar 2008 08:18:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596353#M866083</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-25T08:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: select count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596354#M866084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;&lt;SPAN __default_attr="sylfaen" __jive_macro_name="font"&gt;&lt;SPAN __default_attr="15" __jive_macro_name="size"&gt;
Hi Ricardo,

Treat this as a limitation from SAP as FOR ALL ENTRIES can not accept few clauses like ORDER BY, HAVING...

I doubt if we can find a way to go without further manipulations.

Though it is a bit tedious two ways to acheive the result as you might be knowing are:
1. Build a range for Project and use the same avoiding FOR ALL ENTRIES 
2. LOOP on first internal table and use APPENDING table instead of INTO TABLE.
&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN __default_attr="maroon" __jive_macro_name="color"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Mar 2008 08:32:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596354#M866084</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-25T08:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: select count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596355#M866085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can just count the number of records in it_e&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ie,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data :&lt;/P&gt;&lt;P&gt;count type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Describe table it_e  LINES COUNT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now count contains the number of records.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Mar 2008 08:39:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596355#M866085</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-25T08:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: select count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596356#M866086</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;check this example.....&lt;/P&gt;&lt;P&gt;tables:pa0008.&lt;/P&gt;&lt;P&gt;data:   begin of itab occurs 0,&lt;/P&gt;&lt;P&gt;        pernr like pa0008-pernr,&lt;/P&gt;&lt;P&gt;        begda like pa0008-begda,&lt;/P&gt;&lt;P&gt;        ansal like pa0008-ansal,&lt;/P&gt;&lt;P&gt;        count type i,&lt;/P&gt;&lt;P&gt;        end of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select-options:s_pernr for pa0008-pernr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select pernr&lt;/P&gt;&lt;P&gt;     count(*) as count&lt;/P&gt;&lt;P&gt;    from pa0008&lt;/P&gt;&lt;P&gt; into corresponding fields of table itab&lt;/P&gt;&lt;P&gt; where pernr in s_pernr&lt;/P&gt;&lt;P&gt; group by  pernr .&lt;/P&gt;&lt;P&gt; sort itab by pernr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; loop at itab.&lt;/P&gt;&lt;P&gt; write:/ itab-pernr,&lt;/P&gt;&lt;P&gt;         itab-count .&lt;/P&gt;&lt;P&gt; endloop.&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;venkat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Mar 2008 08:48:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596356#M866086</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-25T08:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: select count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596357#M866087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi frinds,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks i solve it with ranges,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT proj ASSIGNING &amp;lt;fs_p&amp;gt;.

    proj_tab-sign = 'I'.
    proj_tab-option = 'EQ'.
    proj_tab-low = &amp;lt;fs_p&amp;gt;-ybproject.

    APPEND p_tab.

  ENDLOOP.



  SELECT  dimybproject COUNT(*) AS cnt
  FROM /bic/0czempl
  INTO CORRESPONDING FIELDS OF TABLE it_e
  WHERE dimybproject IN p_tab
  GROUP BY dimybproject.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Mar 2008 08:53:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-count/m-p/3596357#M866087</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-25T08:53:42Z</dc:date>
    </item>
  </channel>
</rss>

