Skip to Content
avatar image
Former Member

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

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Sep 28, 2012 at 01:29 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 28, 2012 at 11:24 AM
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 09, 2012 at 04:23 AM

    SET CURSOR FIELD <f> LINE <lin>.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 09, 2012 at 07:17 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded