SAP OS PERSIST ABEXA

Get Example source ABAP code based on a different SAP table
  


ARTIClE

Persistence Service
This example demonstrates creating a persistent object.

ABAP_SOURCE_CODE
ABAP_EXEC

ABAP_DESCRIPTION
A reference to the class actor of the pesistent class CL_SPFLI_PERSISTENT is assigned to the reference variable agent . It is created once by the static constructor of the CA_SPFLI_PERSISTENT class. Using the GET_PERSISTENT method, a check is made to establish whether there is already a persistent object with the required key in the database. If an object already exists, it can be deleted using DELETE_PERSISTENT. If no object exists, the exception CX_OS_OBJECT_NOT_FOUND occurs and is caught. In the corresponding CATCH block, an attempt is made using CREATE_PERSISTENT to generate the object. Note that the object is only generated for the database when the COMMIT WORK statement is used. Without an explicit COMMIT WORK, it exists only as an administrating object in the program and it will be deleted without affecting the database at the end of the program.