<?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: Internal tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088450#M1181339</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Meenakshi,  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Try it this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Data:
  count type i value 1,
  w_f2  type i.

Data:
  Begin of wa,
    f1(10) type c,
    f2     type i,
  End of wa.

Data:
  itab like table of wa.

Clear wa.
wa-f1 = 'a'.
wa-f2 = 10.
Append wa to itab.

Clear wa.
wa-f1 = 'a'.
wa-f2 = 10.
Append wa to itab.

Clear wa.
wa-f1 = 'b'.
wa-f2 = 10.
Append wa to itab.

Clear wa.
wa-f1 = 'c'.
wa-f2 = 12.
Append wa to itab.

Clear wa.
wa-f1 = 'c'.
wa-f2 = 12.
Append wa to itab.

Clear wa.
wa-f1 = 'c'.
wa-f2 = 12.
Append wa to itab.

Clear wa.
wa-f1 = 'c'.
wa-f2 = 15.
Append wa to itab.

Clear wa.
wa-f1 = 'c'.
wa-f2 = 15.
Append wa to itab.

Sort itab by f2.

Loop at itab into wa.

  At First.
    Count = 0.
    w_f2  = 0.
  Endat.

  If w_f2 eq wa-f2.
    Count = count + 1.
    w_f2 = wa-f2.
  Elseif w_f2 ne wa-f2.
    Write:/ count, w_f2.
    w_f2 = wa-f2.
    count = 1.
  Endif.

  At last.
    Write:/ count, w_f2.
  Endat.

Endloop.&lt;/CODE&gt;&lt;/PRE&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;&lt;/P&gt;&lt;P&gt;With luck,&lt;/P&gt;&lt;P&gt;Pritam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Feb 2009 07:04:27 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-02-02T07:04:27Z</dc:date>
    <item>
      <title>Internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088436#M1181325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     I  have an internal table like the one  below, now based upon  the field f2, i need only the count i.e the no. of records in field f1,for instance there are 3 records  for field f2 for value of 10 and similarly for 15 two records in f1. I tried using At new, at end  of &amp;amp; on change on , but was not able to get the count of records.Please provide me a solution.Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    f1  f2&lt;/P&gt;&lt;P&gt;    a  10&lt;/P&gt;&lt;P&gt;    a  10&lt;/P&gt;&lt;P&gt;    b  10&lt;/P&gt;&lt;P&gt;    c  15&lt;/P&gt;&lt;P&gt;    c  15&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Meenakshi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2009 06:27:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088436#M1181325</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-01T06:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088437#M1181326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;wat u can do is get the records in the order F2 F1 in the same or another internal table ,then sort the table by F2 and then take the count based on AT END OF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2009 06:32:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088437#M1181326</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-01T06:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088438#M1181327</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;Try this way..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Sort itab by F2.
Loop at itab.

  Count = count + 1.
  At end of F2.
    Write:/ itab-f2, Count.
    clear count.
  Endat.

Endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2009 06:39:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088438#M1181327</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-01T06:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088439#M1181328</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;here is sample code. hope it will help u.&lt;/P&gt;&lt;P&gt; try ur filed f2 to keep at left. meanz it should be ur ist field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ztn_test.

data: BEGIN OF it_tab occurs 10,
      f2 type i,
      f1(1),
      END OF it_tab .

data: wa_it_tab like it_tab.


 it_tab-f2 = '10'.  it_tab-f1 = 'A'. APPEND it_tab.
 it_tab-f2 = '10'.  it_tab-f1 = 'A'. APPEND it_tab.
 it_tab-f2 = '12'.  it_tab-f1 = 'B'. APPEND it_tab.
 it_tab-f2 = '12'.  it_tab-f1 = 'B'. APPEND it_tab.
 it_tab-f2 = '12'.  it_tab-f1 = 'C'. APPEND it_tab.
 it_tab-f2 = '11'.  it_tab-f1 = 'D'. APPEND it_tab.
 SORT it_tab by f2.

 data: count TYPE i.
 loop AT it_tab into wa_it_tab.
   at new f2.
      count = 0.
   ENDAT.

   count = count + 1.

   at end of f2.
     write:/ wa_it_tab-f2 , 'are', count.
   ENDAT.
   CLEAR wa_it_tab.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2009 06:45:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088439#M1181328</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-01T06:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088440#M1181329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For that, you can use &lt;STRONG&gt;collect&lt;/STRONG&gt; statement as follows:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES: begin of ty_sum,
         f2 LIKE &amp;lt;your_itab&amp;gt;-f2,
         sum TYPE i,
       end of ty_sum.

DATA: it_sum TYPE STANDARD TABLE OF ty_sum,
      wa_sum TYPE ty_sum.

LOOP AT &amp;lt;your_itab&amp;gt; INTO &amp;lt;your_wa&amp;gt;.
  CLEAR wa_sum.
  wa_sum-f2 = &amp;lt;your_wa&amp;gt;-f2
  wa_sum-sum = 1.
  COLLECT wa_sum INTO it_sum.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Valter Oliveira.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Feb 2009 12:29:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088440#M1181329</guid>
      <dc:creator>valter_oliveira</dc:creator>
      <dc:date>2009-02-01T12:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088441#M1181330</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;you can do this using the same logic as you are using, but one simple change you need to do is&lt;/P&gt;&lt;P&gt;1.Create an internal table with fileds f2 and f1&lt;/P&gt;&lt;P&gt;2.Sort the internal table according to f2&lt;/P&gt;&lt;P&gt;3.and simply use AT NEW and AT END, with the count&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will solve the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pooja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 04:33:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088441#M1181330</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-02T04:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088442#M1181331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi meenakshi&lt;/P&gt;&lt;P&gt;sort the table with field f2.&lt;/P&gt;&lt;P&gt;set flag .then declare a temporary varaible say v1.loop at itab.&lt;/P&gt;&lt;P&gt;store the value of f2 filed in temp variable comparing previous value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 04:47:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088442#M1181331</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-02T04:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088443#M1181332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try something like this..&lt;/P&gt;&lt;P&gt;data : &lt;/P&gt;&lt;P&gt;v1 type i value 0,&lt;/P&gt;&lt;P&gt;count type i value 0,&lt;/P&gt;&lt;P&gt;flag type i value 0.&lt;/P&gt;&lt;P&gt;sort itab by f2.&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;if v1 = itab-f2 or flag = 0.&lt;/P&gt;&lt;P&gt;flag  = 1.&lt;/P&gt;&lt;P&gt;count  = count + 1.&lt;/P&gt;&lt;P&gt;at endof f2.&lt;/P&gt;&lt;P&gt;write : count.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;v1 = itab-f2.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;flag = 1.&lt;/P&gt;&lt;P&gt;clear : count.&lt;/P&gt;&lt;P&gt;count =count + 1.&lt;/P&gt;&lt;P&gt;v1 = itab-f2.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: rakesh on Feb 2, 2009 12:12 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 05:12:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088443#M1181332</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-02T05:12:18Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088444#M1181333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Meenakshi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of using at end of field name use ON CHANGE-ENDON inside loop. and create one extra field in internal table as count and asssign this count value to it.. and then clear count variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it will help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pranil.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 05:17:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088444#M1181333</guid>
      <dc:creator>Pranil1</dc:creator>
      <dc:date>2009-02-02T05:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088445#M1181334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi try this code.&lt;/P&gt;&lt;P&gt;data: BEGIN OF it_tab occurs 10,&lt;/P&gt;&lt;P&gt;      f2 type c,&lt;/P&gt;&lt;P&gt;     f1 type string,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      END OF it_tab .&lt;/P&gt;&lt;P&gt;data: BEGIN OF it_tab1 occurs 10,&lt;/P&gt;&lt;P&gt;      f2 type c,&lt;/P&gt;&lt;P&gt;      f1 type string,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      END OF it_tab1 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; it_tab-f2 = '10'.  it_tab-f1 = 'A'. APPEND it_tab.&lt;/P&gt;&lt;P&gt; it_tab-f2 = '10'.  it_tab-f1 = 'A'. APPEND it_tab.&lt;/P&gt;&lt;P&gt; it_tab-f2 = '15'.  it_tab-f1 = 'B'. APPEND it_tab.&lt;/P&gt;&lt;P&gt; it_tab-f2 = '15'.  it_tab-f1 = 'B'. APPEND it_tab.&lt;/P&gt;&lt;P&gt; it_tab-f2 = '14'.  it_tab-f1 = 'C'. APPEND it_tab.&lt;/P&gt;&lt;P&gt; it_tab-f2 = '11'.  it_tab-f1 = 'D'. APPEND it_tab.&lt;/P&gt;&lt;P&gt; SORT it_tab by f2.&lt;/P&gt;&lt;P&gt;DATA: itab    like STANDARD TABLE OF it_tab,&lt;/P&gt;&lt;P&gt;      results TYPE match_result_tab.&lt;/P&gt;&lt;P&gt;it_tab1[ ] = it_tab[ ].&lt;/P&gt;&lt;P&gt;DATA x type string.&lt;/P&gt;&lt;P&gt;data: mcnt type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_tab.&lt;/P&gt;&lt;P&gt; CONCATENATE  it_tab-f1 x into x.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;  DELETE ADJACENT DUPLICATES FROM it_tab1 COMPARING f1.&lt;/P&gt;&lt;P&gt;LOOP at it_tab1.&lt;/P&gt;&lt;P&gt;  FIND ALL OCCURRENCES OF it_tab1-f1&lt;/P&gt;&lt;P&gt;  IN x&lt;/P&gt;&lt;P&gt;  MATCH COUNT  mcnt.&lt;/P&gt;&lt;P&gt;  write: mcnt , it_tab1-f1.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: abap on Feb 2, 2009 6:45 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: abap on Feb 2, 2009 6:46 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 05:44:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088445#M1181334</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-02T05:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088446#M1181335</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;You can do this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create  another internal table with only field f2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types: begin of t_itab1,&lt;/P&gt;&lt;P&gt;          f1 type c,&lt;/P&gt;&lt;P&gt;          f2 type i,&lt;/P&gt;&lt;P&gt;          end of t_itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types: begin of t_itab2,&lt;/P&gt;&lt;P&gt;          f2 type i,&lt;/P&gt;&lt;P&gt;          end of t_itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data: i_itab1 type table of t_itab1,&lt;/P&gt;&lt;P&gt;         wa_itab1 like line of i_itab1,&lt;/P&gt;&lt;P&gt;         i_itab2 type table of t_itab2,&lt;/P&gt;&lt;P&gt;         wa_itab2 like line of i_itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data: l_counter type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort i_itab1 by f2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at i_itab1 into wa_itab1.&lt;/P&gt;&lt;P&gt;wa_itab2-f2 = wa_itab1-f2.&lt;/P&gt;&lt;P&gt;append wa_itab2 to i_itab2.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Delete adjacent duplicates from i_itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at i_itab2 into wa_itab2.&lt;/P&gt;&lt;P&gt;refresh l_counter.&lt;/P&gt;&lt;P&gt;loop at i_itab1 into wa_itab1 where wa_itab1-f2 = wa_itab2-f2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;l_counter = l_counter + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;write: / wa_itab2-f2, l_counter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 06:16:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088446#M1181335</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-02T06:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088447#M1181336</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;You can use AT END OF that field name,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then put SELECT Count on that field name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mansi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 06:19:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088447#M1181336</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-02T06:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088448#M1181337</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;Have another table with the following structure:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data :begin of tab occurs 0,
  f1 type c,
  f2(10) type c
  count type i,
end of tab.

loop at first_internal table.
  tab-f1 = first_internal_table-f1.
  tab-f2 = first_internal_table-f2.
  count = 1.
  collect tab.
  clear: tab.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So TAB will have the count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;S. Chandramouli.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Chandramouli Subburathinam on Feb 2, 2009 11:57 AM&lt;/P&gt;&lt;P&gt;Hi Valter, I didnt notice your reply. Collect statement will surely work. But data type of F2 should be type N or type C, because if it is P or I Collect statement will sum field F2 also &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 06:23:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088448#M1181337</guid>
      <dc:creator>former_member784222</dc:creator>
      <dc:date>2009-02-02T06:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088449#M1181338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;please do tike this.............&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES : BEGIN OF t_tab ,&lt;/P&gt;&lt;P&gt;        f2 TYPE i,&lt;/P&gt;&lt;P&gt;        f1(1),&lt;/P&gt;&lt;P&gt;       END OF t_tab .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:i_tab TYPE STANDARD TABLE OF t_tab,&lt;/P&gt;&lt;P&gt;     wa_tab TYPE t_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_tab-f2 = '10'.  wa_tab-f1 = 'A'. APPEND wa_tab TO i_tab.&lt;/P&gt;&lt;P&gt;wa_tab-f2 = '10'.  wa_tab-f1 = 'A'. APPEND wa_tab TO i_tab.&lt;/P&gt;&lt;P&gt;wa_tab-f2 = '10'.  wa_tab-f1 = 'B'. APPEND wa_tab TO i_tab.&lt;/P&gt;&lt;P&gt;wa_tab-f2 = '15'.  wa_tab-f1 = 'C'. APPEND wa_tab TO i_tab.&lt;/P&gt;&lt;P&gt;wa_tab-f2 = '15'.  wa_tab-f1 = 'C'. APPEND wa_tab TO i_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT i_tab BY f2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: count TYPE i.&lt;/P&gt;&lt;P&gt;LOOP AT i_tab INTO wa_tab.&lt;/P&gt;&lt;P&gt;  AT NEW f2.&lt;/P&gt;&lt;P&gt;    count = 0.&lt;/P&gt;&lt;P&gt;  ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  count = count + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  AT END OF f2.&lt;/P&gt;&lt;P&gt;    WRITE:/ wa_tab-f2 , 'count', count.&lt;/P&gt;&lt;P&gt;  ENDAT.&lt;/P&gt;&lt;P&gt;  CLEAR wa_tab.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 06:49:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088449#M1181338</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-02T06:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088450#M1181339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Meenakshi,  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Try it this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Data:
  count type i value 1,
  w_f2  type i.

Data:
  Begin of wa,
    f1(10) type c,
    f2     type i,
  End of wa.

Data:
  itab like table of wa.

Clear wa.
wa-f1 = 'a'.
wa-f2 = 10.
Append wa to itab.

Clear wa.
wa-f1 = 'a'.
wa-f2 = 10.
Append wa to itab.

Clear wa.
wa-f1 = 'b'.
wa-f2 = 10.
Append wa to itab.

Clear wa.
wa-f1 = 'c'.
wa-f2 = 12.
Append wa to itab.

Clear wa.
wa-f1 = 'c'.
wa-f2 = 12.
Append wa to itab.

Clear wa.
wa-f1 = 'c'.
wa-f2 = 12.
Append wa to itab.

Clear wa.
wa-f1 = 'c'.
wa-f2 = 15.
Append wa to itab.

Clear wa.
wa-f1 = 'c'.
wa-f2 = 15.
Append wa to itab.

Sort itab by f2.

Loop at itab into wa.

  At First.
    Count = 0.
    w_f2  = 0.
  Endat.

  If w_f2 eq wa-f2.
    Count = count + 1.
    w_f2 = wa-f2.
  Elseif w_f2 ne wa-f2.
    Write:/ count, w_f2.
    w_f2 = wa-f2.
    count = 1.
  Endif.

  At last.
    Write:/ count, w_f2.
  Endat.

Endloop.&lt;/CODE&gt;&lt;/PRE&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;&lt;/P&gt;&lt;P&gt;With luck,&lt;/P&gt;&lt;P&gt;Pritam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2009 07:04:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088450#M1181339</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-02T07:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088451#M1181340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;useful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Feb 2010 13:52:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/5088451#M1181340</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-02T13:52:12Z</dc:date>
    </item>
  </channel>
</rss>

