12-19-2006 7:12 PM
12-19-2006 7:16 PM
sy-tabix inside loop-endloop, and sy-index inside do-enddo.
Regards.
12-19-2006 7:20 PM
Hi,
SY-TABIX means 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 means the number of Iterations for a loop. bascially DO - ENDO .
SY-INDEX is not equal to SY-TABIX.
Check the belwo program
report tabix_index.
DO 100 times.
wa_tab-index = sy-index.
append wa_tab to itab.
clear wa_tab.
enddo.
loop at itab into wa_tab.
write:/1 sy-tabix.
endloop.
I hope this answers your question.
Regards,
Vara
12-19-2006 7:21 PM
Hi,
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.
Regards,
Ferry Lianto
12-19-2006 8:42 PM
Sy-tabix is related to internal table which provides index number of current line in loop enloop.
Sy-index is related to loops (while/endwhile, do/enddo). It provides number of current pass.
Thanks,
Santosh
10-23-2009 3:30 AM
What about this situation?
The LOOP statement with a WHERE condition?
Is the sy-tabix assigned the current line that match the where condition or it is only added 1 by each line which meet the condition?
10-23-2009 6:08 AM
In case of loop at with where condition sy-tabix willl return the matching record row number in the internal table. and will not increase by 1. It will always give the matching row number of internal table.
10-23-2009 6:12 AM
Hi,
It is not added by 1 which meet the condition.
The sy-tabix will be always be assigned with the index of the table row.