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 in Table control

Former Member
0 Likes
2,089

Hi All,

I have designed a table control with wizard and when i enter the input and press ENTER the cursor should move to the next column automatically .

Kindly share your ideas!

Regards,

Pradeep.

7 REPLIES 7
Read only

Former Member
0 Likes
1,863

Hi Pradeep,

  you can use GET CURSOR and SET CURSOR command.

TYPES: BEGIN OF CURSOR_TYPE,

         NEXT_CUCOL TYPE SY-CUCOL,

         NEXT_CUROW TYPE SY-CUROW,

         CURSORFIELD(30),

         POS_CUCOL  TYPE SY-CUCOL,

         POS_CUROW  TYPE SY-CUROW,

       END   OF CURSOR_TYPE.

DATA : CURSOR   TYPE  CURSOR_TYPE.

* to get the cursor position.

    GET CURSOR FIELD  CURSOR-CURSORFIELD
             OFFSET CURSOR-POS_CUCOL
             LINE   CURSOR-POS_CUROW.

* to set the cursor position.

    SET CURSOR FIELD  CURSOR-CURSORFIELD
             OFFSET CURSOR-POS_CUCOL
             LINE   CURSOR-POS_CUROW.

also see the documentation for GET/SET CURSOR.

Regards,

Mordhwaj

Read only

Former Member
0 Likes
1,863

Hi Pradeep,

Just look in to the Table Control's code created by wizard, it also uses Cusrors, Current Line etc.

BR,

Ankit.

Read only

Former Member
0 Likes
1,863

This message was moderated.

Read only

Former Member
0 Likes
1,863

I have tried . But still it not resolved. Any more ideas?

Read only

0 Likes
1,863

Hi Pradeep,

Do as suggested by Mordhwaj/Karthik i.e.

In PAI

use Get Cursor

and

In PBO

use SET Cursor.

Eg :-

  GET CURSOR FIELD '<Work_Area-Field>'  LINE 1.

  SET CURSOR FIELD '<Work_Area-Field>'  LINE 1.

BR,

Ankit.

Read only

Former Member
0 Likes
1,863

Hi Pradeep,

In PAI you should use GET CURSOR statement to get the row and column the cursor is currently in. Then in PBO use the SET CURSOR statment to set the cursor to the next field. Obviously you should know the order of the field in the table control to set the cursor to the following field. Also keep in mind the SY-UCOMM for Enter button is SPACE. It will help you in PAI User command event.

Hope this helps. Try and post your code for further troubleshooting.

Regards,

Karthik

Read only

Former Member
0 Likes
1,863

Hi Pradeep

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

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

FOR MORE DOCUMENTATION ON THIS PLEASE GO THROUGH THE LINK

<a href="http://72.14.203.104/search?q=cache:AJJ3D7y_NFYJ:help.sap.com/saphelp_nw04/helpdata/en/9f/dbac9f35c1...SetcursortoTablecontrolField+ABAP&hl=en&gl=in&ct=clnk&cd=1">Cursor Position on Table Controls</a>

<a href="http://72.14.203.104/search?q=cache:eNQbEfxNJTUJ:help.sap.com/saphelp_nw04/helpdata/en/9f/dbac0b35c1...SETCURSORFIELDABAP&hl=en&gl=in&ct=clnk&cd=2">Setting the Cursor Position</a>

Regards

Suganya