<?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 with count in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850575#M360373</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT COUNT( * ) FROM pa0001
INTO wa_teken_itab-ex_immobile
WHERE persg = '6'
AND persg = '7'
AND persg = '8'
AND orgeh = 'Z'
AND orgeh NE '00009999'
AND stell = 'A'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Jan 2007 14:26:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-01-09T14:26:13Z</dc:date>
    <item>
      <title>select with count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850574#M360372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hallow I have to do a select from table pa0001 (table of employee )and I wont just to count the number of employee in this table . how can I do that .&lt;/P&gt;&lt;P&gt;This is my select how can I improve it (like persg).&lt;/P&gt;&lt;P&gt;( i heard about select count but i dont now how to use it)&lt;/P&gt;&lt;P&gt;Thanks for your time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT &lt;/P&gt;&lt;P&gt;  FROM pa0001&lt;/P&gt;&lt;P&gt;  INTO wa_teken_itab-ex_immobile&lt;/P&gt;&lt;P&gt;  WHERE persg = '6'&lt;/P&gt;&lt;P&gt;  AND persg = '7'&lt;/P&gt;&lt;P&gt;  AND persg = '8'&lt;/P&gt;&lt;P&gt;  AND orgeh = 'Z'&lt;/P&gt;&lt;P&gt;  AND orgeh NE '00009999'&lt;/P&gt;&lt;P&gt;  AND stell = 'A'.&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, 09 Jan 2007 14:23:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850574#M360372</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-09T14:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: select with count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850575#M360373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT COUNT( * ) FROM pa0001
INTO wa_teken_itab-ex_immobile
WHERE persg = '6'
AND persg = '7'
AND persg = '8'
AND orgeh = 'Z'
AND orgeh NE '00009999'
AND stell = 'A'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jan 2007 14:26:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850575#M360373</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-09T14:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: select with count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850576#M360374</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;SELECT COUNT( DISTINCT EMPID )&lt;/P&gt;&lt;P&gt;FROM pa0001&lt;/P&gt;&lt;P&gt;INTO IT_EMPID_COUNT&lt;/P&gt;&lt;P&gt;WHERE persg = '6'&lt;/P&gt;&lt;P&gt;AND persg = '7'&lt;/P&gt;&lt;P&gt;AND persg = '8'&lt;/P&gt;&lt;P&gt;AND orgeh = 'Z'&lt;/P&gt;&lt;P&gt;AND orgeh NE '00009999'&lt;/P&gt;&lt;P&gt;AND stell = 'A'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now the field IT_EMPID_COUNT will have the No of records&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt; Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jan 2007 14:28:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850576#M360374</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-09T14:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: select with count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850577#M360375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Antonio,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U can use like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT  &amp;lt;b&amp;gt;COUNT(*)&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;FROM pa0001&lt;/P&gt;&lt;P&gt;INTO wa_teken_itab-ex_immobile&lt;/P&gt;&lt;P&gt;WHERE persg = '6'&lt;/P&gt;&lt;P&gt;AND persg = '7'&lt;/P&gt;&lt;P&gt;AND persg = '8'&lt;/P&gt;&lt;P&gt;AND orgeh = 'Z'&lt;/P&gt;&lt;P&gt;AND orgeh NE '00009999'&lt;/P&gt;&lt;P&gt;AND stell = 'A'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this one is not working then,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select all the records into Itab and use.&lt;/P&gt;&lt;P&gt;data: lv_no type i.&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE ITAB LINES LV_NO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LV_NO will have he number of records.&lt;/P&gt;&lt;P&gt;You can also use the SY-DBCNT.,&lt;/P&gt;&lt;P&gt;If useful reward.&lt;/P&gt;&lt;P&gt;Vasanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jan 2007 14:29:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850577#M360375</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-09T14:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: select with count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850578#M360376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this code &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : count type i.&lt;/P&gt;&lt;P&gt;select count(  *  ) into  count FROM pa0001&lt;/P&gt;&lt;P&gt;INTO wa_teken_itab-ex_immobile&lt;/P&gt;&lt;P&gt;WHERE persg = '6'&lt;/P&gt;&lt;P&gt;AND persg = '7'&lt;/P&gt;&lt;P&gt;AND persg = '8'&lt;/P&gt;&lt;P&gt;AND orgeh = 'Z'&lt;/P&gt;&lt;P&gt;AND orgeh NE '00009999'&lt;/P&gt;&lt;P&gt;AND stell = 'A'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dont forget to reward points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;barath.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jan 2007 14:30:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850578#M360376</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-09T14:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: select with count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850579#M360377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can't use COUNT, because there will be more than one record per employee.  These records are date sensitive,  so everytime there is a change, a new record is created with begin/end dates.  So you will need to get all of these records within your condition,  then  sort by PERNR and delete the adjacent records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001.

data: no_employees type i.
data: ipa0001 type table of pa0001.

select * from pa0001
             into table ipa0001
                 where persg = '6'
                 and persg = '7'
                 and persg = '8'
                 and orgeh = 'Z'
                 and orgeh ne '00009999'
                 and stell = 'A'.

sort ipa0001 by pernr ascending.
delete adjacent duplicates from ipa0001 comparing pernr.


describe table ipa0001 lines no_employees.

write:/ no_employees.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jan 2007 14:30:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850579#M360377</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-01-09T14:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: select with count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850580#M360378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe I'm crazy, but is there ever going to be a record where persg = '6' AND '7' AND '8'?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jan 2007 14:37:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850580#M360378</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-09T14:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: select with count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850581#M360379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hahah.  You're right Matt.  There is definitly an issue with it.   And the logic for ORGEH doesn't make sense either.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;where ( persg = '6'
     or  persg = '7'
     or  persg = '8' )
     and orgeh = 'Z'    
     and stell = 'A'.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jan 2007 14:40:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850581#M360379</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-01-09T14:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: select with count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850582#M360380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just add an additional condition to get a distinct list of current employees&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and begda le sy-datum&lt;/P&gt;&lt;P&gt;and endda ge sy-datum.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jan 2007 15:32:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850582#M360380</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-09T15:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: select with count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850583#M360381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;select * from pa0001&lt;/P&gt;&lt;P&gt;             into table itab&lt;/P&gt;&lt;P&gt;                 where persg = '6'&lt;/P&gt;&lt;P&gt;                 and persg = '7'&lt;/P&gt;&lt;P&gt;                 and persg = '8'&lt;/P&gt;&lt;P&gt;                 and orgeh = 'Z'&lt;/P&gt;&lt;P&gt;                 and orgeh ne '00009999'&lt;/P&gt;&lt;P&gt;                 and stell = 'A'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;sort itab by pernr ascending.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from itab comparing pernr.&lt;/P&gt;&lt;P&gt;describe table itab lines count.&lt;/P&gt;&lt;P&gt; write:/ count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AWARD POINTS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jan 2007 15:44:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-with-count/m-p/1850583#M360381</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-09T15:44:41Z</dc:date>
    </item>
  </channel>
</rss>

