RAP Build-Along Part 5: Projection Views and Fiori Elements UI Annotations
Preview · a free account unlocks the full lesson
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 sectionsHide sections
Visual overview
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.
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
More lessons in this topic
- RAP Basics Part 1: RAP Architecture — Layers, Artifacts and When RAP Fits
- RAP Basics Part 10: EML — Entity Manipulation Language
- RAP Basics Part 11: Draft, Locking and Authorization
- RAP Basics Part 2: Data Model Design — Tables, Keys, Administrative Fields and Interface Views
- RAP Basics Part 3: Projection Layer and Metadata Extensions
- RAP Basics Part 4: Implementation Types — Managed, Unmanaged, Additional Save and Unmanaged Save
- RAP Basics Part 5: Root Entity, Child Entity and Composition
- RAP Basics Part 6: Behavior Definition — CRUD, Field Control and Features
Interview questions on this topic
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.