‎2008 Jan 06 5:56 PM
What is SY-TABIX AND SY-INDEX.
LOOP AT ITABLE1.
WRITE : / ITABLE1-MATNR,SY-INDEX,SY-TABIX.
ENDLOOP.
The above codes displays 0 in sy-index place and 1,2,3...last record number in sy-tabix place
How to find out total number of records in a database?
Thanks in advance
‎2008 Jan 06 6:05 PM
hi,
Sy-tabix is used to find the current line in the internal table; its a current line index, Table Index. This signifies the number of table index. Each row of a table has certain index or counter. The value of sy-tabix for the last entry would be equivalent to number of table entries.
SY-INDEX is the number of Iterations for a loop. bascially DO - ENDO .
SY-INDEX is not equal to SY-TABIX.
some more info.............
SY-TABIX:
Current line in an internal table. With the following statements SY-TABIX is set for index tables. With hashed tables, SY-TABIX is not filled or it is set to 0.
APPEND sets SY-TABIX to the index of the last table row, that is the total number of entries in the target table.
COLLECT sets SY-TABIX to the index of the existing or appended table row. With hashed tables, SY-TABIX is set to 0.
LOOP AT sets SY-TABIX to the index of the current table row at the beginning of every loop pass. After leaving a loop, SY-TABIX is set to the value it had before entering the loop. With hashed tables, SY-TABIX is set to 0.
READ TABLE sets SY-TABIX to the index of the table row read. If no row is found with binary search while reading, SY-TABIX contains the index of the next-highest row or the total number of rows +1. If no row is found with linear search while reading, SY-TABIX is undefined.
SEARCH itab FOR sets SY-TABIX to the index of the table row, in which the search string was found.
SY-INDEX:
SY-INDEX contains the number of loop passes in DO and WHILE loops, including the current loop pass.
SY-DBCNT gives the Nunber of records in database table.
‎2008 Jan 06 6:05 PM
hi,
Sy-tabix is used to find the current line in the internal table; its a current line index, Table Index. This signifies the number of table index. Each row of a table has certain index or counter. The value of sy-tabix for the last entry would be equivalent to number of table entries.
SY-INDEX is the number of Iterations for a loop. bascially DO - ENDO .
SY-INDEX is not equal to SY-TABIX.
some more info.............
SY-TABIX:
Current line in an internal table. With the following statements SY-TABIX is set for index tables. With hashed tables, SY-TABIX is not filled or it is set to 0.
APPEND sets SY-TABIX to the index of the last table row, that is the total number of entries in the target table.
COLLECT sets SY-TABIX to the index of the existing or appended table row. With hashed tables, SY-TABIX is set to 0.
LOOP AT sets SY-TABIX to the index of the current table row at the beginning of every loop pass. After leaving a loop, SY-TABIX is set to the value it had before entering the loop. With hashed tables, SY-TABIX is set to 0.
READ TABLE sets SY-TABIX to the index of the table row read. If no row is found with binary search while reading, SY-TABIX contains the index of the next-highest row or the total number of rows +1. If no row is found with linear search while reading, SY-TABIX is undefined.
SEARCH itab FOR sets SY-TABIX to the index of the table row, in which the search string was found.
SY-INDEX:
SY-INDEX contains the number of loop passes in DO and WHILE loops, including the current loop pass.
SY-DBCNT gives the Nunber of records in database table.
‎2008 Jan 06 6:19 PM
‎2008 Jan 06 6:28 PM
Gopi,
SY-DBCNT gives the number of records in database table
After an open SQL statement, the system field sy-dbcnt contains the number of database lines processed.
Sample code.........
REPORT ychatest.
DATA : v_matnr LIKE mara-matnr.
SELECT matnr FROM mara INTO v_matnr UP TO 1 ROWS.
ENDSELECT.
WRITE : sy-dbcnt.
you can use it after select statement........................
if u r talking about the counting of number of records in the internal table then you have to use the describe statement to get the count.