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 a DEFINITION.
PUBLIC SECTION.
DATA: lv_var TYPE i VALUE 10.
METHODS display.
ENDCLASS.
CLASS a IMPLEMENTATION.
METHOD display.
DATA: lv_var TYPE i VALUE 20.
WRITE: lv_var .
WRITE: / me->lv_var.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA: obj TYPE REF TO a.
CREATE OBJECT obj.
obj->display( ).
Output
****************************Thank you ****************************
Comments
Post a Comment