2007 May 30 6:14 AM
Dear friends,
Please tell me the difference between sy-index & sy-tabix
Actually my problem is i don't know how to compare for example between first record'field n and second record'field n when u r in loop so i can take particular action based on result
on current recor
if possible send me sample code.
Regards;
Parag Gavkar.
2007 May 30 6:16 AM
Hi,
sy-index will give u the number of iteration in the loop.
sy-tabix will give u the number rows filled in an internal table at the moment.
rgds,
bharat.
2007 May 30 6:16 AM
Hi,
sy-index will give u the number of iteration in the loop.
sy-tabix will give u the number rows filled in an internal table at the moment.
rgds,
bharat.
2007 May 30 6:17 AM
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 - ENDDO .
SY-INDEX is not equal to SY-TABIX.
sy-tabix inside loop-endloop, and sy-index inside do-enddo.
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.
~~Guduri
2007 May 30 6:17 AM
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.
****DO REWARDS IF USEFULL
REGARDS,
VIJAY
2007 May 30 6:17 AM
Hi,
SY-INDEX will work for DO..ENDDO..It holds the current row number within the loop..
DO 10 TIMES.
WRITE: / SY-INDEX.
ENDDO.
SY-TABIX will work for LOOP..ENDLOOP...It holds the current row within the loop..
Thanks,
Naren
2007 May 30 6:17 AM
Hi
sy-index = gives the number of iterations in the loop.
sy-tabix = will give the Table Index of an internal table at that moment.
Reward points if useful
Regards
Anji
2007 May 30 6:18 AM
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,
Santosh
2007 May 30 6:18 AM
Hi,
Sy-index - > give the index of the record in the loop.,
sy-tabix - > give the number of iterations in a loop.
Reward points if it is helpful.
Regards,
Sangeetha.a
2007 May 30 6:18 AM
Hi Parag,
Check this Link,
https://forums.sdn.sap.com/click.jspa?searchID=2863826&messageID=2868547
Thanks,
Reward If Helpful.
2007 May 30 6:18 AM
sy-index is used in do..enddo , and other loops
sy-tabix is used when looping at internal tables
loop at itab.
v_tabix = sy-tabix.
v_tabix = v_tabix + 1.
read table itab index v_tabix. " to read the next record
*do the calculations herw
endloop.
2007 May 30 6:21 AM
Hi,
Sy-index is related to the loop,It's represents the Current loop pass.(Do ,While)
Sy-tabix is related to the internal table.it represents current line index.(Looping thru itab affects sy-tabix)
2007 May 30 6:21 AM
Hi Parag
SY-INDEX will work for DO..ENDDO..It holds the current row number within the loop..
DO 10 TIMES.
WRITE: / SY-INDEX.
ENDDO.
SY-TABIX will work for LOOP..ENDLOOP...It holds the current row within the loop
Regards,
Sree
2007 May 30 6:21 AM
hi,
sy-index is used in do..enddo , and other loops and also used as current index of the list.
sy-tabix is used when looping at internal tables for getting index of the internal table.
if helpfulreward some points.
with regards,
suresh babu aluri.
2007 May 30 6:21 AM
hi parag,
if it's sy-index that we can use in read statement,
or if it's sy-tabix that we can use in loop statement, this can help u to know which record(no) is processing in the loop.
regards,
seshu.
2007 May 30 6:27 AM
Hi
SY-INDEX - > It is ABAP System field, Initial value will be zero, but when u place in do loop and while loop it is incremented by 1.
example
do 5 times.
write : sy-index.
enddo.
o/p will be 1 2 3 4 5
SY-TABIX - > Current Line of Internal Table
Regards
Vijaya