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

Modify statement

Former Member
0 Likes
1,161

Hi Guru's,

Pleae can anybody expalins me what is the difference between sy-tabix and sy-index(Loop Index) ?

because in one case i am Modifyimg the internal table inside the do loop by giving sy-index ((Index of Internal Tables)(MODIFY scarr_tab INDEX sy-index FROM scarr_wa

TRANSPORTING currcode. ) in the syntax

and in other case inside loop statement i am modifyng same record by giving sy-tabix MODIFY scarr_tab INDEX sy-tabix FROM scarr_wa

TRANSPORTING currcode.) in the syntax.

in both case its working fine but i am not getting which one i have to use where to modify the internal table?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
950

Hi,

Sy-tabix maintain effected row in internal table.

sy-index maintain index of DO loop.

L.Velu

6 REPLIES 6
Read only

former_member404244
Active Contributor
0 Likes
950

Hi,

generaly in DO loops we use sy-index and when we LOOP the internal tables then we use sy-tabix..

check the below link also

Regards,

Nagaraj

Read only

0 Likes
950

Hi nagraj,

you want to say that in order to modify the internal table inside loop statement then i need to use sy-tabix and inorder to modify the internal table inside the do loop then i need to use sy-index.

is it ryt?

is it the same thing which you want to say?

Thanks & Regards,

Priyalatha

Read only

0 Likes
950

aye you got it! thats exactly what he wanted to tell yah

Read only

0 Likes
950

Thank u nagaraj

Read only

Former Member
0 Likes
951

Hi,

Sy-tabix maintain effected row in internal table.

sy-index maintain index of DO loop.

L.Velu

Read only

Former Member
0 Likes
950

Hi Priya,

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

Sy-index Contains the number of loop passes in DO and WHILE loops, including the current loop pass.

that is if 1 st time loop processing it is 1 if second time it is 2 etc...

Plz reward if help,

Mahi.