‎2007 May 25 12:10 PM
hi
i want to count the no of rows in a specified table.
but i know to count the number of rows in a mara,lfa1 etc.,
i want the number of rows in a table in which a table is specified at runtime.i.e)in parameters wat table is to be specified that table fields is to be count.
‎2007 May 25 12:14 PM
REPORT ABC MESSAGE-ID ZZ.
parameters : P_TAB LIKE DD02L-TABNAME.
DATA : V_CNT TYPE I.
SELECT COUNT(*) FROM (P_TAB) INTO V_CNT.
WRITE : V_CNT.
‎2007 May 25 12:14 PM
Try this code...
PARAMETERS: tname TYPE dd02l-tabname.
DATA: count TYPE i.
START-OF-SELECTION.
SELECT COUNT( * ) INTO count FROM (tname).
WRITE:/ 'No of records in table ', tname,' is ', count.Hope this helps
Regards,
Dushyant Shetty
‎2007 May 25 12:14 PM
REPORT ABC MESSAGE-ID ZZ.
parameters : P_TAB LIKE DD02L-TABNAME.
DATA : V_CNT TYPE I.
SELECT COUNT(*) FROM (P_TAB) INTO V_CNT.
WRITE : V_CNT.
‎2007 May 25 12:18 PM
Hi
Try this:
PARAMETER P_TABLE(30).
DATA: COUNT TYPE I.
SELECT COUNT( * )
INTO COUNT
FROM (P_TABLE).
WRITE COUNT.Max
‎2007 May 25 12:18 PM
hi,
data v_lines type i,
describe table <itab> lines v_lines.
v_lines contains the number of records.
rewards if useful;
regards,
nazeer
‎2007 May 25 12:19 PM
Hi Manjula,
Try using this:
1. For an internal table.
Data: v_count TYPE i.
DESCRIBE TABLE i_itab LINES v_count.
Now v_count contains the number of rows in the table i_itab.
2. For a database table.
After u write a select on a database table. Check the value of sy-dbcnt. This contains the number of records fetched from the select query.
Regards,
Pradeep Chintala.
‎2007 May 25 12:20 PM
‎2007 May 25 12:35 PM
Hi Manjula,
here a short example:
tables: marc.
FIELD-SYMBOLS: <FS>.
data: begin of itab occurs 0.
include structure marc.
data: end of itab.
*
data: column like sy-index.
data: row like sy-tabix.
*
DO 1000 TIMES.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE Itab TO <FS>.
IF SY-SUBRC <> 0. EXIT. ENDIF.
column = column + 1.
ENDDO.
write: / column.
*
select * from marc into table itab up to 100 rows.
describe table itab lines row.
write: / row.
*
select count( * ) from marc.
write: / sy-dbcnt.
hope it helps.
Regards, Dieter