BlogBlogtypeA post on somebody's own site or a community platform. Nobody edits it after publication, so it dates from the day it was written.See every one →SAP CommunityPart 2 of 2

SAP Cloud Application Programming Model(CAP):カスタムロジックの実装 – Part 2

A walkthrough of implementing custom logic in a CAP Node.js service for the capire bookshop sample, registering before, on and after handlers around the generated CRUD service for its Books and Orders entities. The before handler validates an incoming order's amount and runs a transactional CQN UPDATE to decrement stock, raising a 400 or 409 through req.error when the amount is invalid or no rows match; an after handler on READ appends a discount note to overstocked books.

Where it sits

Explains
Error handlingCAPError handlingcapabilityTurning a failure into a response a client can act on — protocol-correct error payloads, correlation, and a boundary between internal detail and what a caller sees.Transaction managementCAPTransaction managementcapabilityDeciding where a unit of work begins and ends, and what travels with it: the database transaction that commits or rolls back around a request, the user, tenant and locale that every nested call inherits, and the work that must run outside the request in a transaction of its own. Distinct from [concurrency control](capability:concurrency-control), which is two writers on one record, and from [async processing](capability:async-processing), which is work that survives the commit.
Source
reachable

Who is behind it

rasaiauthor

In this series2

  1. 1
  2. 2
    SAP Cloud Application Programming Model(CAP):カスタムロジックの実装 – Part 2you are here

Properties

About this work

declared and crawled
Published
declared
Published on
declared
Views
crawled
2,629

For error-handling

on the edge
Applies in
authored
cap

More on this4

Group by
Piece, what it offersStill applies
Also explainingError handling4
Effective Axios Error Logging for Robust SAP Integrations
SAP Community, Sahil2508The reasoningA recipe
nothing recorded
Beginners Guide to Advanced Event Mesh
SAP Community, PriyankaChak
nothing recorded
Don't "let it crash", is this the new CAP guideline?
SAP Community, Dinu
nothing recorded
Messaging System for Transferring Error, Warning, and Information Messages from OData V4 Services to HTTP Client Applications
SAP Community, arley-triana-morinThe reasoningA recipeRunnable code
Core changed

Details

Graph5 edges
POINTS OUT →
explainsError handlingcapability, core and community
explainsTransaction managementcapability, core only
published onSAP Communitypublishing source
discovered viaSAP Communitycap-tag
Source
Type
blog
Published on
Host
community.sap.com
First seen
History1
  • Entered the atlasDiscovered via SAP Community · cap-tag.
For your agent
Ref
content:sap-cloud-application-programming-model-cap-part-2
JSON
/content/sap-cloud-application-programming-model-cap-part-2.json
MCP
Connecting an agent