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 not working

Former Member
0 Likes
1,533

The set cursor statement in the code below has no effect. Whatever field is in the first 'get cursor' statement is exactly the same in the last 'get cursor' statement.

Any idea why the set cursor statement is ignored?

get cursor field cursorfield.

cursorfield = 'ACCNT'.

set cursor field cursorfield.

get cursor field cursorfield.

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,204

Hi,

Please try this instead.


...
set cursor field 'ACCNT'.           <--- in capital letter and quotes
...

Regards,

Ferry Lianto

7 REPLIES 7
Read only

Former Member
0 Likes
1,204

Hi

But where have you placed that code?

Max

Read only

Former Member
0 Likes
1,205

Hi,

Please try this instead.


...
set cursor field 'ACCNT'.           <--- in capital letter and quotes
...

Regards,

Ferry Lianto

Read only

0 Likes
1,204

Same result if using

set cursor field 'ACCNT'.

It is in the AT Selection-screen part of the program. I am trying to set the cursor at the first field on the variant screen when the screen comes back if the user wants to enter another record. The cursor defaults to whichever was the the last field the user had their cursor in.

Read only

0 Likes
1,204

Hi

AT SELECTION-SCREEN is triggered after doing something, so here you can't <u>SET</u> the cursor, here you can only <u>GET</u> it.

U should use the event AT SELECTION-SCREEN OUTPUT to set the cursor:

PARAMETERS: P1(2), P2(2).

DATA FIELD(30).

AT SELECTION-SCREEN OUTPUT.

  SET CURSOR FIELD 'P2'.

AT SELECTION-SCREEN.


  GET CURSOR FIELD FIELD.

START-OF-SELECTION.

  WRITE FIELD.

Max

Read only

Former Member
0 Likes
1,204

Hi,

Please try this.


SET CURSOR FIELD 'ACCNT' LINE SY-LILLI.

Also check this link on SET CURSOR FIELD f.

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/set_curs.htm

Regards,

Ferry Lianto

Read only

0 Likes
1,204

Still the same. I had looked at that documentation and can not see the problem.

My guess is that it isn't finding the field that is on the selection screen so it is ignoring the statement.

Read only

0 Likes
1,204

Hi

Try my sample: it's working fine

Max