ABAP - Keyword Documentation → ABAP RAP Business Objects → RAP - Behavior Definitions → RAP - BDL for Behavior Definitions → RAP - Managed and Unmanaged Behavior Definitions → RAP - EntityBehaviorDefinition → RAP - EntityBehaviorCharacteristics → 

    RAP - persistent table

    Syntax


    ...
    persistent table TableName
    ...

    Description


    The RAP persistent table is the DDIC database table a RAP BO is based on. The persistent data on the persistent table is processed by RAP BO operations.

    Availability


    Requirements:

    • If the BDEF specifies an ETag field, the persistent table requires a field that is used to describe the state of the database table. This can be, for example, a time stamp field.
    • If the RAP BO is draft-enabled and has a total ETag field, the persistent table requires a field that is updated whenever the BO instance is changed. This must be a separate field from the ETag master field. The total ETag field is necessary on the lock master entity.
    • If the primary key field is of type raw(16) (UUID), then it can be filled by the RAP framework using internal numbering. The syntax for this is numbering:managed.
    • If you decide to use UUIDs as primary keys, the following rules apply:
      • Every entity needs a field for the UUID key.
      • Child entities must have a field for their parent's UUID. This is required to define associations for the CDS composition relationship.
      • Any child entity that has no parent-child relationship with the lock master entity must have a field with the lock master's UUID. This is important to define associations to the lock master entity, which is required for ETag handling.

    Hints

    • If the field names of the persistent database table differ from the field names of the CDS views of the underlying data model, then a RAP type mapping is required in the entity behavior body. This can be the case, for example, if the fields of the CDS data model have alias names.
    • A RAP persistent table is a regular DDIC database table and can be accessed as such. Access with ABAP SQL and AMDP is technically possible, but not recommended. It is recommended that a persistent table is accessed using the RAP framework only, for example, with ABAP EML.

    Example


    The following example shows a managed BDEF based on the CDS root view entity DEMO_MANAGED_ROOT. It specifies persistent database tables for the parent and the child entity.

    managed implementation in class bp_demo_managed_root unique;
    strict ( 2 );

    define behavior for DEMO_MANAGED_ROOT
    persistent table demo_tab_root
    lock master
    authorization master ( global )
    {
      create;
      update;
      delete;
      association _child { create; }

      field ( readonly : update ) key_field;
    }

    define behavior for DEMO_MANAGED_CHILD alias child
    persistent table demo_tab_child
    lock dependent by _parent
    authorization dependent by _parent
    {
      update;
      delete;
      field ( readonly : update ) key_field;
      association _parent;
    }

    The class CL_DEMO_RAP_EML_MODIFY_OP_2 accesses the business object using EML and performs the following steps:

    • Modify operations with CREATE and CREATE BY
    • Modify operation with UPDATE
    • Modify operation with DELETE
    • Read operation with READ and READ BY

    The changes are saved with the statement COMMIT ENTITIES, and, thus, the changed data is persisted to the database tables. All changes to the persistent table are managed by the RAP framework.

    Executable Example


    The example MODIFY: Standard Operations (Managed) explains the example displayed above in detail.