Accessing Attributes and Methods in SAP ABAP
An object instance of a class allows access to its attributes and methods specifically, we use the arrow operator (->) for this purpose. Consider this illustration:
DATA: obj TYPE REF TO <class_name>.
obj = NEW #( ). " Create an instance of the class.
obj->method_name( ). " Call the method.
WRITE: obj->attribute_name. " Access the attribute.
- <class_name>: name of the class.
- obj: object instance of the class.
- method_name: method being called.
- attribute_name: attribute being accessed.
Classes in SAP ABAP
SAP ABAP (Advanced Business Application Programming) is a high-level programming language created by the German software company SAP SE. ABAP is primarily used for developing and customizing applications within the SAP ecosystem, which includes enterprise resource planning (ERP) systems and other business software solutions. C++ is used to implement the ABAP kernel. A procedural and object-oriented programming model are both supported by the hybrid programming language ABAP.
Table of Content
- Introduction to Classes in SAP ABAP
- Syntax for defining a class in SAP ABAP
- Syntax for implementing a class in SAP ABAP
- Attributes in SAP ABAP Classes
- Methods in SAP ABAP Classes
- Accessing Attributes and Methods in SAP ABAP:
- Static Attributes
- Constructors in SAP ABAP
- ME operator in methods
- Examples of Classes in SAP ABAP