Skip to Content
author's profile photo Former Member
Former Member

Wrong Number of Records using (sy-dbcnt)

I use the following code in my report..

top-of-page.

format color col_heading intensified on.

write: /50 'Report for Markets & Member',p_market,

106 'Records',<b>syst-dbcnt</b>,

130 'page',syst-pagno,

275 ''.

In my output list I have records more than 700 and it shows me Records 4 ....

any suggessions ?

Thanx in ADVANCE..

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 09, 2005 at 09:57 AM

    hi,

    Sy-dbcnt will give the no. of records fetched, updated or inserted in the database. in your case if you have fetched or updated or inserted records in the database before your write statement then it will display those no. of entries as output instead of your output list.

    if you are not maintaining any internal table then use a counter to count the no. of records while writing the list and later you can check the no. fo records using that variable.

    if you use a internal table then the method given by jayanthi can be followed.

    Regards,

    Jagath.

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi,

      It's possible as Jagath told.

      Declare ln before accessing the top-of-page.

      Here is the sample which I checked.

      Instead of select statement I assume you are having your function module.

      data : ln type i,

      itab type standard table of mara.

      start-of-selection.

      select * from mara into table itab.

      write 'hello'.

      end-of-selection.

      top-of-page.

      describe table itab lines ln.

      write ln.

      Hope this helps.

      If your problem is solved,kindly close the thread.

      Message was edited by: Jayanthi Jayaraman

  • Posted on Jun 09, 2005 at 09:40 AM

    Hi,

    If you are storing your data in internal table(say itab),then you can achieve the number of records using <b>DESCRIBE</b>.

    data ln type i.

    describe table itab lines ln.

    write : 'Records', ln.

    FYI,

    syst-dbcnt will show number of table lines processed

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 09, 2005 at 09:53 AM

    Hi,

    Sy-dbcnt gives the number of records fetched from the database table, check whether your internal table has records from more than 1 table, in that case try displaying the number of records using 'Describe table <Internal table> lines <Lines> .

    Hope this helps.

    Regards,

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 09, 2005 at 11:18 AM

    You should also change yuor declaration to:

    data ln type i.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 09, 2005 at 11:19 AM

    Hi,

    Declare your count variable 'ln' at the start of the program or globally in some top include so that the variable can be accessed in your top-of-page.

    Regards,

    Jagath.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 10, 2005 at 06:47 AM

    Hi Preetham,

    The system variable dbcnt gives the no of records fetched from the database table., if you want to display the no of records displayed on the output, you can get the total no of lines using 'Describe' statement with internal table name.

    Regards,

    Padma.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.