Managed RAP Part 5: Projection Layer, Testing, Performance and Clean Core
Preview · a free account unlocks the full lesson
Take the Purchase Request object to production: build the projection layer that services consume, write ABAP Unit tests with EML, avoid the common performance traps in handlers, and keep the design clean-core compliant.
In this lessonShow sectionsHide sections
Visual overview
Explanation
You now have a complete business object, ZR_PurchReq, with items, numbering, locking, authorization, workflow and draft. This last part covers what separates a working demo from a production object: a stable projection layer for consumers, automated tests, performance, and clean-core rules.
Never expose the ZR_ views directly in a service. Instead put a projection layer, built from ZC_ views, between the business object and its consumers. The base BO (ZR_) holds all fields and all behavior and is reused by every consumer.
A projection (ZC_) exposes only what one specific app or API needs: a subset of fields, a subset of operations and actions, UI annotations, value helps, and search.
Several projections can sit on one BO — for example ZC_PurchReq for the Fiori app and ZA_PurchReq for an API that only allows reads and approvals — and each projection can change without touching the core behavior.
Building the projection follows a fixed sequence. First comes the projection root view: "define root view entity ZC_PurchReq provider contract transactional_query as projection on ZR_PurchReq", where the provider contract transactional_query marks it as a projection for transactional services.
Next, compositions need to be redirected: in the root, "_Item : redirected to composition child ZC_PurchReqItem", and in the child, "_Request : redirected to parent ZC_PurchReq" — without this redirection the projection would still point back to the base views.
Adding @Metadata.allowExtensions: true lets UI annotations live in a separate metadata extension, as covered in the Service Bindings Part 6 lesson.
The projection also needs its own behavior definition — right-click ZC_PurchReq and choose New Behavior Definition — which starts with "projection;" and "use draft;" and then lists only the operations this app may use, such as "use create; use update; use action approve;". Anything not listed stays unavailable to this consumer even though the base BO supports it.
Finally, the service layer takes over: a service definition exposes ZC_PurchReq and ZC_PurchReqItem, and a service binding publishes it as OData V4, exactly as walked through step by step in the Service Bindings series using these same objects.
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
Interview questions on this topic
Referenced SAP objects
Reviewed reference pages for the objects this page mentions.
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.