Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Set Cursor position in table control

Former Member
0 Likes
1,192

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
735

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.

4 REPLIES 4
Read only

Former Member
0 Likes
736

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.

Read only

0 Likes
735

Hi Alpesh,

The one you provided is gud and simple..

Thanks

Read only

Former Member
0 Likes
735

Solved my self by using the function module SCROLLING_IN_TABLE

Read only

0 Likes
735

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