Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  User Dialogs →  Screens →  ABAP Statements for Screens →  GET CURSOR - Dynpro 

Screens, Determining the Cursor Position

The example shows how to determine the cursor position on screens.

Other versions: 7.31 | 7.40 | 7.54

Source Code

PROGRAM demo_dynpro_get_cursor .

DATA: ok_code TYPE sy-ucomm,
      save_ok LIKE ok_code.

DATA: input_output(20) TYPE c,
      fld(20) TYPE c,
      off     TYPE i,
      val(20) TYPE c,
      len     TYPE i.

CALL SCREEN 100.

MODULE init_screen_0100 OUTPUT.
  SET PF-STATUS 'STATUS_100'.
ENDMODULE.

MODULE user_command_0100 INPUT.
  save_ok = ok_code.
  CLEAR ok_code.
  CASE save_ok.
    WHEN 'CANCEL'.
      LEAVE PROGRAM.
    WHEN 'SELE'.
      GET CURSOR FIELD fld OFFSET off VALUE val LENGTH len.
  ENDCASE.
ENDMODULE.

Description

The static next screen number of screen 100 is 100. All input/output fields except for the screen field of input_output have been set as not ready for input in the Screen Painter. Module init_screen_0100 sets the GUI status to STATUS_100 in the PBO event. In the GUI status, the 'Cancel' ( F12) has been activated using the function code CANCEL, and the function key F2 has been assigned the function code SELE. When the program is executed, the user may select all screen elements by double-clicking them or all interface elements linked to SELE. The output fields then show the corresponding cursor position.