‎2005 Dec 08 7:57 PM
Quick question..
While looping through the records in table control, Would the TC-Current_line be same as sy-tabix of the Internal table?
‎2005 Dec 09 2:19 AM
hi,
<b>They are not the same</b>
Reason,
Suppose say that the table control can accomodate 5 rows on screen,and internal table containes 100 records,each time the table control scrolls down TC_current_line will reset to 1 and the sy-tabix keeps on increasing
TC_CURRENT_LINE sy-tabix
1 1
2 2
3 3
4 4
5 5
1 6
2 7
3 8
4 9
and so on
‎2005 Dec 08 8:00 PM
‎2005 Dec 08 8:02 PM
‎2005 Dec 08 8:02 PM
‎2005 Dec 08 8:03 PM
‎2005 Dec 08 8:10 PM
‎2005 Dec 08 8:13 PM
‎2005 Dec 08 8:14 PM
Hi
Yes they are the same, if you load whole internal table in the table control.
But the sy-tabix index is active while looping internal table, the <TABLE_CONTROL>-CURRENT_LINE while looping table control.
So in the PBO and PAI you should use <TABLE_CONTROL>-CURRENT_LINE, no SY-TABIX.
Max
Message was edited by: max bianchi
‎2005 Dec 08 8:21 PM
Think of it this way, if you were to take current_line and read the internal table you will get the row same row that would match sy-tabix if you were LOOPing at the table.
Say, that current_line is now "4" and you do a READ, you get the 4th row of the internal table.
Read table itab index tc-current_line.Now say, that you loop at the interal table and check when sy-tabix = 4. This is the same exact row.
Loop at itab.
if sy-tabix = 4.
* do something
Endif.
Endloop.REgards,
Rich Heilman
‎2005 Dec 08 8:14 PM
Using sy-tabix will have problems in comparision to current_line. If we take the case of PAI, the data flows from screen table to the internal table so the current_line points to the screen table rather than the internal table.In such a case it will be more appropriate to use current_line of table control than the sy-tabix.
‎2005 Dec 09 2:19 AM
hi,
<b>They are not the same</b>
Reason,
Suppose say that the table control can accomodate 5 rows on screen,and internal table containes 100 records,each time the table control scrolls down TC_current_line will reset to 1 and the sy-tabix keeps on increasing
TC_CURRENT_LINE sy-tabix
1 1
2 2
3 3
4 4
5 5
1 6
2 7
3 8
4 9
and so on
‎2005 Dec 09 2:21 AM
‎2005 Dec 09 3:11 PM
I am also of the opinion that current_line does not get reset while scrolling.. I know that 'Get Cursor' resets the position while scrolling..
‎2005 Dec 09 3:19 PM
Hi SSG,
Both are same.
if tc-current_line = 14 and with in the loop if you
try to acceess the record sy-tabix = 14 then you both
the records are same.
If you scroll alos it can not reset.
Thanks&Regards,
Siri.
‎2005 Dec 09 3:35 PM
Even I feel CURRENTLINE will be reset when you scroll..
vijay
‎2005 Dec 09 3:37 PM
‎2005 Dec 09 3:44 PM
‎2005 Dec 09 3:59 PM
Hi
I feel While looping both works same , but if you do some change or some double click on table control
it will not refer current_line.
it will be reset to 1 after scrolling...
vijay
‎2005 Dec 09 3:59 PM
Hi Rich,
Just now I have checked in my table control.
If it is with in the loop current_line and sy-tabix
are same.
If it is outside the loop then current_line will
always refers the tc-top_line. so we can not read the
itab using tc-currnt_line. it doesnt pick up cursor
line.
Thnaks&Regards,
Siri.
‎2005 Dec 09 4:07 PM
Hi Rich
You're right, the index current_line is always link with the index (sy-tabix) of table, it won't be reset.
While looping a table control there are three index:
- SY-STEPL,
- TOP_LINE,
- CURRENT_LINE
where:
CURRENT_LINE = TOP_LINE + SY-STEPL - 1.
The values of SY-STEPL can be from 1 to N, where N is the number of rows can be displayed in TC,
TOP_LINE is the index (sy-tabix) of the record of internal table placed in the first row of tc.
So SY-STEPL'll be reset to 1 for every new scrolling, not CURRENT_LINE.
When user does a doubleclick on a record of tc, the system returns the number of record of tc, not index of internal table: i.e. the system returns SY-STEPL.
The SY-STEPL'll be reset out of LOOP/ENDLOOP of tc.
So if user does a doubleclick, the SY-TABIX has to be found out by rule above:
GET CURSOR LINE VN_LINE.
SY-TABIX = TOP_LINE + VN_LINE - 1.
READ TABLE ITAB INDEX SY-TABIX.
Max
Message was edited by: max bianchi
Message was edited by: max bianchi
Message was edited by: max bianchi