Class Definition Deferred.
It is concept in which delay the definition of a class .This variant of the statement CLASS is used to make the class class
known, regardless of the location of the actual definition of the class
in the program. It does not introduce a declaration part and must not be
ended using ENDCLASS.
*&---------------------------------------------------------------------*
*& Report ZCLASS_DEFERRED
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZCLASS_DEFERRED.
CLASS ABC DEFINITION DEFERRED.
***NOW GOING TO DEFINE CLASS XYZ AND MAKING OBJ THAT REFERNCES THE CLASS ABC.
CLASS XYZ DEFINITION.
PUBLIC SECTION.
DATA : OBJ1 TYPE REF TO ABC.
ENDCLASS.
CLASS ABC DEFINITION.
PUBLIC SECTION.
DATA : V1 TYPE CHAR40 VALUE 'HI I AM FROM CLASS ABC DEFINITION'.
ENDCLASS.
*******************************************************************
START-OF-SELECTION.
DATA: OBJ2 TYPE REF TO XYZ.
CREATE OBJECT : OBJ2,OBJ2->OBJ1.
WRITE:OBJ2->OBJ1->V1.