‎2007 Jul 03 5:12 AM
pls give the result...
I created a internal table .. as t1 in that i appended a,b,c,d
loop at t1.
write sy-index.
write sy-tabix.
endloop.
‎2007 Jul 03 5:16 AM
HI,
sy-tabix will give u the table index.so in ur case it is 1,2,3,4
sy-index will give u the current loop index(do,while,...).
so it will give u 0 for each time.
so ur output is:01020304
rgds,
bharat.
‎2007 Jul 03 5:16 AM
HI,
sy-tabix will give u the table index.so in ur case it is 1,2,3,4
sy-index will give u the current loop index(do,while,...).
so it will give u 0 for each time.
so ur output is:01020304
rgds,
bharat.
‎2007 Jul 03 5:20 AM
sy-index
1
2
3
4
sy-tabix
4
4
4
4
reward points if it is usefull....
Girish
‎2007 Jul 03 5:23 AM
sy-tabix is 0
sy-index is no of records in the internal table (suppose if u have 5 records in the internal table then the sy-index is 5 (1 2 3 4 5)).
REMINDER: If you posted the question, please reward points for good answers*. Thanks.
‎2007 Jul 03 5:23 AM
in loop at itab only sy-tabix getting incremented but in other loop like do enddo or while loop sy-index is getting incremented.
since you are using loop at itab.. so sy-tabix will get incremented from 1 to 4 because you have only 4 rows.... and sy-index is initial.
so output 01020304.
regards
shiba dutta
‎2007 Jul 03 5:26 AM
HI,
Here there is differnece between sy-tabix and sy-index.
sy-tabix and sy-index will give the current loop pass value in the loop.
But here the differnece is sy-tabix must be used in the loop at - endloop only.
Sy-index must be used in the other loop like Do-Enddo.
So in your scenario you have used both sy-tabix and sy-index in loop at -endloop.
Here sy-tabix will give the current loop pass value i.e. during first loop pass it gives sy-tabix as 1 and during second loop pass it gives as 2 so on.
But here sy-index value does not change i.e.whatever the sy-index value before the loop at that will mainitan.Here let assume before loop at sy-index is 0 then after every loop pass also sy-index is 0.
So simply in your logic sy-tabix will give current loop pass value but sy-index has no effect and it does not change.
Thanks and regards,
shyla
‎2007 Jul 03 5:36 AM
Hi,
output will be 0 1 0 2 0 3 0 4
bcoz sy-index is 0 and sy-tabix will change from 1-4.
also, this is my codes where i hv tried.
DATA: BEGIN OF itab occurs 0,
index type int4,
END OF itab,
wa like line of itab.
do 4 times.
wa-index = sy-index.
append wa to itab.
enddo.
loop at itab.
write: sy-index.
write: sy-tabix.
endloop.Jogdand M B
‎2007 Jul 03 5:40 AM
Hi,
loop at t1.
write sy-index.
write sy-tabix.
endloop.
Output for your program is:4, because you didn't use '/' in each write statement, so you change your program by given below
loop at t1.
write / 'index:',sy-index.
write / 'tabix:',sy-tabix.
endloop.
OUTPUT:
***********
index:0
tabix:1
index:1
tabix:2
index:2
tabix:3
index:3
tabix:4
index will start from 0 and tabix will start from 1.
IF USEFULL REWARD