The methods are internal procedures that define the behavior
of an object in a class. They can access all the attributes of a class. This
allows them to change the data content of an object. They also have a "parameter
interface," whose role is to help the users by supplying them with values
when calling them and receiving values back from them. The private attributes
of a class can only be changed by methods in the same class. The definition and
parameter interface of a method is similar to that of function modules. Using
the following processing block, you define a method <meth> in the
definition part of a class and implement it in the implementation part:
In the same way as in other ABAP procedures (subroutines and
function modules), you can declare local data types and objects in methods. You
call the following methods by using the CALL METHOD statement.
Instance Method
You can declare instance methods by using the METHODS
statement. They play a very important role as they can access all of the
attributes of a class and can trigger all of the events of the class.
Static Methods
You can declare static methods by using the
CLASS-METHODS statement. They are important and can only access static
attributes and trigger static events.
Special Methods
Apart from normal methods, there are two special methods
which you call using CALL METHOD. These are called CONSTRUCTOR and CLASS
_CONSTRUCTOR. They are automatically called when you create an object
(Constructor) or when you first access the components of a class (CLASS
_CONSTRUCTOR).