‎2009 Aug 19 8:49 AM
Hi all,
In my custom screen, i have a table control with 100 records and position button. When the user press the position button one dialog screen will appear and user will give the record and press OK button. My requirement is to set the cursor position at selected record in table control.
For example if i gave 38 then i want to set the cursor position at 38th record.
I have already wrote Set cursor in my program but it is working for current page only.
Thanks in advance,
Mahi.
‎2009 Aug 19 10:03 AM
in pai user_command
read the rord no of the internal table
for example.
read table itab with key field = input_field.
if sy-subrc eq 0.
va_tabix = sy-tabix.
endif.
in pbo of the screen.
if va_tabix ne 0.
tc-top_line = va_tabix.
clear va_tabix.
endif.
This will bring your record at the first line.
‎2009 Aug 19 10:03 AM
in pai user_command
read the rord no of the internal table
for example.
read table itab with key field = input_field.
if sy-subrc eq 0.
va_tabix = sy-tabix.
endif.
in pbo of the screen.
if va_tabix ne 0.
tc-top_line = va_tabix.
clear va_tabix.
endif.
This will bring your record at the first line.
‎2011 Aug 03 12:33 PM
‎2009 Aug 19 12:26 PM
Solved my self by using the function module SCROLLING_IN_TABLE
‎2010 May 06 3:07 AM
Another option is the user input the value of the table key:
DATA: v_KEY_pos(30).
t_pos_exclude-fieldname = 'MANDT'.
APPEND t_pos_exclude.
CALL FUNCTION 'TABLE_GET_KEY_TO_SET_CUR_ROW'
EXPORTING
table = 'T024' "TABLE STRUCTURE NAME
IMPORTING
table_key = v_KEY_pos "RETURN THE KEY FOUND
TABLES
exclude_fields = t_pos_exclude
EXCEPTIONS
cancelled_by_user = 01
table_not_found = 02.
v_ekgrp = v_KEY_pos+3(3). "PUT THE KEY INTO A KEY TYPE FIELD
READ TABLE t_t024 INTO w_t024 WITH KEY ekgrp = v_ekgrp.
v_linha = sy-tabix.
tc_grupo_compr-top_line = v_linha. "SET THE TOP LINE