BTP CAP Part 7: OData Services, Actions, Functions and Draft
Preview · a free account unlocks the full lesson
Expose rich OData V4 services with CAP: bound and unbound actions and functions, draft-enabled entities for Fiori elements editing (@odata. draft. enabled), side effects and value helps via annotations, and pitfalls with draft (validation timing, handlers on drafts).
In this lessonShow sectionsHide sections
Visual overview
Explanation
Part 6 added handlers to CAP services; this part covers the richer OData features — actions, functions and draft handling — that Fiori elements apps rely on. Actions change data and are called with POST; functions read or calculate something and are called with GET; both kinds can be bound to a specific entity or left unbound.
Adding the @odata.draft.enabled annotation gives Fiori elements multi-step editing, where in-progress changes are saved as a draft on the server rather than committed immediately.
Draft introduces its own lifecycle events — NEW, EDIT, PATCH and SAVE (which activates the draft) — and validations are normally run on SAVE rather than on every intermediate PATCH, since validating every keystroke-level change would frustrate users. Annotations more broadly provide value helps, side effects and UI layout information that Fiori elements consumes directly.
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
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.