Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

is there a way to count no of records in a table?

Former Member
0 Kudos
366

Hi All,

We are developing a portal and for one usecase i am using RFC_READ_TABLE for retreiving data from tables, but as each table has different number of records..it would be easier if there is way to give me the COUNT of records in each table.. is there a standard rfc for this purpose? or DI I NEED TO do some changes (CUSTOM WRAPPER)to RFC_READ_TABLE.

the purpose is it will help in PAGING, if i know how many records are there it will be helpful.

thanks in advance

1 ACCEPTED SOLUTION

Former Member
0 Kudos
157

Hi

Try to use Describe table tablename lines l_lines u get the number of lines..

regards,

chaithanya K

5 REPLIES 5

Former Member
0 Kudos
158

Hi

Try to use Describe table tablename lines l_lines u get the number of lines..

regards,

chaithanya K

0 Kudos
157

can u eloborate pls. i am not an Abaper so please bear with me, ideally i am looking for either a FM or an RFC. else if i need to make any changes to any existing FM/RFC please let me know which one and what changes are to be made.

thanks again.

0 Kudos
157

Hi Hruser...

In the RFC or FM if you have the data in the internal tables

suppose take RFC_READ_TABLE will have the following internal tables it_tab1, it_tab2, it_tab3.

if this internal tables have 10, 20, 30 records.

then u can write the Describe statement

describe table it_tab1 lines l_lines. " the value of l_lines = 10.

Hope you understood,.

Thanks

chaithanya K

0 Kudos
157

I dunno how far its useful, but with this way you can get the count with out retrieving data into internal table..

>DATA: l_count TYPE i.

>SELECT COUNT(*) AS l_count

> INTO l_count

> FROM mara.

>WRITE l_count.

award points if helpful.

Former Member
0 Kudos
157

You can use the Function Module DB6_DIAG_COUNT_TABLE_ENTRIES .

Be aware that DB6_DIAG_COUNT_TABLE_ENTRIES counts the entries in all clients, i.e. it is not a client dependent count. It is a count at the physical data level, and does not take into consideration any client fields.

So you might find it weird in DEV Environment where you will have multiple clients.

But you shud be OK in QAS and PRODUCTION.

Hope this helps.

Vinodh Balakrishnan