ERPClimb logoERPClimb
Managed RAP
RAP / CDS / ODataintermediate 21 min read

Managed RAP Part 3: Determinations, Validations, Actions and Feature Control

Preview · a free account unlocks the full lesson

Key takeaway

Give the Purchase Request real business behavior: default and calculated values with determinations, error checks with validations, a Submit/Approve/Reject workflow with actions, and state-based feature control.

In this lessonShow sections

Explanation

After Part 2, the Purchase Request has numbers, locks, ETags and authorization, but it still has no business rules: a request can be saved without a description, items can have zero quantity, and there's no approval workflow. This part adds the four behavior elements that carry business logic.

There are four tools, each suited to a different kind of rule. A determination is for when the system should calculate or default a value automatically, with nobody triggering it explicitly — setting the status to New on create, or recalculating the total when an item changes, are both examples.

A validation is for when the system should check a rule and reject the save if it's broken — a mandatory description, or a quantity that must be greater than zero. An action is for when the user or an API should explicitly trigger a business step, such as Submit, Approve or Reject.

And feature control decides whether an operation or action is currently allowed based on the instance's state — for example, Approve only being enabled when status is Submitted, or an approved request no longer being editable.

As a rule of thumb: if the user should press a button, it's an action; if it should just happen, it's a determination; if it should stop the save, it's a validation; and if it should grey out a button, it's feature control.

The status model for this example runs N (New) through Submit to S (Submitted), and from there through Approve to A (Approved) or through Reject to R (Rejected).

Determinations can run on modify or on save, and each one declares both when it runs and what triggers it. "on modify { create; }" runs immediately in the interaction phase as soon as an instance is created, so the user sees the result at once — even before saving, with draft — and this is how setInitialStatus works.

"on modify { create; field Quantity, Price; }" runs when an item is created or when Quantity or Price change; calculateTotal uses this on the Item entity and writes the total to the parent. "on save { create; }" runs once, during the save sequence, which is how setRequestID from Part 2 works.

Determinations must be idempotent — running twice has to produce the same result — which is exactly why setInitialStatus only sets the status when it's still in its initial state.

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.