ERPClimb logoERPClimb
RAP Basics
Architect / Cross-trackintermediate 21 min read

RAP Build-Along Part 5: Projection Views and Fiori Elements UI Annotations

Preview · a free account unlocks the full lesson

Key takeaway

Part 5 of the RAP Bootcamp builds the consumer layer of the Travel + Booking app: projection views with redirected composition and parent association, a projection behavior that exposes only intended operations and actions, and metadata extensions that produce a Fiori Elements List Report and Object Page with a Booking table.

In this lessonShow sections

Visual overview

RAP Build-Along Part 5: Projection Views and Fiori Elements UI Annotations — learning sheetIn one line: Part 5 of the RAP Bootcamp builds the consumer layer of the Travel + Booking app: projection views with redirected composition and parent association, a projection behavior that exposes only intended operations and actions, and metadata extensions that produce a Fiori Elements List Report and Object Page with a Booking table.ERPClimb.com / ARCH / LESSON 5/9 / LEARNING SHEETRAP Build-Along Part 5: Projection Views and FioriElements UI Annotations1 · IN ONE LINEPart 5 of the RAP Bootcamp builds the consumer layer of the Travel + Booking app: projectionviews with redirected composition and parent association, a projection behavior that exposesonly intended operations and actions, and metadata extensions that produce a Fiori Elements…2 · KEY IDEAS EXPLAINED1| Artifact | Name | |---|---| | Projection rootview | `ZC_RAP_Travel` | | Projection child view |`ZC_RAP_Booking` | | Projection behavior |`ZC_RAP_Travel` (behavior definition, typeProjection) | | Metadata extension (root) |`ZC_RAP_Travel` | | Metadata extension (child) |…2At the end, once Part 6 exposes the service, thepreview shows a Travel list with filters, anobject page with header, general information,prices, and a Booking table, plus Accept/Rejectbuttons.3The interface layer (`ZI_`) is the reusable BO:all fields, all behavior. A projection (`ZC_`) isa consumer-specific view of it — for one app orone API. It can:4It cannot add business logic. All rules stay inthe BO. One BO can have several projections (forexample, a processor UI and a read-only analystUI, or a UI and a Web API), each exposing whatthat consumer may do.3 · DO · AVOIDBest practice!Common mistakeOne projection per consumer contract; neverexpose the interface layer directly.Expose only needed operations with `use`.Keep UI annotations in metadata extensions,not in the projection view.✕Not redirecting the composition/parentassociation to projection entities.✕Forgetting `use` for draft actions or customactions, so buttons never appear.✕`dataAction` names not matching the actionname exactly.4 · IN A REAL PROJECTA team built one projection and exposed every BO operation to both a processor Fiori app and an externalintegration. Integration users could suddenly trigger the Reject action. The fix was not UI hiding: theycreated a second projection with its own projection behavior that `use`d only create and read-by-association…Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

This part builds a projection root view ZC_RAP_Travel, a projection child view ZC_RAP_Booking, a projection behavior definition (type Projection) on ZC_RAP_Travel, and metadata extensions for both the root and child. Once Part 6 exposes the service, the preview will show a Travel list with filters, an object page with header, general information, prices, and a Booking table, plus Accept/Reject buttons. This assumes Part 4 is complete, with a working BO ZI_RAP_Travel that already has determinations, validations, actions, feature control, and authorization.

The interface layer (ZI_) is the reusable business object — all fields, all behavior. A projection (ZC_) is a consumer-specific view of it, built for one app or one API.

It can hide fields the app doesn't need, add consumer-specific annotations for search, value help, or UI, expose only a subset of operations and actions, and rename or denormalize text fields for display — but it cannot add business logic, since all rules stay in the BO.

One BO can have several projections, for example a processor UI and a read-only analyst UI, or a UI and a Web API, each exposing only what that particular consumer may do.

The projection root view is created as a new Data Definition named ZC_RAP_Travel, template "Define Projection View," referenced object ZI_RAP_Travel.

It reads define root view entity ZC_RAP_Travel provider contract transactional_query as projection on ZI_RAP_Travel — provider contract transactional_query (release-dependent, required in current releases for UI projections) states that this projection is consumed transactionally via OData. @Metadata.allowExtensions: true allows a metadata extension to attach to it; @Search.searchable: true and @Search.defaultSearchElement: true on a few fields enable the Fiori search box; and redirected to composition child ZC_RAP_Booking makes sure the composition points to the projection child rather than the interface child — otherwise the projection tree breaks.

The projection child view, ZC_RAP_Booking as a projection on ZI_RAP_Booking, uses define view entity rather than define root view entity, since it isn't a root, and _Travel : redirected to parent ZC_RAP_Travel redirects the parent association to the projection root. Its field list can be narrower than the interface's, as long as it keeps the key, the parent key, and anything actually shown in the UI.

Free account

Create a free account to keep reading

You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.

  • Full explanation
  • Code example
  • Real project scenario
  • Common mistakes
  • Best practices
  • Interview angle

One tap with Google works too. Every topic keeps its first lesson open to everyone.

Keep exploring

Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.