SAP ABAP OBJECTS Tutorials

Template for making a class

Delete the parts that should not be used

******************************************

* Definition part

******************************************

CLASS xxx DEFINITION.

*——————————

* Public section

*——————————

PUBLIC SECTION.

TYPES:

DATA:

*   Static data

CLASS-DATA:

*   Methods

METHODS:

*     Using the constructor to initialize parameters

constructor    IMPORTING xxx type yyy,

*     Method with parameters

mm1 IMPORTING iii   TYPE ttt.

*     Method without parameters

mm2.

*   Static methods

CLASS-METHODS:

*—————————————————*

* Protected section. Also accessable by subclasses

*—————————————————

PROTECTED SECTION.

*—————————————————

* Private section. Not accessable by subclasses

*—————————————————

PRIVATE SECTION.

ENDCLASS.

******************************************

* Implementation part

******************************************

CLASS lcl_airplane IMPLEMENTATION.

METHOD constructor.

ENDMETHOD.

METHOD mm1.

ENDMETHOD.

METHOD mm2.

ENDMETHOD.

ENDCLASS.