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

RAP Build-Along Part 6: OData V4 Service Binding and EML Testing

Preview · a free account unlocks the full lesson

Key takeaway

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 sections

Visual overview

RAP Build-Along Part 6: OData V4 Service Binding and EML Testing — learning sheetIn one line: 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.ERPClimb.com / ARCH / LESSON 6/9 / LEARNING SHEETRAP Build-Along Part 6: OData V4 Service Binding and EMLTesting1 · IN ONE LINEPart 6 of the RAP Bootcamp exposes the Travel + Booking BO through a service definition andOData 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…2 · KEY IDEAS EXPLAINED1| Artifact | Name | |---|---| | Service definition| `ZUI_RAP_TRAVEL` | | Service binding (OData V4 –UI) | `ZUI_RAP_TRAVEL_O4` | | EML test class(classrun) | `ZCL_RAP_TRAVEL_E2E` | | ABAP Unittest class | `ZTC_RAP_TRAVEL` (test class inbehavior pool or separate) |2A service definition lists which projectionentities are exposed and under which names. Aservice binding chooses the protocol and scenario(OData V2/V4, UI or Web API) and publishes theendpoint. Neither contains business logic.Validations, determinations, actions and…3*New* → *Business Services* → *Service Definition*`ZUI_RAP_TRAVEL`, referenced object`ZC_RAP_Travel`.4┏━━ CODE ━━━━━━━━━━━━ ┃ define serviceZUI_RAP_TRAVEL { ┃ expose ZC_RAP_Travel as Travel;┃ expose ZC_RAP_Booking as Booking; ┃ exposeI_Currency as Currency; // for value help, if used┃ } ┗━━━━━━━━━━━━━━━━━━━3 · DO · AVOIDBest practice!Common mistakeKeep service definitions thin: exposeprojection entities only.One binding per consumer type (UI, Web API).Always check `$metadata` after changes.✕Putting logic or restrictions into the servicelayer thinking it is "the API" — the…✕Forgetting to expose the child entity orvalue-help views in the service definition.✕Activating the binding but not publishing it(on-premise).4 · IN A REAL PROJECTAfter a transport to QAS, users reported that the Accept button had vanished. Developers spent a day changingUI annotations. Running the EML classrun in QAS showed the action worked, and `$metadata` still contained`acceptTravel` — but the metadata extension had not been included in the transport. Adopting the rule…Original ERPClimb learning sheet • Verify against your SAP release and edition
RAP OData V4 and EML workflow showing service binding, MODIFY ENTITIES, MAPPED FAILED REPORTED and COMMIT ENTITIES.
Diagnose RAP issues by separating OData exposure from EML interaction and the save sequence.View full-size

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.

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

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.