RAP Build-Along Part 6: OData V4 Service Binding and EML Testing
Preview · a free account unlocks the full lesson
Part 6 of the RAP Bootcamp exposes the Travel + Booking BO through a service definition and OData V4 UI service binding, validates $metadata, and tests the BO end to end with EML — read, modify, create by association, actions, MAPPED/FAILED/REPORTED, COMMIT ENTITIES at the outer boundary — plus how to tell BO failures from exposure or UI failures.
In this lessonShow sectionsHide sections
Visual overview
Explanation
This part builds a service definition ZUI_RAP_TRAVEL, a service binding ZUI_RAP_TRAVEL_O4 (OData V4 – UI), an EML test class (classrun) ZCL_RAP_TRAVEL_E2E, and an ABAP Unit test class ZTC_RAP_TRAVEL. It assumes Part 5 is already complete, with projections ZC_RAP_Travel and ZC_RAP_Booking, projection behavior, and metadata extensions all active.
A service definition simply lists which projection entities are exposed and under what names; a service binding chooses the protocol and scenario (OData V2/V4, UI or Web API) and publishes the endpoint. Neither one contains business logic — validations, determinations, actions, and authorization all live in the BO (Parts 3–4), while consumer restrictions live in the projection (Part 5). If behavior is wrong, the fix belongs in the BO or the projection, never in the service.
The service definition is created via New → Business Services → Service Definition, named ZUI_RAP_TRAVEL, referenced object ZC_RAP_Travel, and reads define service ZUI_RAP_TRAVEL { expose ZC_RAP_Travel as Travel; expose ZC_RAP_Booking as Booking; expose I_Currency as Currency; } — the comment next to I_Currency notes it's for value help, if used. The child needs to be exposed explicitly, or the _Booking navigation has no target entity set, and any value-help views referenced in annotations need to be exposed too.
The service binding is created by right-clicking the service definition and choosing New Service Binding, named ZUI_RAP_TRAVEL_O4, with binding type OData V4 – UI, then activating and pressing Publish. In SAP BTP ABAP Environment and S/4HANA Cloud, Publish registers the service locally in the dev system; in on-premise or private S/4HANA, Publish performs the service registration for the local gateway, though older releases required manual steps in /IWFND/V4_ADMIN, depending on release. The binding editor lists entity sets and navigations, and selecting Travel and choosing Preview opens the Fiori Elements preview.
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
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.