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: 

selct

Former Member
0 Kudos
107

Hi,

i have select screen p_kunnr

s_datum

......

......

p_name

i wont to put cursor on 3rnd select line, not on p_kunnr

Thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
76

Hi Nick,

You can set the cursor on the current list dynamically from within your program. You can do this to support the user with entering values into input fields or selecting fields or lines. If input fields occur on a list, the system by default places the cursor into the first input field.

To set the cursor, use the SET CURSOR statement. This statement sets the cursor in the most recently-created list. While the basic list is being created, this is always the basic list itself. For a detail list, it is the previous list.

With SET CURSOR, you can set the cursor to an absolute position, to a field, or to a line.

Setting the Cursor Explicitly

To set the cursor to a certain position in the output window, use:

SET CURSOR <col> <lin>.

This statement sets the cursor to column <col> of line <lin> of the output window.

The system sets the cursor only to positions that are visible in the display. For positions outside the displayed area, it ignores the statement. To set the cursor to a part of the list currently not displayed, you must scroll the list first.

You can set the cursor only to lines that contain list output. These include lines skipped with the SKIP statement, but no underlines. If <lin> is below the bottom list line, the system sets the cursor to the bottom line.

REPORT demo_list_set_cursor_1 NO STANDARD PAGE HEADING LINE-SIZE 80.

SET PF-STATUS 'SCROLLING'.

NEW-LINE NO-SCROLLING.

WRITE 'Input Fields:'.

NEW-LINE NO-SCROLLING.

WRITE '----


'.

NEW-LINE.

DO 5 TIMES.

WRITE: ' Input', (1) sy-index, ' ' INPUT ON NO-GAP.

ENDDO.

FORMAT INPUT OFF.

SET CURSOR 11 3.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'LEFT'.

IF sy-staco > 1.

SCROLL LIST LEFT BY 12 PLACES.

ENDIF.

WHEN 'RGHT'.

IF sy-staco < 40.

SCROLL LIST RIGHT BY 12 PLACES.

ENDIF.

ENDCASE.

SET CURSOR 11 3.

This program creates a basic list that contains five input fields. The cursor is set to the first input field. The user can use the pushbuttons LEFT and RIGHT to scroll the list horizontally. After each scroll movement, the cursor is set to an input field again.

Setting the Cursor to a Field

To set the cursor to a certain field on a line of the displayed list, use:

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

This statement sets the cursor on line <lin> onto the field whose name is stored in <f>. If a field appears more than once on a line, the system sets the cursor to the first field. If the field does not appear on the line or if it is outside the displayed area, the system ignores the statement. You can use the SCROLL statement to scroll the line into the visible area of the screen.

Use the OFFSET option to set the cursor to position <off> of the field stored in <f>. <off> = 0 indicates the first position.

When you set the cursor, you must take into account the header lines of the list.

REPORT demo_list_set_cursor_2 LINE-SIZE 50.

DATA: input1(5) TYPE c VALUE '*****',

input2(5) TYPE c VALUE '*****',

input3(5) TYPE c VALUE '*****'.

SET PF-STATUS 'INPUT'.

WRITE 'Input Fields:'.

WRITE / '----


'.

SKIP.

WRITE: 'Input 1', input1 INPUT ON,

/ 'Input 2', input2 INPUT ON,

/ 'Input 3', input3 INPUT ON.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'INP1'.

SET CURSOR FIELD 'INPUT1' LINE 6 OFFSET 4.

WHEN 'INP2'.

SET CURSOR FIELD 'INPUT2' LINE 7 OFFSET 4.

WHEN 'INP3'.

SET CURSOR FIELD 'INPUT3' LINE 8 OFFSET 4.

ENDCASE.

This program creates a basic list containing three input fields. In the status INPUT, the function codes INP1, INP2, and INP3 are assigned to the function keys F5 , F6, and F7 and to the application toolbar. When you choose one of these functions, the system triggers the AT USER-COMMAND event. It places the cursor on the corresponding input field.

Setting the Cursor to a Line

To set the cursor to a certain line of the list in the output window, use:

SET CURSOR LINE <lin> [OFFSET <off>].

This statement sets the cursor to line <lin>. The system ignores the statement, if the line does not appear in the list or in the visible area of the window. You can use the SCROLL statement to scroll the line into the visible area of the screen.

Use the OFFSET option to set the cursor to column <off> of line <lin>. <off> = 0 indicates the first column. The system ignores the statement, if the position is outside the visible area of the list.

When you set the cursor, you must take into account the header lines of the list.

REPORT demo_list_set_cursor_3 LINE-SIZE 30

NO STANDARD PAGE HEADING.

DATA: inp(2) TYPE c, top(2) TYPE c.

SET PF-STATUS 'LINE_NUMBER'.

DO 50 TIMES.

WRITE: / 'Line ', (2) sy-index.

ENDDO.

TOP-OF-PAGE.

WRITE: 'Line number:', inp INPUT ON.

ULINE.

SKIP.

AT USER-COMMAND.

DESCRIBE LIST PAGE 1 TOP-LINES top.

CASE sy-ucomm.

WHEN 'LINE'.

READ LINE 1 FIELD VALUE inp.

SCROLL LIST TO PAGE 1 LINE inp.

inp = inp + top.

SET CURSOR LINE inp OFFSET 6.

ENDCASE.

This program creates a basic list with an input field and a set of lines.

In the status LINE_NUMBER, the function code LINE (text LINE NUMBER) is assigned to function key F5 and to a pushbutton of the application toolbar. If the user enters a number into the input field and chooses LINE NUMBER, the system scrolls to the specified number and sets the cursor to it:

The system reads the input field using READ LINE. For setting the cursor, it uses DESCRIBE LIST to take into account the size of the page header. Note that this example makes excessive use of automatic type conversion.

Regards,

Laxmi.

7 REPLIES 7

Former Member
0 Kudos
76

Refer the sample code below:

REPORT zkartest.

TABLES: vbak.

SELECT-OPTIONS: test1 FOR vbak-vbeln,

test2 FOR vbak-vbeln.

AT SELECTION-SCREEN OUTPUT.

SET CURSOR FIELD 'TEST2-LOW'.

-Kiran

Please mark useful answers

Former Member
0 Kudos
76

Hi Nick

try:

...

INITIALIZATION.

*

SET CURSOR FIELD 'S_LIFNR-LOW'.

or

SET CURSOR FIELD 'P_LIFNR'.

*

it depends of PARAMETERS or Select-Options.

Regards, Dieter

Former Member
0 Kudos
76

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

To set the cursor position dynamically, use the following statement in an ABAP dialog module in the PBO event:

<b>SET CURSOR FIELD <f></b>

I believe you should use this SET CURSOR Statement in AT SELECTION-SCREEN OUTPUT EVENT.

regards

Srikanth

Former Member
0 Kudos
76

At selection-screen output.

Set cursor field Fieldname.

or

loop at screen.

Former Member
0 Kudos
76

Try this

parameters: pcpath1 type localfile,

pcpath2 type localfile,

pcpath3 type localfile,

pcpath4 type localfile.

at selection-screen output.

SET CURSOR FIELD 'PCPATH4'.

Former Member
0 Kudos
77

Hi Nick,

You can set the cursor on the current list dynamically from within your program. You can do this to support the user with entering values into input fields or selecting fields or lines. If input fields occur on a list, the system by default places the cursor into the first input field.

To set the cursor, use the SET CURSOR statement. This statement sets the cursor in the most recently-created list. While the basic list is being created, this is always the basic list itself. For a detail list, it is the previous list.

With SET CURSOR, you can set the cursor to an absolute position, to a field, or to a line.

Setting the Cursor Explicitly

To set the cursor to a certain position in the output window, use:

SET CURSOR <col> <lin>.

This statement sets the cursor to column <col> of line <lin> of the output window.

The system sets the cursor only to positions that are visible in the display. For positions outside the displayed area, it ignores the statement. To set the cursor to a part of the list currently not displayed, you must scroll the list first.

You can set the cursor only to lines that contain list output. These include lines skipped with the SKIP statement, but no underlines. If <lin> is below the bottom list line, the system sets the cursor to the bottom line.

REPORT demo_list_set_cursor_1 NO STANDARD PAGE HEADING LINE-SIZE 80.

SET PF-STATUS 'SCROLLING'.

NEW-LINE NO-SCROLLING.

WRITE 'Input Fields:'.

NEW-LINE NO-SCROLLING.

WRITE '----


'.

NEW-LINE.

DO 5 TIMES.

WRITE: ' Input', (1) sy-index, ' ' INPUT ON NO-GAP.

ENDDO.

FORMAT INPUT OFF.

SET CURSOR 11 3.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'LEFT'.

IF sy-staco > 1.

SCROLL LIST LEFT BY 12 PLACES.

ENDIF.

WHEN 'RGHT'.

IF sy-staco < 40.

SCROLL LIST RIGHT BY 12 PLACES.

ENDIF.

ENDCASE.

SET CURSOR 11 3.

This program creates a basic list that contains five input fields. The cursor is set to the first input field. The user can use the pushbuttons LEFT and RIGHT to scroll the list horizontally. After each scroll movement, the cursor is set to an input field again.

Setting the Cursor to a Field

To set the cursor to a certain field on a line of the displayed list, use:

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

This statement sets the cursor on line <lin> onto the field whose name is stored in <f>. If a field appears more than once on a line, the system sets the cursor to the first field. If the field does not appear on the line or if it is outside the displayed area, the system ignores the statement. You can use the SCROLL statement to scroll the line into the visible area of the screen.

Use the OFFSET option to set the cursor to position <off> of the field stored in <f>. <off> = 0 indicates the first position.

When you set the cursor, you must take into account the header lines of the list.

REPORT demo_list_set_cursor_2 LINE-SIZE 50.

DATA: input1(5) TYPE c VALUE '*****',

input2(5) TYPE c VALUE '*****',

input3(5) TYPE c VALUE '*****'.

SET PF-STATUS 'INPUT'.

WRITE 'Input Fields:'.

WRITE / '----


'.

SKIP.

WRITE: 'Input 1', input1 INPUT ON,

/ 'Input 2', input2 INPUT ON,

/ 'Input 3', input3 INPUT ON.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'INP1'.

SET CURSOR FIELD 'INPUT1' LINE 6 OFFSET 4.

WHEN 'INP2'.

SET CURSOR FIELD 'INPUT2' LINE 7 OFFSET 4.

WHEN 'INP3'.

SET CURSOR FIELD 'INPUT3' LINE 8 OFFSET 4.

ENDCASE.

This program creates a basic list containing three input fields. In the status INPUT, the function codes INP1, INP2, and INP3 are assigned to the function keys F5 , F6, and F7 and to the application toolbar. When you choose one of these functions, the system triggers the AT USER-COMMAND event. It places the cursor on the corresponding input field.

Setting the Cursor to a Line

To set the cursor to a certain line of the list in the output window, use:

SET CURSOR LINE <lin> [OFFSET <off>].

This statement sets the cursor to line <lin>. The system ignores the statement, if the line does not appear in the list or in the visible area of the window. You can use the SCROLL statement to scroll the line into the visible area of the screen.

Use the OFFSET option to set the cursor to column <off> of line <lin>. <off> = 0 indicates the first column. The system ignores the statement, if the position is outside the visible area of the list.

When you set the cursor, you must take into account the header lines of the list.

REPORT demo_list_set_cursor_3 LINE-SIZE 30

NO STANDARD PAGE HEADING.

DATA: inp(2) TYPE c, top(2) TYPE c.

SET PF-STATUS 'LINE_NUMBER'.

DO 50 TIMES.

WRITE: / 'Line ', (2) sy-index.

ENDDO.

TOP-OF-PAGE.

WRITE: 'Line number:', inp INPUT ON.

ULINE.

SKIP.

AT USER-COMMAND.

DESCRIBE LIST PAGE 1 TOP-LINES top.

CASE sy-ucomm.

WHEN 'LINE'.

READ LINE 1 FIELD VALUE inp.

SCROLL LIST TO PAGE 1 LINE inp.

inp = inp + top.

SET CURSOR LINE inp OFFSET 6.

ENDCASE.

This program creates a basic list with an input field and a set of lines.

In the status LINE_NUMBER, the function code LINE (text LINE NUMBER) is assigned to function key F5 and to a pushbutton of the application toolbar. If the user enters a number into the input field and chooses LINE NUMBER, the system scrolls to the specified number and sets the cursor to it:

The system reads the input field using READ LINE. For setting the cursor, it uses DESCRIBE LIST to take into account the size of the page header. Note that this example makes excessive use of automatic type conversion.

Regards,

Laxmi.

Former Member
0 Kudos
76

Hi Nick,

if any of the answers solved your problem, please close the post.

regards

srikanth