09-01-2006 8:40 AM
Hi!
1. How can you through ABAP and select statements count the number of rows in one table?
2. I want to read all rows from one table to an internal table. Can this be done dynamically or do I first have to count the number of rows in the table and then declare an internal table with the number of rows counted.
regards
Baran
09-01-2006 8:45 AM
HI,
No you don't have to count number of rows first, Internal table size will increase dynamically. you have to declare this with initial size like this.
<b>data: itab type standard table of bkpf initial size 0.
SELECT * FROM bkpf into table itab.</b>
All values from bkpf will be inserted into table internal table itab.
Regards,
09-01-2006 8:41 AM
09-01-2006 8:42 AM
Hi !
To count the number of lines of a database table
you could use the select count ... statement.
See online-help for that...
Regards
Rainer
Some points would be nice if that helped a bit.
09-01-2006 8:44 AM
Hi,
1. Select count(*)... is used to get count from table.
2. Select <field list> from <table> into table <internal table> is used to get full data of table into internal table.
3. describe table <internal table> lines <var> used to count the no. of lines in internal table.
Regards,
Prasanth
09-01-2006 8:45 AM
HI,
No you don't have to count number of rows first, Internal table size will increase dynamically. you have to declare this with initial size like this.
<b>data: itab type standard table of bkpf initial size 0.
SELECT * FROM bkpf into table itab.</b>
All values from bkpf will be inserted into table internal table itab.
Regards,
09-01-2006 8:48 AM
1.
select COUNT(*) from table.
then SY-DBCNT field will contain no of records
2.
no need, if you mention INTO TABLE all data to be populated to your internal table. no need to findout no of records.
Regards
srikanth