<?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: count lines in table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-lines-in-table/m-p/2445127#M547595</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can get the number of lines in a table using the DESCRIBE statement.&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE itab [KIND knd] [LINES lin] [OCCURS n]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;This statement determines some properties of the internal table itab and assigns them to the specified variables. The various additions enable you to determine the table type, the number of currently filled rows and the initial memory requirement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition, the system fields sy-tfill and sy-tleng are filled with the current number of table rows and the length of a table row in bytes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also loop at the internal table where data = key.Then keep an count and increase it everytime.&lt;/P&gt;&lt;P&gt;loop at itab where data = key.&lt;/P&gt;&lt;P&gt;cnt = cnt + 1.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;This will serve your purpose I suppose.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it will be useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sandeep.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Jun 2007 13:14:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-20T13:14:04Z</dc:date>
    <item>
      <title>count lines in table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-lines-in-table/m-p/2445123#M547591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hallow&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have internal table and i wont to count lines with key&lt;/P&gt;&lt;P&gt;example&lt;/P&gt;&lt;P&gt;data&lt;/P&gt;&lt;P&gt;001&lt;/P&gt;&lt;P&gt;001&lt;/P&gt;&lt;P&gt;002&lt;/P&gt;&lt;P&gt;003&lt;/P&gt;&lt;P&gt;001&lt;/P&gt;&lt;P&gt;i wont in some fiels to now how much number of 001 i have here 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 13:05:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-lines-in-table/m-p/2445123#M547591</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-20T13:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: count lines in table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-lines-in-table/m-p/2445124#M547592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;syntax:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE itab2 LINES  n.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will get teh number of lines in variable n.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to know the number of keys proceed this way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Get all the keys to a itab1.&lt;/P&gt;&lt;P&gt;2. GEt all the data to itab2&lt;/P&gt;&lt;P&gt;3. Loop at itab1.&lt;/P&gt;&lt;P&gt;    loop at itab2 where key = itab1-key.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     count the number of times the key ocuurs and store *      to a variable or do a write&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;   endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 13:09:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-lines-in-table/m-p/2445124#M547592</guid>
      <dc:creator>former_member150733</dc:creator>
      <dc:date>2007-06-20T13:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: count lines in table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-lines-in-table/m-p/2445125#M547593</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;&lt;/P&gt;&lt;P&gt;data: value type i.&lt;/P&gt;&lt;P&gt;loop at itab where itab-fld = '001'.&lt;/P&gt;&lt;P&gt;    value = value + 1.&lt;/P&gt;&lt;P&gt;    write:/10 value.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and if u want to count no. of lines ina internal table then use describe command as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex: describe lines value.&lt;/P&gt;&lt;P&gt;   write:/10 value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if useful reward some points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with regards,&lt;/P&gt;&lt;P&gt;suresh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 13:09:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-lines-in-table/m-p/2445125#M547593</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-20T13:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: count lines in table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-lines-in-table/m-p/2445126#M547594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data: lv_count typei.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab into wa.&lt;/P&gt;&lt;P&gt;if itab-some_field = 'value'.&lt;/P&gt;&lt;P&gt;lv_count = lv_count + 1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write lv_count&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 13:09:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-lines-in-table/m-p/2445126#M547594</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-20T13:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: count lines in table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-lines-in-table/m-p/2445127#M547595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can get the number of lines in a table using the DESCRIBE statement.&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE itab [KIND knd] [LINES lin] [OCCURS n]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;This statement determines some properties of the internal table itab and assigns them to the specified variables. The various additions enable you to determine the table type, the number of currently filled rows and the initial memory requirement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition, the system fields sy-tfill and sy-tleng are filled with the current number of table rows and the length of a table row in bytes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also loop at the internal table where data = key.Then keep an count and increase it everytime.&lt;/P&gt;&lt;P&gt;loop at itab where data = key.&lt;/P&gt;&lt;P&gt;cnt = cnt + 1.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;This will serve your purpose I suppose.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it will be useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sandeep.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 13:14:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-lines-in-table/m-p/2445127#M547595</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-20T13:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: count lines in table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/count-lines-in-table/m-p/2445128#M547596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shnya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first sort the internal table based on the field that u want to have count...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example: lets suppose that the field name itself is data and the internal table name is l_itab and it has the values that u have given in your post...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort l_itab by data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at l_itab into wa_itab.&lt;/P&gt;&lt;P&gt;  lv_counter = lv_counter + 1.&lt;/P&gt;&lt;P&gt;  at end of data.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Each time it triggers, lv_counter will be having the *   value for a particular value in data field.. for the *   first time it will be having counter for 001, second *   time 002 and so on...&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  write code according to your requirement.. and then *   clear lv_counter...   &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  endat.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps u...&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;Phani.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 13:14:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/count-lines-in-table/m-p/2445128#M547596</guid>
      <dc:creator>PS_1978</dc:creator>
      <dc:date>2007-06-20T13:14:45Z</dc:date>
    </item>
  </channel>
</rss>

