ABAP Keyword Documentation → ABAP − Reference → SAP GUI User Dialogs → Classic Lists → Displaying Lists
GET CURSOR - List
Other versions: 7.31 | 7.40 | 7.54
Syntax
GET CURSOR { {FIELD field [
field_properties]}
| {LINE line [
line_properties]} }.
Variants
1. GET CURSOR FIELD field [field_properties].
2. GET CURSOR LINE line [line_properties].
Effect
If this statement is specified in list processing, it passes the name of the output field or the number
of the list line on which the screen cursor in the displayed list is positioned (after the user action)
to the variables field
or line
, depending on how
FIELD
or LINE
is specified. Further information on the cursor position can be read if required.
System Fields
sy-subrc | Meaning |
---|---|
0 | The cursor is on a field or a list line and the statement was executed successfully. |
4 | The cursor is not on any field or any list line. |
Variant 1
GET CURSOR FIELD field [field_properties].
Effect
Returns the name of the displayed field in field
after a user action. This
name is where the cursor is positioned in the currently displayed list. field
expects a character-like variable. The addition field_properties
can be used to read further information about the cursor position.
If the screen cursor is on a subarea displayed using an offset/length of a structure, the following rules apply:
-
The subarea of the structure has been displayed using the name of the structure:
- If the subarea includes the entire structure, the name of the structure is returned.
- If the subarea only includes a part of the structure, the name of the component is returned in which the subarea begins.
-
The subarea of the structure has been displayed using the name of a component of the structure:
- The name of the component is returned in which the subarea begins.
These rules also apply to substructures.
The addition FIELD
can only be used to determine the names of global data
objects of the ABAP program. If the cursor is positioned on the output of a data object that is not
visible in the current context or a literal, field
is initialized. This has no influence on the other additions or on sy-subrc
.
If the cursor is on the output area of a data object that was accessed in the WRITE
statement using a field symbol, the name of the data object is returned and not the name of the field symbol.
Variant 2
GET CURSOR LINE line [line_properties].
Effect
Returns the number of the list line in line
after a user action. This line
is where the cursor is positioned in the currently displayed list. line
expects
a variable of type i
. The addition
line_properties
can be used to read further information about the cursor position.