Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
OOABAP
OBJECTIVE
This presentation aims at providing the target audience with the following: OO concepts Overview of OOABAP
OO - CONCEPTS
Object Class Attributes Encapsulation Polymorphism Inheritance
OOABAP - Attributes
Public
Private
Attributes
Instance
Static
OOABAP- Methods
Public
Private
Methods
Constructor
Static Constructor
CLASSES
This example shows how to create a simple employee class. The constructor method is used to initialize number and name of the employee when the object is created. A display_employee method can be called to show the attributes of the employee, and CLASS-METHOD display_no_of_employees can be called to show the total number of employees (Number of instances of the employee class).
SUB CLASSES
Declaration CLASS xxx DEFINITION INHERITING FROM yyy. An example for Sub Classes:
INTERFACES
Implemented : In addition to & Independently of classes Operations defined in the interface are implemented as methods of the class, which must be present in class implementation part. Interface attributes, events, constants and types are automatically available to the class carrying out the implementation. Interface components are addressed in the class by <interface name> ~ <component name> Definition: Declaration (No visibility sections) Components (Attributes, methods, constants, types) defined similar to classes Defined in public section of class definition
INTERFACES
This example is similar to the previous example, however an interface is implemented with the method add_employee. Note that the interface is only implemented in the super class ( The INTERFACE statement), but also used in the subclasses. The interface in the example only contains a method, but an interface can also contain attributes, constants, types and alias names. The output from example 3 is similar to the output in example 2. All changes in the program compared to example 2 are marked with red.
EVENTS
Events can only have EXPORTING parameters When an event is triggered, only those events handlers that have registered themselves using SET HANDLER by this point of runtime are executed. You can register an event using ACTIVATION 'X' and deregister it by using ACTIVATION 'SPACE
EVENTS
This is similar to the previous examples. All changes are marked with red. There have been no changes to the subclasses, only to the super class and the report, so the code for the subclasses is not shown.