Tag Archive for Persistent classes in ABAP

SAP Transient Vs Persistent Objects (Persistent Class)

Transient

ABAP Program stays in the local ABAP memory for the session only till the runtime of that program. That means that data and state is preserved only till the context of the program is active.

Persistent

If the data is preserved more that the state of an object then that it falls in the category of persistent data. When working with persistent data, system loads data in transient state and stores it back to persistent state after use.

ABAP Objects

ABAP Objects are transient by nature which means that they only exist in program session memory from the time of generation till the time of garbage collection.

Persistent Classes and Persistent Service

Persistent Classes in ABAP means that objects created from that class would be managed by persistent service in SAP. Persistent service facilitates saving state of an object instance with unique key and then load again on the need basis.

Objects created with Persistent class are called Managed Object.

Uses of Persistent Classes

-  Once a Managed Object instance is created, then its state is stored by persistent service. Any access to the object instance later on would be able to provide all the attributes of that instance of persistent class if accessed properly with key during next run.

-  Persistent classes are used extensively for workflow programming and works as a replacement to old style of delegating business objects.

Some of the code snippets of working with persistent object are given in the below link.

http://help.sap.com/saphelp_nw04/helpdata/en/b0/65094de89011d4b2eb0050dadfb92b/content.htm

The example check for old instance of persistent class first and if not found then it creates a new instance with unique key to identify it next time.

DZoneDeliciousLinkedInRedditTechnorati FavoritesStumbleUponShare