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: 

SET CURSOR does not work, why?

Former Member
0 Kudos

Hi,

I want to set cursor to the new line which is inserted. Here is the code in MODULE user_command_0100 INPUT.

....

GET CURSOR LINE lin.

CHECK sy-subrc = 0.

lin = tbl-top_line + lin.

SET CURSOR LINE lin.

...

In flow logic the PBO is:

loop at i_test

into wa_test

with control tbl

cursor tbl-current_line.

endloop.

But, the SET CURSOR does not work. The cursor does not move to the insert line.

Any solutions?

Thanks a lot!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

Setting the Cursor Position

When a screen is displayed, the system automatically places the cursor in the first field that is ready for input. However, you can also define on which screen element the cursor should appear in your program. The screen element does not have to be an input field. Positioning the cursor can make applications more user-friendly.

You can set the cursor position either statically in the Screen Painter or dynamically in your ABAP program.

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

code

SET CURSOR FIELD f LINE lin OFFSET off.

[/code]

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

Setting the Cursor Position

this program might help u:

REPORT demo_dynpro_set_cursor.

DATA: field1(14) TYPE c, field2(14) TYPE c, field3(14) TYPE c,

name(10) TYPE c.

SELECTION-SCREEN BEGIN OF BLOCK bloc WITH FRAME.

PARAMETERS: def RADIOBUTTON GROUP rad,

txt RADIOBUTTON GROUP rad,

f1 RADIOBUTTON GROUP rad,

f2 RADIOBUTTON GROUP rad,

f3 RADIOBUTTON GROUP rad.

SELECTION-SCREEN END OF BLOCK bloc.

PARAMETERS pos TYPE i.

IF txt = 'X'.

name = 'TEXT'.

ELSEIF f1 = 'X'.

name = 'FIELD1'.

ELSEIF f2 = 'X'.

name = 'FIELD2'.

ELSEIF f3 = 'X'.

name = 'FIELD3'.

ENDIF.

CALL SCREEN 100.

MODULE cursor OUTPUT.

IF def NE 'X'.

SET CURSOR FIELD name OFFSET pos.

ENDIF.

SET PF-STATUS 'SCREEN_100'.

ENDMODULE.

MODULE back INPUT.

LEAVE SCREEN.

ENDMODULE.

reward if useful

thanks and regards

suma sailaja

Edited by: suma sailaja pvn on Jan 9, 2008 3:43 PM

3 REPLIES 3

Former Member
0 Kudos

hi,

Setting the Cursor Position

When a screen is displayed, the system automatically places the cursor in the first field that is ready for input. However, you can also define on which screen element the cursor should appear in your program. The screen element does not have to be an input field. Positioning the cursor can make applications more user-friendly.

You can set the cursor position either statically in the Screen Painter or dynamically in your ABAP program.

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

code

SET CURSOR FIELD f LINE lin OFFSET off.

[/code]

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

Setting the Cursor Position

this program might help u:

REPORT demo_dynpro_set_cursor.

DATA: field1(14) TYPE c, field2(14) TYPE c, field3(14) TYPE c,

name(10) TYPE c.

SELECTION-SCREEN BEGIN OF BLOCK bloc WITH FRAME.

PARAMETERS: def RADIOBUTTON GROUP rad,

txt RADIOBUTTON GROUP rad,

f1 RADIOBUTTON GROUP rad,

f2 RADIOBUTTON GROUP rad,

f3 RADIOBUTTON GROUP rad.

SELECTION-SCREEN END OF BLOCK bloc.

PARAMETERS pos TYPE i.

IF txt = 'X'.

name = 'TEXT'.

ELSEIF f1 = 'X'.

name = 'FIELD1'.

ELSEIF f2 = 'X'.

name = 'FIELD2'.

ELSEIF f3 = 'X'.

name = 'FIELD3'.

ENDIF.

CALL SCREEN 100.

MODULE cursor OUTPUT.

IF def NE 'X'.

SET CURSOR FIELD name OFFSET pos.

ENDIF.

SET PF-STATUS 'SCREEN_100'.

ENDMODULE.

MODULE back INPUT.

LEAVE SCREEN.

ENDMODULE.

reward if useful

thanks and regards

suma sailaja

Edited by: suma sailaja pvn on Jan 9, 2008 3:43 PM

Former Member
0 Kudos

Try the following:


....
GET CURSOR LINE lin.
CHECK sy-subrc = 0.
lin = tbl-top_line + lin.
SET CURSOR LINE lin.
...

In flow logic the PBO is:

loop at i_test
into wa_test
with control tbl
*cursor tbl-current_line. "comment this line and try again
endloop.

Hope this helps.

Thanks

Sanjeev

Former Member
0 Kudos

solved by meself. thanks