โ2007 Dec 18 9:20 AM
hi
i want the difference between sy-index and sy-tabix
pls tell and solve my prob as early as possible
i will give the points if ans is satisfied
bye
bujji
โ2007 Dec 18 9:21 AM
Hi ammu,
SY-INDEX
SY-INDEX contains the number of loop passes in DO and WHILE loops, including the current loop pass.
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 FOR sets SY-TABIX to the index of the table row, in which the search string was found.
Plz Reward if useful,
Mahi.
โ2007 Dec 18 9:21 AM
Hi ammu,
SY-INDEX
SY-INDEX contains the number of loop passes in DO and WHILE loops, including the current loop pass.
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 FOR sets SY-TABIX to the index of the table row, in which the search string was found.
Plz Reward if useful,
Mahi.
โ2007 Dec 18 1:15 PM
Hi,
SY-INDEX.
Sy-index tell you the in which iteration you are ( I mean in number)
It will work for DO... ENDDO, WHILE... END WHILE,, LOOP ...ENDLOOP.
suppose. when you write the code as below.
Do 5 times.
.......
Enddo.
When Do loop is executed first time the sy-index value becomes 1. and for second time sy-index value becomes 2 so ..on
Initial value for sy-index is 0.
Same applies for While... Endwhile, Loop ....Endloop.
SY-TABIX.
Sy-tabix: will tell you the number of recors currently processing in the loop.
Suppose : when you write the code as below.
*lets suppose that itab has 10 records.
Loop at Itab into wa_tab.
.........
..........
endloop.
when loop executes first time SY-TABIX will have 1 for second time 2 so.....on.
But it does not contain the number of iteration Instaed it will contain the number of record currently processing in the loop.
If you conditions in the loop statement then it not necessary that loop executes for each and every record.
Loop may execute for 5 th record or 10 th record based on condition (Lets suppose).
Here loop executes two times only but SY_TABIX will contains the values 5 and 10 in the respective iterations and SY-INDEX will contain 1 and 2 .
Initial value for SY-TABIX is 1.
Reward if useful.
Thanks,
Nageswar.
โ2007 Dec 18 9:29 AM
SY-INDEX -
It always gives the Current Loop pass Position.
SY-TABIX -
It gives the Current Row Position in the Internal Table
Reward Points if useful.