ERPClimb logoERPClimb
Service Definitions
RAP / CDS / ODataadvanced 8 min read

Service Definitions Part 5: UI vs Integration APIs — Reuse or Separate?

Preview · a free account unlocks the full lesson

Key takeaway

Decide whether a Fiori app and an integration API should share one service or have separate ones, and how to structure projections, BDEFs, services and bindings for each.

In this lessonShow sections

Visual overview

Service Definitions Part 5: UI vs Integration APIs — Reuse or Separate? — learning sheetFlow: Keep the base BO unchanged → Create ZA_ projections and a projection BDEF without draft (code example) → Create ZAPI_PURCHREQ and bind it as OData V4 – Web API → Test with an HTTP client: create a request with items in one call, approve it. Key ideas: HOW THE CONSUMERS DIFFER; THE STRUCTURE; WHY NOT SHARE?; WHEN SHARING IS ACCEPTABLE. Watch out: Sharing one service couples UI changes to integration contracts.ERPClimb.com / RAP / LESSON 5/6 / LEARNING SHEETService Definitions Part 5: UI vs Integration APIs — Reuseor Separate?1 · HOW IT FLOWS1Keep the base BOunchanged2Create ZA_projections anda projection…3CreateZAPI_PURCHREQand bind it as…4Test with anHTTP clientcreate a request withitems in one call…2 · KEY IDEAS EXPLAINEDHow The Consumers DifferUsers edit over time → draft.Needs UI annotations, value helps, text fields,side effects.The StructureUI: ZC_PurchReq (+ projection BDEF with "usedraft"), metadata extension, serviceZUI_PURCHREQ, binding ZUI_PURCHREQ_O4 (OData V4 –…API: ZA_PurchReq (+ projection BDEF without draft,only create/update/approve), serviceZAPI_PURCHREQ, binding ZAPI_PURCHREQ_O4 (OData V4…Why Not Share?Draft in an API makes clients handle draft actions— unnecessary complexity.UI-driven field additions or label changes wouldalter the API contract.When Sharing Is AcceptableSmall internal read-only services used by one appand one internal report may share — if both areowned by the same team and change together…3 · REMEMBER · WATCH OUTRememberSame business object, different consumers → separate projections andservice definitions.UI service: draft, UI annotations, value helps, side effects; binding"OData V4 – UI".API service: no draft, stable contract, only needed operations;binding "OData V4 – Web API".!Watch outSharing one service couples UIchanges to integration contracts.4 · IN A REAL PROJECTA company exposed its Fiori UI service (with draft) to an external procurement tool. The tool's developers hadto implement Edit, Prepare and Activate calls, and every UI release that added a field broke their mapping.The team created a separate Web API service without draft on the same BO, with only create, update and…Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

When the same business object has different kinds of consumers, the right answer is separate projections and service definitions for each. A UI service typically needs draft, UI annotations, value helps and side effects, and binds as "OData V4 – UI." An API service typically has no draft, needs a stable contract, and exposes only the operations actually required, binding as "OData V4 – Web API." Sharing a single service between the two couples UI changes directly to integration contracts, which is a problem worth avoiding.

Parts 1 through 4 focused on a single service, but real business objects usually have at least two kinds of consumers: a Fiori app and some form of integration. This part explains why they end up with separate services.

The two consumer types differ in fundamental ways. A Fiori app has users editing data over time, which is exactly what draft exists for; it needs UI annotations, value helps, text fields and side effects, and it tends to change often as UX feedback comes in.

An integration API, by contrast, receives complete requests from other systems in one shot, so it has no use for draft; it needs a stable contract with clear errors and only the operations it actually requires, and it should change rarely and only in compatible ways.

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.