OData V4 Part 4: Actions, Functions and Batch Processing
Preview · a free account unlocks the full lesson
Call RAP business operations over OData V4: bound and unbound actions, actions with parameters, functions, draft actions, and $batch with change sets for atomic multi-step requests.
In this lessonShow sectionsHide sections
Visual overview
Explanation
Actions change data, so they're called with POST; functions only read data, so they're called with GET. A bound action is called on a specific entity, as in …/PurchaseRequest(…)/<namespace>.approve. $batch bundles several requests together, and a change set within it is processed atomically — all or nothing. The exact action name, including its namespace, always comes from $metadata, so that's the place to copy it from rather than guessing.
Parts 1 through 3 covered reading and CRUD. Business APIs also need commands like approve, reject or copy, along with multi-step requests, and this part shows how RAP operations show up in OData V4.
Actions that change data are declared in the BDEF and selected in the projection BDEF with something like "use action approve;".
A bound, or instance, action is called with POST on the entity followed by the qualified action name — in RAP V4 services this name is namespaced, something like com.sap.gateway.srvd.zui_purchreq.v0001.approve, and the exact form should always be checked in $metadata. The result, when the action declares "result [1] $self", is the returned entity in the response body.
A static action, by contrast, is bound to the entity collection rather than an instance, as in POST …/PurchaseRequest/<namespace>.createFromTemplate, and a factory action of this kind returns the newly created instance.
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.