<?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: Help on SELECT Query - count in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-select-query-count/m-p/6859117#M1475449</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the issue is solved.&lt;/P&gt;&lt;P&gt;But anyone know why the count in select query doesnot work? If it is wrong it should have given syntax error. But its not.&lt;/P&gt;&lt;P&gt;Can someone explain?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again thanks for timely help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Apr 2010 10:36:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-04-27T10:36:03Z</dc:date>
    <item>
      <title>Help on SELECT Query - count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-select-query-count/m-p/6859110#M1475442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gurus,&lt;/P&gt;&lt;P&gt;I am new to Abap and have a specific requirement.&lt;/P&gt;&lt;P&gt;I have attached my coding below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to count the number of exidv in my internal table. Now my coding displays 10 exidvs correctly, but not counting as 10. &lt;/P&gt;&lt;P&gt;Pls help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Coding follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Types: begin of t_final,&lt;/P&gt;&lt;P&gt;        tknum type vttk-tknum,&lt;/P&gt;&lt;P&gt;        vbeln type vttp-vbeln,&lt;/P&gt;&lt;P&gt;        wadat type likp-wadat, bolnr type likp-bolnr, btgew type likp-btgew, volum type likp-volum, gewei type likp-gewei,&lt;/P&gt;&lt;P&gt;        vgbel type lips-vgbel,&lt;/P&gt;&lt;P&gt;        name1 type adrc-name1,"        vbeln type vbpa-vbeln,&lt;/P&gt;&lt;P&gt;        street type adrc-street, city1 type adrc-city1, post_code1 type adrc-post_code1,&lt;/P&gt;&lt;P&gt;        exidv type vekp-exidv,&lt;/P&gt;&lt;P&gt;        count type n length 3,&lt;/P&gt;&lt;P&gt;       end of t_final.&lt;/P&gt;&lt;P&gt;Data: it_final type t_final occurs 0,&lt;/P&gt;&lt;P&gt;      wg_final type t_final.&lt;/P&gt;&lt;P&gt;data: exidv_chk type vekp-exidv, count type n length 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select a&lt;SUB&gt;tknum b&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;c&lt;SUB&gt;wadat c&lt;/SUB&gt;bolnr c&lt;SUB&gt;btgew c&lt;/SUB&gt;volum c~gewei&lt;/P&gt;&lt;P&gt;d~vgbel&lt;/P&gt;&lt;P&gt;f&lt;SUB&gt;street f&lt;/SUB&gt;name1 f&lt;SUB&gt;city1 f&lt;/SUB&gt;post_code1&lt;/P&gt;&lt;P&gt;h~exidv&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;count( distinct  h~exidv )&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from vttk as a inner join vttp as b on a&lt;SUB&gt;tknum = b&lt;/SUB&gt;tknum&lt;/P&gt;&lt;P&gt;inner join likp as c on c&lt;SUB&gt;vbeln = b&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;inner join lips as d on c&lt;SUB&gt;vbeln = d&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;inner join vbpa as e on d&lt;SUB&gt;vgbel = e&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;inner join adrc as f on e&lt;SUB&gt;adrnr = f&lt;/SUB&gt;addrnumber&lt;/P&gt;&lt;P&gt;inner join vepo as g on c&lt;SUB&gt;vbeln = g&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;inner join vekp as h on g&lt;SUB&gt;venum = h&lt;/SUB&gt;venum&lt;/P&gt;&lt;P&gt;into corresponding fields of table it_final where a&lt;SUB&gt;tknum = g_tknum and e&lt;/SUB&gt;parvw = 'WE'&lt;/P&gt;&lt;P&gt;group by a&lt;SUB&gt;tknum b&lt;/SUB&gt;vbeln c&lt;SUB&gt;wadat c&lt;/SUB&gt;bolnr c&lt;SUB&gt;btgew c&lt;/SUB&gt;volum c&lt;SUB&gt;gewei d&lt;/SUB&gt;vgbel f&lt;SUB&gt;street f&lt;/SUB&gt;name1 f&lt;SUB&gt;city1 f&lt;/SUB&gt;post_code1 h~exidv.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Apr 2010 08:55:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-select-query-count/m-p/6859110#M1475442</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-27T08:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: Help on SELECT Query - count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-select-query-count/m-p/6859111#M1475443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In select query remove the count.&lt;/P&gt;&lt;P&gt;after select query use the following.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DELETE itab WHERE exidv is initial. &lt;/P&gt;&lt;P&gt;data: num  type i.&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE ITAB LINES num.&lt;/P&gt;&lt;P&gt;  num ==&amp;gt; count of the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Vallamuthu.M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Apr 2010 09:43:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-select-query-count/m-p/6859111#M1475443</guid>
      <dc:creator>vallamuthu_madheswaran2</dc:creator>
      <dc:date>2010-04-27T09:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: Help on SELECT Query - count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-select-query-count/m-p/6859112#M1475444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Vallamuthu.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But this method ultimately counts the number of lines of the internal table and not exidv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I mean if internal table contains 10 exidvs in which 2 are repeating, I need the count as 8. But this method counts as 10 which is size of internal table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any other suggestions pls...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Apr 2010 10:01:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-select-query-count/m-p/6859112#M1475444</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-27T10:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: Help on SELECT Query - count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-select-query-count/m-p/6859113#M1475445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In the above code you can add the following lines :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE itab WHERE exidv is initial. &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sort itab with exidv.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;delete adjascent duplicates from itab comparing exidv.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;data: num type i.&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE ITAB LINES num.&lt;/P&gt;&lt;P&gt;num ==&amp;gt; count of the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will give you the exact count of exidv without repetitions.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Samreen.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Apr 2010 10:16:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-select-query-count/m-p/6859113#M1475445</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-27T10:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: Help on SELECT Query - count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-select-query-count/m-p/6859114#M1475446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well then you could declare a separate internal table for the exidv values alone and make the count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;after the select statement,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: begin of itab1 occurs 0,
         exidv  type exidv .
        end of itab1.

loop at itab.
itab-exidv  = itab1-exidv .
append itab1.
clear itab1.
endloop.

delete adjacent duplicates from itab1.

describe table itab1 lines l1.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vikranth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Apr 2010 10:20:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-select-query-count/m-p/6859114#M1475446</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-27T10:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: Help on SELECT Query - count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-select-query-count/m-p/6859115#M1475447</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;Please refer reply down.&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;Smart Varghese&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Apr 2010 10:21:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-select-query-count/m-p/6859115#M1475447</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-27T10:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help on SELECT Query - count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-select-query-count/m-p/6859116#M1475448</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;Do like this after your select statement &lt;STRONG&gt;with out the COUNT&lt;/STRONG&gt; option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SORT itab BY exidv.&lt;/STRONG&gt;    " itab the internal table having the selected records&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DELETE itab WHERE exidv IS INITIAL.                      " Deletes lines where there is no exidv&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DELETE ADJACENT DUPLICATES FROM itab COMPARING exidv.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;count = lines( itab ).             " Here the count will be stored by the number of unique exidv&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: Instead of COUNT you can use DESCRIBE to get the lines of ITAB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this may help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Smart Varghese&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Apr 2010 10:23:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-select-query-count/m-p/6859116#M1475448</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-27T10:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: Help on SELECT Query - count</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-select-query-count/m-p/6859117#M1475449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the issue is solved.&lt;/P&gt;&lt;P&gt;But anyone know why the count in select query doesnot work? If it is wrong it should have given syntax error. But its not.&lt;/P&gt;&lt;P&gt;Can someone explain?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again thanks for timely help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Apr 2010 10:36:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-on-select-query-count/m-p/6859117#M1475449</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-27T10:36:03Z</dc:date>
    </item>
  </channel>
</rss>

