Skip to Content
avatar image
Former Member

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

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Jul 02, 2008 at 08:53 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 03, 2008 at 01:39 AM

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

    Add comment
    10|10000 characters needed characters exceeded