Skip to content
OpenAgentSkill
Browsing is open · Catalog captured 2026-11-21 · Automatic updates and account services are paused.
Design & UI

cds-view-entities

Help with CDS (Core Data Services) view entity development including data modeling, annotations, associations, compositions, access controls, aggregate expressions, built-in functions, and input parameters. Use when users ask about CDS views, CDS view entities, CDS annotations, CDS associations, CDS compositions, CDS access control, CDS metadata extensions, data modeling in ABAP, define view entity, define root view entity, semantic annotations, UI annotations, or building CDS data models for RAP or analytical scenarios. Triggers include "create a CDS view", "define view entity", "add an association", "CDS annotation", "access control", "composition", "CDS hierarchy", "CDS aggregate", "CDS functions", or "data model".

likweitan · Static checks on file

Installation

Read the source and dependencies before running a command. Copying does not install or execute anything.

npx skills add likweitan/abap-skills --skill cds-view-entities

About this skill


name: cds-view-entities description: Help with CDS (Core Data Services) view entity development including data modeling, annotations, associations, compositions, access controls, aggregate expressions, built-in functions, and input parameters. Use when users ask about CDS views, CDS view entities, CDS annotations, CDS associations, CDS compositions, CDS access control, CDS metadata extensions, data modeling in ABAP, define view entity, define root view entity, semantic annotations, UI annotations, or building CDS data models for RAP or analytical scenarios. Triggers include "create a CDS view", "define view entity", "add an association", "CDS annotation", "access control", "composition", "CDS hierarchy", "CDS aggregate", "CDS functions", or "data model".

CDS View Entities

Guide for building semantic data models using ABAP CDS (Core Data Services) view entities in ABAP Cloud.

Workflow

  1. Determine the user's goal:

    • Creating a new data model (standalone or for RAP)
    • Defining relationships between entities (associations, compositions)
    • Adding annotations for UI, semantics, or analytics
    • Implementing access controls
    • Using expressions, functions, or parameters in CDS
  2. Identify the context:

    • Standalone CDS view vs. RAP BO data model
    • Root entity vs. child entity vs. projection view
    • Transactional (RAP) vs. analytical vs. read-only consumption
  3. Apply best practices:

    • Use CDS view entities (v2 syntax define view entity) — not legacy CDS views (define view)
    • Follow naming conventions (e.g., ZR_* for interface/BO views, ZC_* for consumption/projection views, ZI_* for reuse views)
    • Add appropriate annotations for metadata consumers (UI, OData, analytics)

CDS View Entity Syntax

Basic View Entity

@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Sales Order'
define view entity ZI_SalesOrder
  as select from zsalesorder
{
  key order_id       as OrderId,
      customer_id    as CustomerId,
      order_date     as OrderDate,
      net_amount     as NetAmount,
      currency_code  as CurrencyCode,
      status         as Status,
      created_by     as CreatedBy,
      created_at     as CreatedAt,
      last_changed_at as LastChangedAt
}

Root View Entity (for RAP)

@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Sales Order Root'
define root view entity ZR_SalesOrder
  as select from zsalesorder
  composition [0..*] of ZR_SalesOrderItem as _Item
{
  key order_uuid         as OrderUUID,
      order_id           as OrderId,
      customer_id        as CustomerId,
      order_date         as OrderDate,
      @Semantics.amount.currencyCode: 'CurrencyCode'
      net_amount         as NetAmount,
      currency_code      as CurrencyCode,
      status             as Status,

      @Semantics.user.createdBy: true
      created_by         as CreatedBy,
      @Semantics.systemDateTime.createdAt: true
      created_at         as CreatedAt,
      @Semantics.user.localInstanceLastChangedBy: true
      last_changed_by    as LastChangedBy,
      @Semantics.systemDateTime.localInstanceLastChangedAt: true
      last_changed_at    as LastChangedAt,
      @Semantics.systemDateTime.lastChangedAt: true
      last_changed_at    as LastChangedAt,

      _Item
}

Child View Entity

@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Sales Order Item'
define view entity ZR_SalesOrderItem
  as select from zsalesorder_item
  association to parent ZR_SalesOrder as _Order
    on $projection.OrderUUID = _Order.OrderUUID
{
  key item_uuid       as ItemUUID,
      order_uuid      as OrderUUID,
      product_id      as ProductId,
      quantity         as Quantity,
      @Semantics.amount.currencyCode: 'CurrencyCode'
      unit_price       as UnitPrice,
      currency_code    as CurrencyCode,

      @Semantics.user.createdBy: true
      created_by       as CreatedBy,
      @Semantics.systemDateTime.localInstanceLastChangedAt: true
      last_changed_at  as LastChangedAt,

      _Order
}

Projection View (Consumption Layer)

@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Sales Order Projection'
@Metadata.allowExtensions: true
define view entity ZC_SalesOrder
  as projection on ZR_SalesOrder
{
  key OrderUUID,
      OrderId,
      CustomerId,
      OrderDate,
      NetAmount,
      CurrencyCode,
      Status,
      CreatedBy,
      CreatedAt,
      LastChangedBy,
      LastChangedAt,

      _Item : redirected to composition child ZC_SalesOrderItem
}

Associations & Compositions

Association Types

TypeSyntaxUse Case
Regular associationassociation [0..1] to ZI_Customer as _Customer on ...Independent entities (e.g., master data lookup)
Compositioncomposition [0..*] of ZR_Child as _ChildParent-child with lifecycle dependency (RAP BO trees)
To-parent associationassociation to parent ZR_Parent as _Parent on ...Child → parent back-reference in compositions

Association Syntax

define view entity ZI_SalesOrder
  as select from zsalesorder
  association [0..1] to ZI_Customer as _Customer
    on $projection.CustomerId = _Customer.CustomerId
  association [0..*] to ZI_SalesOrderItem as _Item
    on $projection.OrderId = _Item.OrderId
{
  key order_id    as OrderId,
      customer_id as CustomerId,

      // Expose associations — required for consumption via ABAP SQL or OData
      _Customer,
      _Item
}

Using Associations in ABAP SQL

" Path expression — triggers LEFT OUTER JOIN by default
SELECT FROM zi_salesorder
  FIELDS OrderId,
         \_Custome
Read the complete source ↗