ME keyword in OOPS ABAP

 * A method can have a variable defined within it having the same name as one of the attributes of the class to which the method belongs to.

* To clearly identify the class level attribute, the selector ME is used.


Example

REPORT zab_rp_me.

CLASS DEFINITION.
  PUBLIC SECTION.
    DATAlv_var TYPE VALUE 10.
    METHODS display.
ENDCLASS.
CLASS
 IMPLEMENTATION.
  METHOD display.
    DATAlv_var TYPE VALUE 20.
    WRITElv_var .
    WRITE/ me->lv_var.
  ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
  DATAobj TYPE REF TO a.
  CREATE OBJECT obj.
  obj->display).

Output


****************************Thank you ****************************


Comments

Popular posts from this blog

New syntax for append- VALUE (new syntax 7.4+) in ABAP

Read statement new syntax in ABAP. (7.4+).

Concatenation new syntax( 7.4+ ).