‎2007 Aug 28 4:21 AM
‎2007 Aug 28 4:31 AM
Hi Swathi..
incase of DO loop or WHILE loop. the loop counter is stored in SY-INDEX.
incase of internal table Loop. EndLoop the counter is stored in SY-TABIX.
<b>REWARD IF HELPFUL</b>
‎2007 Aug 28 4:26 AM
‎2007 Aug 28 4:28 AM
Hi,
In LOOP AT IT_TABLE into wa_table, loop counter store in SY-TABIX.
But in Do n Times loop, it strore in SY-INDEX.
Regards,
‎2007 Aug 28 4:31 AM
Hi Swathi..
incase of DO loop or WHILE loop. the loop counter is stored in SY-INDEX.
incase of internal table Loop. EndLoop the counter is stored in SY-TABIX.
<b>REWARD IF HELPFUL</b>
‎2015 Nov 06 9:26 AM
This is not working if there is a condition in your loop!
SY-TABIX is the index of the internal table
So it will show you in which line you are but this is definietly not a counter.
In this case you will have to create a counter manually.
Regards,
‎2007 Aug 28 4:46 AM
Hi Swathi,
The system structure have two variables sy-tabix and sy-index.
The variable sy-tabix, for the internal tables operations. This variable holds the number of the record currently being read in an internal table loop.
When a loop statement is executed, the system assigns value 1 for the first iteration and increases it for each new record. If we use any READ statement inside the LOOP, then the successfull READ operation changes the value of sy-tabix to the position of the required record in the read table..
The variable sy-index is used for the iterative operations.
This variable holds the current iteration number in a WHILE or DO loop.
Thanks and Best Regards,
Vikas Bittera.
***Points for usefull answers ***
‎2024 Oct 31 3:33 PM
This is wrong!!!
If you have a loop with a where condition -> Your first hit in sy-tabix can by anything
lets asume you habe an internal table:
row 1 = value A
row 2 = value B
row 3 = value C
If your code is:
loop at internal_table
where value = 'B'
--> sy-tabix will be 2!!!!!
so you cannot use this as an loop count