Get Cursor Syntax check

The previous syntax check deals with GET part one and two and it may be a good place to refer once about GET syntax. The present post deals with GET CURSOR.

Variant 1GET CURSOR FIELD f.

Additions
  1. OFFSET off
  2. LINE lin
  3. VALUE g
  4. LENGTH len
EffectTransfers the name of the field at the cursor position to the field f .

The return code value is set as follows:

SY-SUBRC = 0 Cursor was positionedd on a field.

SY_SUBRC = 4 Cursor was not positioned on a field.

Unlike screen processing, list processing allows you to output literals, field symbols, parameters and local variables of subroutines. Literals, local variables and VALUE parameters of subroutines are treated like fields without names (field name SPACE , return value 0).

Otherwise, GET CURSOR FIELD returns only names of global fields, regardless of whether they are addressed directly (i.e. by " WRITE "), by field symbols or by reference parameters.

Example Code:DATA: CURSORFIELD(20),

GLOB_FIELD(20) VALUE 'global field',

REF_PARAMETER(30) VALUE 'parameter by reference',

VAL_PARAMETER(30) VALUE 'parameter by value',

FIELD_SYMBOL(20) VALUE 'field-symbol'.

FIELD-SYMBOLS: .

PERFORM WRITE_LIST USING REF_PARAMETER VAL_PARAMETER.

ASSIGN GLOB_FIELD TO .

AT LINE-SELECTION.

GET CURSOR FIELD CURSORFIELD.

WRITE: / CURSORFIELD, SY-SUBRC.

FORM WRITE_LIST USING RP VALUE(VP).

DATA: LOK_FIELD(20) VALUE 'lokal field'.

ASSIGN FIELD_SYMBOL TO .

WRITE: / GLOB_FIELD, / LOK_FIELD,

/ RP, / VP,

/ 'literal', / FIELD_SYMBOL.

ENDFORM.

When you double-click on the word " global field ", CURSORFIELD contains the field name GLOB_FIELD , on " parameter by reference " the field name REF_PARAMETER , on " field symbol " the field name FIELD_SYMBOL , and on " local field ", " parameter by value " and " literal " the value SPACE .

You can go through the complete ABAP Syntax check here.



SAP authorization and client administration in mysap.com

No comments :

Post a Comment