The state of real-world objects is represented by attributes, and the behaviour of the real-world object is represented by methods. A method is a block of code, such as function module or subroutine, associated with the object.
A class describes an object, and the object is a runtime instance of that class. Objects are created using the syntax CREATE OBJECT. The statement CREATE OBJECT creates an object in the memory of the application.
You can create any number of objects based on a single class, and each instance (object) of the class has its own unique identity and its own set of values for its attributes.
Local classes are defined within an ABAP program and can be used only in the program in which they are defined.
Template for ABAP Local Class:
CLASS CL1 DEFINATION.
PUBLIC SECTION.
DATA: d1, d2.
METHODS: M1.
EVENTS: EV1.
PROTECTED SECTION.
DATA: d3, d4.
METHODS: M2.
EVENTS: EV2.
PRIVATE SECTION.
DATA: d5, d6.
METHODS: M3.
EVENTS: EV3.
ENDCLASS.
CLASS CL1 IMPLEMENTATION.
METHOD M1.
ENDMETHOD.
METHOD M2.
ENDMETHOD.
METHOD M3.
ENDMETHOD.
ENDCLASS.
Global classes are stored in a class library and are visible system-wide. Global classes can be used by every program in the system. Global classes are defined in the Class Builder (Transaction SE24) in the ABAP Workbench.
No comments:
Post a Comment