ABAP RAP Advanced

Custom Entity

Definition and Key Characteristics

What Is a Custom Entity?

  • Not a classic CDS view with a data source
  • Runtime implementation is done in an ABAP class
  • Data is provided through complex logic or external systems
  • Flexible use for special scenarios (e.g., APIs, calculations)

custom entity flow

Characteristics

  • Custom Entity defines structure and UI annotations
  • No SELECT statement in CDS; data comes from ABAP implementation
  • Linked to the implementation class via annotation
@ObjectModel.query.implementedBy: 'ABAP:ZCL_CUSTOM_ENTITY_IMPL'
define root custom entity ZC_CUSTOM_ENTITY {
  key ID   : sysuuid_x16;
  Name     : abap.string(100);
  ...
}

Key Objects for Custom Entity

  1. CDS Custom Entity – Structure and annotation definition
  2. Implementation Class – Data provider via IF_RAP_QUERY_PROVIDER
  3. Service Definition – Define service for the entity
  4. Service Binding – Publish and consume the service

Example Implementation Class

CLASS zcl_custom_entity_impl DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC.
PUBLIC SECTION.
  INTERFACES if_rap_query_provider.
ENDCLASS.

CLASS zcl_custom_entity_impl IMPLEMENTATION.
  METHOD if_rap_query_provider~select.
    "Data retrieval and return to RAP
  ENDMETHOD.
ENDCLASS.

Use Cases

  • Data consolidation from multiple sources
  • Calling external web services or BAPIs for data supply
  • Complex calculations or custom business logic before delivery
  • Integration of legacy systems into the RAP framework

Advantages of Custom Entities

  • Maximum flexibility for the data source
  • Seamless integration into RAP and Fiori Elements
  • Enables extensions beyond standard CDS capabilities
  • Ideal for special, non-table-based scenarios