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: 

Wrong Number of Records using (sy-dbcnt)

Former Member
0 Kudos

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..

9 REPLIES 9

jayanthi_jayaraman
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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,

Former Member
0 Kudos

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.

0 Kudos

Thanx Jayathi,Jagathguru,Sailatha..

I am actually calling a function module in my report and the Export table is assigned to the Internal table in my report and the output list should read the records.. Now after when I do

CALL FUNCTION 'Z_MEMBER_READ'

EXPORTING

iv_market = p_market

  • IV_STATUS =

  • IV_ADM_TYPE =

  • IV_MEMBER_ID =

iv_date_effective = p_date

  • IV_DATE_FROM =

  • IV_DATE_TO =

  • IV_COUNTRY =

  • IMPORTING

  • EV_ERROR =

  • EV_ADDRNUMBER =

tables

et_member_data = lt_member

it_beg_dat = so_bdat

it_country = so_cty

it_member = so_membr

it_admission = so_admty

it_status = so_stat

.

data ln type n.

describe table lt_member lines ln.

TOP-OF-PAGE.

FORMAT COLOR COL_HEADING INTENSIFIED ON.

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

106 'Records',ln,

130 'page',syst-pagno,

275 ''.

next to RECORDS i see 0.

PREETHAM

0 Kudos

Hi,

I think the Top-of-page is executed before calling the function module.

So I think it is not possible to get the no. of records in the top-of-page itself.

0 Kudos

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

former_member182670
Contributor
0 Kudos

You should also change yuor declaration to:

data ln type i.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.