Creating a local class within a program is of 2 types.
1. Definition.
2. Implementation.
*----------------------------------------------------------------------*
* CLASS LCL_ABAP DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
* CLASS LCL_ABAP DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS LCL_ABAP DEFINITION. "DEFINING A CLASS
PUBLIC SECTION.
DATA V_NAME1 TYPE CHAR20. " DATA STANDS FOR INSTANCE STATEMENT
DATA V_NAME2 TYPE CHAR20.
CLASS-DATA V_NAME3 TYPE CHAR20. "CLASS-DATA STANDS FOR STATIC STATEMENT
ENDCLASS.
DATA OBJ TYPE REF TO LCL_ABAP.
CREATE OBJECT OBJ. " OBJECT CREATION
OBJ->V_NAME1 = 'SAP'.
OBJ->V_NAME2 = 'OOPS'. " ASSIGNING DATA
LCL_ABAP=>V_NAME3 = 'ABAP'.
WRITE:/ OBJ->V_NAME1 COLOR 3,
OBJ->V_NAME2 COLOR 4, "DISPLAYING USING WRITE STATEMENTS
LCL_ABAP=>V_NAME3 COLOR 5.
OUTPUT