Application Development 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: 

How to set cursor in a particular row of table control?

Former Member
0 Kudos

I created a dialog program using table control. After user saves the entries  in table control,  iam validating all the rows in table control .If there is any error, i want to set cursor to particular row where there is error. can any one tell me how to do that?

5 REPLIES 5

Former Member

Former Member
0 Kudos

Here is some document on how to set and get cursor for the table control.

Cursor Position for a table control can be set in following ways:

At PBO you can set the cursor on a specific field of a specific row of a table control.

SET CURSOR FIELD <f> LINE <lin> [OFFSET <off>]

Using the optional addition OFFSET, you can enter the offset of the cursor in the field as described under Setting the Cursor Position.

At PAI you can read the current cursor position.

GET CURSOR FIELD <f> LINE <lin> …

In addition to the information given under Finding Out the Cursor Position, field <lin> contains information on which row of the table control the cursor is currently on. You can also use

GET CURSOR LINE <lin>.

to  determine the row of the table control. SY-SUBRC allows you to check if the cursor is placed in a row of a table control.

For getting the corresponding line of the internal table :

GET CURSOR line <lin>.

ind = <table_control>-top_line + <lin> – 1.

Read table <itab> index ind.

The system variable stepl - contains the current table line index in a loop … endloop.  Loopc – contains number of lines visible in the table

0 Kudos

Thank yu so much..

kamireddy_harsha
Explorer
0 Kudos

SET CURSOR FIELD <f> LINE <lin>.

manish_shankar
Participant
0 Kudos

Hi Poorani,

At PBO you can set the cursor on a specific field of a specific row of a table control.

SET CURSOR FIELD f LINE lin [OFFSET off].

Using the optional addition OFFSET, you can enter the offset of the cursor in the field as described under setting the cursor position.

At PAI you can read the current cursor position.

GET CURSOR FIELD f LINE lin ...

Refer to this standard program: DEMO_DYNPRO_SET_CURSOR

- Regards,

Manish Shankar.