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: 

How to get count(*) in ABAP Query...

Former Member
0 Kudos

Hi All,

Can someone of you tell me, how to do the following in the ABAP Query. I want to get the count of records retreived during the query execution and display it in the output.

example::: Select count(*) from VBRK.

Thanks a lot.

Thanks!

Puneet.

3 REPLIES 3

Former Member
0 Kudos

From help doc:

Note

The SELECT COUNT( * ) FROM ... statement returns a result table containing a single line with the result 0 if there are no records in the database table that meet the selection criteria. In an exception to the above rule, SY-SUBRC is set to 4 in this case, and SY-DBCNT to zero.

You can just run SELECT COUNT (*) FROM TABLE

Number of rows is returned in SY-DBCNT

Edited by: Kevin Lin on Jul 2, 2008 10:55 PM

0 Kudos

Hi,

I want to do it in ABAP Query using the transaction SQ01 (query creation).

Thanks!

Puneet.

Former Member
0 Kudos

select * from ....into interner table , then you can use sy-dbcnt to get the count of the select result.