Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

system variables`

Former Member
0 Likes
3,732

what does the variables sy-tabix,sy-index exactly mean

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,358

HI,

FOR sets SY-TABIX to the index of the table row, in which the search string was found.

Simply,

SY-TABIX-Current index of table

SY-INDEX-Current index of loop.

Regards,

Padmam.

8 REPLIES 8
Read only

Former Member
0 Likes
2,359

HI,

FOR sets SY-TABIX to the index of the table row, in which the search string was found.

Simply,

SY-TABIX-Current index of table

SY-INDEX-Current index of loop.

Regards,

Padmam.

Read only

Former Member
0 Likes
2,358

hi,

check this

grtz,

Koen

sorry double post

Message was edited by:

Koen Labie

Read only

Former Member
0 Likes
2,358

Hi,

SY-INDEX - Number of loop passes

SY-TABIX - Runtime: Current line of an internal table. table index

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.

Regards,

Priyanka.

Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
2,358

Hi,

sy-index --- It gives the iteration number..In which loop you are there.

sy-tabix --- Gives the row no of the table , which data record is gettiong read from the internal table.

Cheers,

Simha.

Read only

Former Member
0 Likes
2,358

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.

reward if it helps..

Regards,

Omkar.

Read only

Former Member
0 Likes
2,358

hi,

sy-tabix contains the current index number of internal table

sy-index contains the loop index no when we use any loops or index of database table also.

if helpful reward some points.

with regards,

Suresh Aluri.

Read only

Former Member
0 Likes
2,358

Hi,

Sy-tabix is used to find the current line in the internal table; it’s a current line index. Whereas sy-index in used to find the number of current pass in the loop statement.

Could you please close the threads which you got the answers

Regards

Sudheer

Read only

Former Member
0 Likes
2,358

Hi,

The following helps you.

Loops

SY-INDEX

In a DO or WHILE loop, SY-INDEX contains the number of loop passes including the current pass.

Internal Tables

SY-TABIX

Current line of an internal table. SY-TABIX is set by the statements below, but only for index tables. The field is either not set or is set to 0 for hashed tables.

APPEND sets SY-TABIX to the index of the last line of the table, that is, it contains the overall number of entries in the table.

COLLECT sets SY-TABIX to the index of the existing or inserted line in the table. If the table has the type HASHED TABLE, SY-TABIX is set to 0.

LOOP AT sets SY-TABIX to the index of the current line at the beginning of each loop lass. At the end of the loop, SY-TABIX is reset to the value that it had before entering the loop. It is set to 0 if the table has the type HASHED TABLE.

READ TABLE sets SY-TABIX to the index of the table line read. If you use a binary search, and the system does not find a line, SY-TABIX contains the total number of lines, or one more than the total number of lines. SY-INDEX is undefined if a linear search fails to return an entry.

SEARCH <itab> FOR sets SY-TABIX to the index of the table line in which the search string is found.

reward if helpful.

Regards,

Karthick.