<?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 Count unique data records from internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-unique-data-records-from-internal-table/m-p/7775821#M1584918</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 want to select unique enteries from an internal table and count that numebr in another row&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example my internal table&lt;/P&gt;&lt;P&gt;ITAB&lt;/P&gt;&lt;P&gt;EBELN &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0026000060&lt;/P&gt;&lt;P&gt;0026000060&lt;/P&gt;&lt;P&gt;0026000060&lt;/P&gt;&lt;P&gt;0026000060&lt;/P&gt;&lt;P&gt;0026000061&lt;/P&gt;&lt;P&gt;0026000061&lt;/P&gt;&lt;P&gt;0026000061&lt;/P&gt;&lt;P&gt;0026000062&lt;/P&gt;&lt;P&gt;0026000062&lt;/P&gt;&lt;P&gt;0026000063&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to show in ITAB_FINAL&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; EBELN                                              COUNT OF UNIQUE RECORDS
0026000060                                                    4
0026000060                                                    4
0026000060                                                    4
0026000060                                                    4
0026000061                                                     3
0026000061                                                     3
0026000061                                                      3
0026000062                                                        2
0026000062                                                           2
0026000063                                                           1&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me how to achive this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Apr 2011 21:41:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-04-07T21:41:13Z</dc:date>
    <item>
      <title>Count unique data records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-unique-data-records-from-internal-table/m-p/7775821#M1584918</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 want to select unique enteries from an internal table and count that numebr in another row&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example my internal table&lt;/P&gt;&lt;P&gt;ITAB&lt;/P&gt;&lt;P&gt;EBELN &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0026000060&lt;/P&gt;&lt;P&gt;0026000060&lt;/P&gt;&lt;P&gt;0026000060&lt;/P&gt;&lt;P&gt;0026000060&lt;/P&gt;&lt;P&gt;0026000061&lt;/P&gt;&lt;P&gt;0026000061&lt;/P&gt;&lt;P&gt;0026000061&lt;/P&gt;&lt;P&gt;0026000062&lt;/P&gt;&lt;P&gt;0026000062&lt;/P&gt;&lt;P&gt;0026000063&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to show in ITAB_FINAL&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; EBELN                                              COUNT OF UNIQUE RECORDS
0026000060                                                    4
0026000060                                                    4
0026000060                                                    4
0026000060                                                    4
0026000061                                                     3
0026000061                                                     3
0026000061                                                      3
0026000062                                                        2
0026000062                                                           2
0026000063                                                           1&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me how to achive this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Apr 2011 21:41:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-unique-data-records-from-internal-table/m-p/7775821#M1584918</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-07T21:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Count unique data records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-unique-data-records-from-internal-table/m-p/7775822#M1584919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi kiran.,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;refer this.,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;types:begin of ty_ebeln,
  ebeln type ebeln,
  end of ty_ebeln.

types:begin of ty_count,   " req op structure..
  ebeln type ebeln,
  count type i,
  end of ty_count.

data:itab type table of ty_ebeln,
      wa_ebeln type ty_ebeln,
      it_count type table of ty_count,
      wa_count type ty_count.

data index type i.

sort itab by ebeln ascending.

LOOP AT itab into wa_ebeln.
  index = index + 1.

  at end of ebeln.
    wa_count-ebeln = wa_ebeln-ebeln.
    wa_count-count = index.
    append wa_count to it_count.
    clear wa_count.
    index = 0.
  endat.


ENDLOOP.


LOOP AT it_count into wa_count.

  write:/ wa_count-ebeln, 10 wa_count-count.

ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reply if u need some more clarifications,.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Apr 2011 00:00:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-unique-data-records-from-internal-table/m-p/7775822#M1584919</guid>
      <dc:creator>Kiran_Valluru</dc:creator>
      <dc:date>2011-04-08T00:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: Count unique data records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-unique-data-records-from-internal-table/m-p/7775823#M1584920</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 solved my own.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;..CLEAR g_ebeln.

loop at itab into wa.

IF wa-ebeln NE g_Ebeln.
 LOOP AT itab where ebeln = wa-ebeln.
   g_count = g_count + 1.
 ENDLOOP.
ENDIF. 
g_ebeln = wa-ebeln.
 
 clear wa_final.
 wa_final-ebeln = wa-ebeln.
 wa_final-count = g_count.
 append wa_final to itab_final.

ENDLOOP.  &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Apr 2011 00:06:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-unique-data-records-from-internal-table/m-p/7775823#M1584920</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-04-08T00:06:43Z</dc:date>
    </item>
  </channel>
</rss>

