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

DIFFERENCE

Former Member
0 Likes
1,277

What is the difference between SY-TABIX and SY-INDex.please explain in brief?

regards

Richa

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,244

Hi

Sy-tabix: NO of record in the internal table

Sy-index: index number of record which is currently executed.

eg: itab contains values 1 to 10.

loop at itab into wa_itab.

write: wa_itab-field1.

endloop.

suppose if the loop is getting executed for the 3rd time, then the sy-index will store the value as 3.

read table itab into wa_itab where field1 = 3.

after execution of this statement, the value of sy-index will be 3.

Regards

- Rishika Bawa

9 REPLIES 9
Read only

Former Member
0 Likes
1,244

Hi,

Sy-tabix is used to find the current line in the internal table; itu2019s a current line index.

Whereas

Sy-index in used to find the number of current pass in the loop statement.

<removed_by_moderator>

preet

Edited by: Julius Bussche on Aug 26, 2008 12:17 PM

Read only

Former Member
0 Likes
1,244

hi ,

sy-tabix = it gives index of internal tables.

sy-index = index in loop and endloop.

Rgds.,

subash

Read only

Former Member
0 Likes
1,244

Hi,

SY-TABIX is used as the index of an internal table, which means that each time thru the LOOP it is incremented by 1. Simularly.

sy-tabix - counter for LOOP-ENDLOOP, READ TABLE

SY-INDEX is incremented each time thru the loop of a DO loop. If you want to count the number of internal table records, you can use the DESCRIBE TABLE statement

sy-index - counter for DO-ENDO, WHILE-ENDWHILE

Regards .

Naresh,

Read only

Former Member
0 Likes
1,245

Hi

Sy-tabix: NO of record in the internal table

Sy-index: index number of record which is currently executed.

eg: itab contains values 1 to 10.

loop at itab into wa_itab.

write: wa_itab-field1.

endloop.

suppose if the loop is getting executed for the 3rd time, then the sy-index will store the value as 3.

read table itab into wa_itab where field1 = 3.

after execution of this statement, the value of sy-index will be 3.

Regards

- Rishika Bawa

Read only

Former Member
0 Likes
1,244

Hi,

Please search in SDN there are many threads related to same.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
1,244

Dear friend,

sy-tabix: is for how many line rows is fatched from data base.

wht ever the succecfull rows retrived is the value of sy-tabix.

sy-index: is for the total no of records in a perticular table.

it is like srno.

basically the last row no is the value of sy-index.

i hope your problem.

is now solve.

<removed_by_moderator>

vivek

Edited by: Julius Bussche on Aug 26, 2008 12:17 PM

Read only

Former Member
0 Likes
1,244

not answered yet

Read only

Former Member
0 Likes
1,244

Hi,

SY-TABIX is used as the index of an internal table, which means that each time thru the LOOP it is incremented by 1. Simularly.

sy-tabix - counter for LOOP-ENDLOOP, READ TABLE

SY-INDEX is incremented each time thru the loop of a DO loop. If you want to count the number of internal table records, you can use the DESCRIBE TABLE statement

sy-index - counter for DO-ENDO, WHILE-ENDWHILE

Regards .

Naresh,

Read only

Former Member
0 Likes
1,244

Hi,

*SY-INDEX : *

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

*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.

Hope this will give u a clear idea.

<removed_by_moderator>

Thanks,

Dhanashri.

Edited by: Julius Bussche on Aug 26, 2008 12:17 PM