Show TOC

Mapping by Instance-GUIDLocate this document in the navigation structure

Use

To map database tables and objects using instance GUIDs, you have to create special tables that have exactly one primary key field of the type OS_GUID from the ABAP Dictionary. The Persistence Service uses the key field to address the managed objects internally. The persistent class does not have a corresponding key attribute.

The key column of this special table is filled with the instance GUIDs. Each instance GUID is unique within a client. At runtime, the Persistence Service identifies each object of the persistent class using its instance GUID and assigns it to a single line in the database table accordingly.

All remaining fields in the database table can then be mapped to value attributes of the persistent class.

Thus the instance GUID is a fixed-length technical key that is externally invisible and that lets you easily access instances, particularly where the objects are closely interlinked.

When you map a persistent object by business key, you can get a reference to it by specifying a semantic key. However, you cannot do this with objects mapped by instance GUID. You have to obtain the reference a different way before the object is first accessed in a program and then manage it yourself (in an internal table, for example). You can use mapping by instance-GUID and business key to simplify this process.

Mapping solely by instance GUID is best suited to objects that are purely dependent on other objects, since you do not have to access them explicitly in the ABAP program. You can save these objects long-term by saving their object references persistently .