Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  SAP GUI User Dialogs →  General Dynpros →  ABAP Statements for Dynpros →  GET CURSOR - Dynpro 

Dynpros, Determining the Cursor Position

This example demonstrates how to determine the cursor position on dynpros.

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 dynpro number of dynpro 100 is 100. All input/output fields except for the screen field of input_output are set as not ready for input in Screen Painter. The module init_screen_0100 sets the GUI status to STATUS_100 in the PBO event. In the GUI status, the 'Cancel' symbol (F12) is activated using the function code CANCEL, and the function key F2 is 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 associated with SELE. The output fields on the screen return the cursor position.