Modified OOPS
Modified OOPS
Types of Classes
• Local Class: Defined inside an ABAP program and accessible only within the same
program.
• Global Class: Implemented using T-code SE24 and accessible across all programs in
the system.
Attributes in a Class
Attributes are variables that hold information about an object. They define the data
or properties of an object created from a class.
Types of Attributes
1. Instance Attributes:
Specific to each object of the class.
Declared using DATA.
2. Static Attributes:
Shared by all objects of the class.
Declared using CLASS-DATA.
Types of Methods in SAP ABAP Classes
Methods in a class define behavior or actions that objects or the class itself can
perform. In SAP ABAP, methods are categorized into two main types:
1. Instance Methods:
o Tied to a specific object of the class.
o Require an object instance to be called.
o Can access instance attributes.
Example:
CLASS lcl_car DEFINITION.
PUBLIC SECTION.
DATA: brand TYPE string. "Instance attribute
METHODS: display_brand. "Instance method
ENDCLASS.
o Main Area:
Example: