‎2007 Jun 06 12:40 AM
HI all,
I need to know the no of records in a table in sap..
can anybody help on this how to get the count of the records.?
thanks in advance
kp
‎2007 Jun 06 3:52 AM
Hi KP,
You can code it this way
data var type i.
select count(*) from ztable into var.
write : var.Here
vargives you teh number of records.
The advantage of this is that you don't have to bring all the records into the application server, just to count the records. The n/w traffic is hence reduced.
Regards
Anil Madhavan
‎2007 Jun 06 12:46 AM
describe table int_table lines v_lines. " if it is internl table
table : goto se16 ->enter table -> enter->click on number of entries
‎2007 Jun 06 1:26 AM
I am writing a report. in that i need to get the no of records( count) as output.
that table i am using is database table. and i need to store that no of record value into a variable(count).
Pls provide me the query syntax
Thanks in advance
KP
‎2007 Jun 06 1:29 AM
use describe after select query .
data : v_lines type i.
describe table itab lines v_lines.
here itab is the internal table
‎2007 Jun 06 1:32 AM
Hi KP,
You can fetch the data of the database table into an internal table using SELECT statement and then find the no: of entries of the internal table using DESCRIBE statement.
select * from sflight into table itab.
describe table itab lines count.
Regards,
SP.
‎2007 Jun 06 3:52 AM
Hi KP,
You can code it this way
data var type i.
select count(*) from ztable into var.
write : var.Here
vargives you teh number of records.
The advantage of this is that you don't have to bring all the records into the application server, just to count the records. The n/w traffic is hence reduced.
Regards
Anil Madhavan
‎2007 Jun 06 4:42 AM
hi
sy-dbcnt contains the no. of database records fetched by a select
select * from dbtab into table itab where <cond>.
if sy-subrc eq 0.
write sy-dbcnt.
endif.
if helpful, reward
Sathish. R