Local class template :
See also Template for ABAP local ALV event class
CLASS lcl_sample_class DEFINITION.
*------------------------------
* Public section
*------------------------------
PUBLIC SECTION.
TYPES : BEGIN OF ts_public_type,
flag TYPE abap_bool,
value TYPE char20,
END OF ts_public_type.
DATA : gt_public_table TYPE STANDARD TABLE OF ts_public_type WITH DEFAULT KEY. "Global table inside the class (table must be fully typed to be used in return types)
METHODS constructor IMPORTING iv_input TYPE char20.
METHODS public_method IMPORTING iv_input TYPE char20
RETURNING VALUE(rs_output) TYPE ts_public_type.
CLASS-METHODS public_static_method IMPORTING iv_input TYPE char20
RETURNING VALUE(rv_output) TYPE char20.
*------------------------------
* Private section
*------------------------------
PRIVATE SECTION.
TYPES : BEGIN OF ts_private_type,
flag TYPE abap_bool,
value TYPE char20,
END OF ts_private_type,
ti_private_type TYPE STANDARD TABLE OF ts_private_type WITH DEFAULT KEY. " (tables must be fully typed to be used in return types)
DATA : gt_private_table TYPE ti_private_type. "Global table inside the class
CLASS-DATA : gs_static_private_structure TYPE mara,
gv_static_private_var TYPE matnr.
METHODS _private_method IMPORTING iv_input TYPE char20
RETURNING VALUE(rs_output) TYPE ts_public_type.
CLASS-METHODS _private_static_method IMPORTING iv_input TYPE char20
RETURNING VALUE(rv_output) TYPE char20.
ENDCLASS. " End of lcl_sample_class DEFNITION
CLASS lcl_sample_class IMPLEMENTATION.
METHOD constructor.
" Init process for instanciated class
ENDMETHOD.
METHOD public_method.
" Public (instanciated) method
" Code...
ENDMETHOD.
METHOD public_static_method.
" Code...
ENDMETHOD.
METHOD _private_method.
" Private (instanciated) method
" Code...
ENDMETHOD.
METHOD _private_static_method.
" Code...
ENDMETHOD.
ENDCLASS. " End of lcl_sample_class IMPLEMENTATION
About the author