Local constructors in ABAP.
Introduction to constructors - Introduction to constructor
Creation of Global constructor - Global constructor
1. Goto SE38.
2. Give program name and click on create.
3. Give title and click on save.
4. Write code.
REPORT zab_rp_constructors.
CLASS a DEFINITION.
PUBLIC SECTION.
METHODS: constructor.
CLASS-METHODS: class_constructor.
ENDCLASS.
CLASS a IMPLEMENTATION.
METHOD constructor.
WRITE: / 'Instance constructor'.
ENDMETHOD.
METHOD class_constructor.
WRITE: / 'Static constructor'.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA: obj TYPE REF TO a.
CREATE OBJECT obj.
ULINE.
CREATE OBJECT obj.
5. Activate and execute.
Output
**********************Thank You**********************
Comments
Post a Comment