What are objects in sap abap? What are the characteristics of objects?

SAP ABAP objects are instances of classes. The attributes of objects are defined by components of class which describe the state and behaviour of objects. Objects contain data and perform services. These are known as methods. The data of object cannot be changed directly by the user, but it follows the methods opted by the objects.

An object is a pattern or instance of a class. It represents a real-world entity like variables and constants and programming entities like hardware and software components of a computer.

The three main characteristics of an object are −

  • Has a state.
  • Has a unique identity.
  • May or may not display the behavior.

The state of an object helps the user to determine a set of attributes and their values. For example, if the user creates a bank account details specified with a set of attributes i.e (data) such as Account Number, Name, Account Type, Balance, and values of all these attributes. That means the state of an object encloses the attributes of an object with its unique identity and the behavior of an object helps to sort out the changes that occur in its attributes over a period of time.

Every object has a unique identity with its distinguishing features from other objects. Two objects may possess the same behaviour, but they may differ in their state and never have the same identity. For example two persons may have the same name, age, and gender but they differ in identity. Likewise, the identity of an object will never change throughout its period of time.

Interaction between the objects takes place by sending messages. Objects contain data and code to manipulate the data. An object can also be used as a user-defined data type with the help of a class. Objects are also called data variables of the type class. The user can create any number of objects belonging. Each object is holds the data of the type class with which it has been created.

Creating an Object

To create an object, the following are the steps to include-

Creating a reference variable with reference to the class. The syntax for which is −

Creating an object from the reference variable. The syntax for which is −


The above code produces the following output −

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status