Persistent Object Services – Basics

By | April 21, 2009 | ABAP Objects, OO Concepts | 7,553 | 4
Some basics used in the Persistent Objects

Today we will see some basics about the Persistent Object Services.

Why do we need Persistent Object Service:
To better understand the need of the persistent objects we need to first understand the concept of the transient data. The local data for the program like Attributes of the class, or program data is known as the transient data.

Normally, with ABAP we load the data into our transient data, work on that and put it back to the database table (if required). At this point of time, our data exists in the two palces: Transient data (ABAP program local data) and in the appropriate database table or other storage medium (which is the persistent data). To avoid having the same data at the same time in two different context, we should use the persistent objects. Because by definition, the persistent data is the data which will be preserved beyound the runtime.

For SAP, we could have the persistent data in form of the Database table or file operations.

SAP Help defines the persistent objects like:

Technically speaking, ABAP Objects are always transient, just like the data objects in ABAP programs. There are no persistent objects in ABAP Objects. However, the Persistence Service within Object Services allows application developers to work with persistent objects. The Persistence Service can be thought of as a software layer between the ABAP program and the data repository (that is, the database), which allows you to save the attributes of objects with a unique identity, and then load them again when you need them.

Pros-&-Cons
- Good for big dialog / web applications where we are dealing with large number of data but for only one document at time like Sales Order processing, Process Order, GR creation etc.
- Adds one more abstraction layer in between the Business logic and the database.
- Not performance efficient for the report programming

How to create Persistent Objects
SAP Help on Mapping the Persistent Objects

Classes generated alongwith mapping:
When we finish up the creation of the persistent object services for any database table(s) it would create 2 additional classes. E.g: If we sucessfully map the table SPFLI in the Persistent Object class – ZCL_SPFLI_PERSISTENT, system would generate:
Actor Class – ZCA_SPFLI_PERSISTENT
Base Class – ZCB_SPFLI_PERSISTENT

In future posts, we would see how to use Persistent objects in application and some of its properties.

Like It? Share!!

Don't miss an Update

Naimesh Patel{245 articles}

I'm SAP ABAP Consultant for more than a decade. I like to experiment with ABAP especially OO. I have been SDN Top Contributor.
Follow :

Explore all of his 245 articles.

Load comments

4 Comments

  • Anonymous

    Actor class would be ZCA_SPFLI_PERSISTENT

  • Anonymous

    I have been reading on the performance of persistence objects but unable to find any useful info. Can anyone give me info on this, whether any caching is done and if yes, how does it work ?

  • your post is nice . . let me tell u one thing that Blogs have become latest and important source of quality free information on net people enjoying for hours together. . .nice blog keep sharing;)
    Dissertation Writing Services

  • Anonymous

    Good explanation

Comments on this Post are now closed. If you have something important to share, you can always contact me.