Creation of Persistent Objects
In the program, you need to define a reference variable with the type of the class actor and fill it with the reference from the static attribute AGENT. You can then create a new instance of the persistent class using its method CREATE_PERSISTENT. The ABAP developer creates its interface from the definition of the key attributes of the persistent class. If a persistent object of the same persistence class with the same key attributes already exists in the program, the class-based exception CX_OS_OBJECT_EXISTING is triggered. By default, the data is saved by an asynchronous update. You must start this process by using the COMMIT WORK statement. Thus, the instances of the persistent class do not become persistent objects until after that point.
To Create Persistent Classes
Steps
OO Transaction
In transaction maintenance, you can create transaction code as an OO transaction. This means that you link the transaction code either to the transaction service of the ABAP Objects Services for persistent objects or a public method in a global or local class of a program. When calling this type of OO transaction, which is linked to an instance method, the system automatically creates an instance of the class in its own internal session and then executes this instance method.
You still require procedural framework programs for screen fields.
If the OO Transaction Model flag is set, the system links the transaction code to the transaction service of the ABAP Objects Services. Conversely, if it is not set, you can call any method in a global or local class.
Users, therefore, now have the opportunity to call methods themselves in the usual way (using menu options, command field entries, and so on).
Global classes in ABAP Objects cannot contain screen definitions.
Therefore, when you create a link to a global class, note the following points:
Breaking these rules will not cause a syntax error or message from the Extended Syntax Check. Instead, you will either cause a runtime error or there will be no display.
Therefore, you may have to resort to using methods in local program classes. Naturally, you can then use all the conventional dialog programming techniques.
You can create an OO transaction by using the following steps:
Steps