08-14-2009 9:45 AM
Hi,
I have a program where iam appending data in to the internal table .
DATA : BEGIN OF ITAB OCCURS 10,
A TYPE I,
B TYPE I,
END OF ITAB.
DO 5 TIMES.
ITAB-A = SY-INDEX.
ITAB-B = SY-INDEX * 10.
APPEND ITAB. * COMMENTS FROM HEADER LINE ARE APPENDED TO THE BODY
ENDDO.
WRITE : / ITAB-A,ITAB-B. OUTPUT TILL HERE IS 5 50 ( WHERE SY-INDEX = 5)
SKIP.
LOOP AT ITAB[] INTO ITAB.
WRITE : / ITAB-A,ITAB-B.
ENDLOOP.
My question is what happen to the values of , and how?
SY-INDEX
SY-TABIX
SY-FILL.
With regards
Bhavana
08-14-2009 9:52 AM
HI,
SY-INDEX will be incremented within a DO-END or WHILE-ENDWHILE.
SY-TABIX will be incremented whenever an internal table is looped upon using LOOP statement.
Also when any particular row of an internal table is read successfully using READ statement; then SY-TABIX will hold the row number.
Regards,
Ankur Parab
08-14-2009 9:52 AM
HI,
SY-INDEX will be incremented within a DO-END or WHILE-ENDWHILE.
SY-TABIX will be incremented whenever an internal table is looped upon using LOOP statement.
Also when any particular row of an internal table is read successfully using READ statement; then SY-TABIX will hold the row number.
Regards,
Ankur Parab
08-14-2009 9:53 AM
When you use SY-INDEX in DO loop it increses as follows
Do Loop - Sy-index will increse by 1 in each loop.
LOOP AT ITAB. - SY_TABIX will increase by 1 in each loop.
So use SY-INDEX in DO LOOP and SY-TABIX IN looping internal table.
08-14-2009 9:53 AM
Hi,
After the execution of loop used for printing the lines of internal table values of SY-TABIX will change while that of SY-TFILL and SY-INDEX will remain same as before.
KR Jaideep,
08-14-2009 9:55 AM
Hi
it would display the values from 1-10 ,2-20,........
SY-TABIX : used for record count of internal tables.
SY-INDEX : used for loop counter.
SY-TFILL contains the number of lines in the relevant internal table.
You can get more information at
[SYSTEMFIELDS|http://help.sap.com/saphelp_nw70/helpdata/en/7b/fb96c8882811d295a90000e8353423/content.htm]
Thanks
Viquar Iqbal