Skip to content

Projection Layer

Ankit Kumar Singh edited this page Sep 9, 2025 · 1 revision

πŸ“ Projection Layer

The Projection Layer defines which fields and associations from the Interface Layer are exposed to consumers (UI or service layer).
It acts as the public contract of the business objectβ€”hiding internal details and exposing only what's needed for applications.

In this project, projection views are created for:

  • Root Vehicle Interface
  • Trip Interface
  • Maintenance Interface

πŸš› Root Projection: Vehicle

The root projection is based on the root interface view ZAKS_I_ROOT_VEHICLE.
It exposes vehicle master data along with compositions for Trips and Maintenance.

Example

@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Projection View -- Root Interface'
@Metadata.ignorePropagatedAnnotations: true
@Metadata.allowExtensions: true
define root view entity ZAKS_P_ROOT_VEHICLE as projection on ZAKS_I_ROOT_VEHICLE
{
    key VehicleUUID,
    key VehicleId,
    RegdNo,
    VehicleType,
    Brand,
    Model,
    PurchaseDate,
    @Semantics.amount.currencyCode: 'Currency'
    CostPrice,
    Currency,
    FuelType,
    Capacity,
    CapacityUnit,
    Status,
    Plant,
    CreatedBy,
    CreatedOn,

    /* Associations */
    _Maintenance : redirected to composition child ZAKS_P_CDS_MAINTENANCE,
    _Trip        : redirected to composition child ZAKS_P_CDS_TRIP
}

Key Highlights:

  • VehicleUUID and VehicleId are the technical keys.
  • Cost fields are annotated with @Semantics.amount.currencyCode for proper UI handling.
  • Associations are redirected to child projections (_Maintenance, _Trip).

🚌 Projection: Trip

The trip projection is created on the trip interface view ZAKS_I_CDS_TRIP.
It exposes trip details, including the computed total_trip_cost, and links back to the parent vehicle.

Example

@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Projection View -- CDS Interface (Trip)'
@Metadata.ignorePropagatedAnnotations: true
@Metadata.allowExtensions: true
define view entity ZAKS_P_CDS_TRIP as projection on ZAKS_I_CDS_TRIP
{
    key TripUUID,
    key TripId,
    VehicleUUID,
    VehicleId,
    DriverId,
    Origin,
    Destination,
    StartDate,
    EndDate, 
    DistanceKm,
    @Semantics.amount.currencyCode: 'Currency'
    total_trip_cost,
    Currency,
    CargoType,
    CreatedBy,
    CreatedOn,

    /* Associations */
    _Vehicle : redirected to parent ZAKS_P_ROOT_VEHICLE
}

Key Highlights:

  • TripUUID and TripId are the technical keys.
  • Exposes the computed field total_trip_cost from CDS.
  • Association _Vehicle is redirected to the parent vehicle projection.

πŸ”§ Projection: Maintenance

The maintenance projection is created on the maintenance interface view ZAKS_I_CDS_MAINTENANCE.
It exposes maintenance history details and links back to the parent vehicle.

Example

@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Projection View -- Maintenance Interface'
@Metadata.ignorePropagatedAnnotations: true
@Metadata.allowExtensions: true
define view entity ZAKS_P_CDS_MAINTENANCE as projection on ZAKS_I_CDS_MAINTENANCE
{
    key MaintUUID,
    key MaintId,
    VehicleUUID,
    VehicleId,
    ServiceDate,
    ServiceType,
    WorkshopName,
    @Semantics.amount.currencyCode: 'Currency'
    ServiceCost,
    Currency,
    OdometerReading,
    PartsChanged,
    WarrantyClaim,
    NextServiceDate,
    MaterialNumber,
    VendorNumber,
    CreatedBy,
    CreatedOn,

    /* Associations */
    _Vehicle : redirected to parent ZAKS_P_ROOT_VEHICLE
}

Key Highlights:

  • MaintUUID and MaintId are the technical keys.
  • Cost fields are annotated with @Semantics.amount.currencyCode.
  • Association _Vehicle is redirected to the parent vehicle projection.

πŸ”‘ Takeaways

  • The Projection Layer filters and shapes data from the interface views for service exposure.
  • Root Vehicle Projection exposes all relevant vehicle fields and compositions.
  • Child Projections (Trip & Maintenance) redirect back to the parent vehicle, maintaining navigational integrity.
  • Semantic Annotations (e.g., @Semantics.amount.currencyCode) ensure correct representation in Fiori/UI for amounts and currencies.

πŸ‘‰ Next: 🎨 UI Annotations

Clone this wiki locally