RAP validation versus determination: Check data or derive data?
A custom manufacturing request calculates a derived amount while also checking whether entered values satisfy the business rules.
START HERE · NO PRIOR TOPIC KNOWLEDGE NEEDED
What it is. Why it matters.
A validation checks whether business data is acceptable. A determination calculates or sets derived data, so checking a value and supplying a value are different jobs.
Completely new to SAP?
Manufacturers use SAP to connect work such as buying components, recording inventory, planning production, shipping equipment and accounting for costs. SAP S/4HANA is an enterprise resource planning system: it connects these activities through shared business data.
ABAP is SAP’s programming language for business applications. A program reads data, applies rules and produces a result. Start with the objects involved before investigating code.
A transaction code, or t-code, is a shortcut to a task in classic SAP GUI. Fiori apps provide another way to work. Names and screens depend on the product and release; you do not need a live system to learn the concepts in this guide.

Scope and source-review notes
Scope and evidence
Source review by FAST SAP SOLUTIONS® editorial. This badge describes our editorial review; it does not represent SAP certification or independent endorsement.
RAP determinations and validations in compatible managed scenarios; trigger availability, draft paths and runtime optimizations depend on backend release.
Primary documentation reviewed on 14 November 2026 using official indexed excerpts. Documentation review only; authored examples were not compiled or executed in an SAP system.
A MANUFACTURING EXAMPLE
Separate derived order values from rejection rules
Supply a value or check one?
Read the example values
- Derived total
- Calculated from items
- Required customer
- Must be provided
- Determination purpose
- Derive relevant data
- Validation purpose
- Reject unacceptable state
Words you’ll meet in this guide
- Program
- A set of instructions executed by a computer.
- Class
- A reusable unit that groups data with operations called methods.
- Database
- Organized information kept beyond one program execution.
- Internal table
- A list of rows held temporarily in an ABAP program’s memory.
- Key
- One or more fields used to identify or find a record.
- RAP
- ABAP RESTful Application Programming Model: a way to build business objects and services.
- API
- A defined interface through which programs exchange data or request actions.
Preview the practical steps
SEE THE CONNECTION
See it in a simple example.
A small example to make the idea concrete.
Separate derived order values from rejection rules
A custom manufacturing request calculates a derived amount while also checking whether entered values satisfy the business rules.
Use a determination to derive state and a validation to reject unacceptable state
A RAP determination supplies or recalculates business-object values when its declared trigger conditions apply.
Scope and prerequisites
The examples target a supported managed RAP business object with compatible on-modify determinations and on-save validations.
Worked case: quantity, price and discount
Fictional item I10 has Quantity 10 PC, UnitPrice 5 EUR/PC and DiscountPct 10.
Separate derived order values from rejection rules
A custom manufacturing request calculates a derived amount while also checking whether entered values satisfy the business rules.
Place derivation and rejection in the appropriate documented behavior and test both valid and invalid inputs.
| Reader | Business question | Evidence to carry forward |
|---|---|---|
| SAP developers and application teams supporting manufacturers | Separate derived order values from rejection rules | Place derivation and rejection in the appropriate documented behavior and test both valid and invalid inputs. |
01 Use a determination to derive state and a validation to reject unacceptable state
A RAP determination supplies or recalculates business-object values when its declared trigger conditions apply. A validation checks whether the relevant state is acceptable and reports failed instances and messages under its contract. Deriving a total and rejecting an invalid quantity are separate responsibilities even when they read the same fields. [1] [2]
Start with the business rule, then choose behavior and timing. This tutorial calculates a discounted item total and validates quantity/discount inputs, including repeated execution, draft feedback and save-time rejection. It shows why a UI refresh or a mandatory-looking field is not sufficient evidence that the backend invariant is protected.
02 Scope and prerequisites
The examples target a supported managed RAP business object with compatible on-modify determinations and on-save validations. Managed, unmanaged, active and draft scenarios differ; verify BDL availability and implementation rules for the actual backend. Runtime optimizations can also change how often a rule executes, so correctness must not depend on a particular observed call count. [3]
You need access to behavior definitions, the behavior pool and an authorized development fixture. Understand EML reads/changes and RAP failed/reported response concepts. The partial BDL and algorithms below are illustrative and have not been compiled or executed in a customer system. No external notification or posting belongs to this calculation exercise.
03 Worked case: quantity, price and discount
Fictional item I10 has Quantity 10 PC, UnitPrice 5 EUR/PC and DiscountPct 10. The rule calculates NetAmount = Quantity × UnitPrice × (1 − DiscountPct/100), giving 45 EUR. Editing Quantity to 12 gives 54 EUR. All values share compatible unit/currency context in this simplified fixture, and rounding policy must be specified for real amounts.
The acceptance rules require Quantity greater than 0 and DiscountPct between 0 and 100 inclusive. A quantity of 0 is rejected even though multiplication could produce a mathematical zero. A discount of 110 is rejected rather than producing a negative payable amount. Keep the arithmetic function and acceptance decisions explicit; a determination should not silently repair 110 to 100 unless the business contract deliberately requires that behavior.
| Quantity / price / discount | Derived amount if valid | Expected acceptance |
|---|---|---|
| 10 /5 EUR /10% | 45 EUR | Valid |
| 12 /5 EUR /10% | 54 EUR | Valid |
| 0 /5 EUR /10% | Not accepted | Quantity rule fails |
| 12 /5 EUR /110% | Not accepted | Discount rule fails |
| 12 /5 EUR /100% | 0 EUR | Boundary valid under stated policy |
04 Declare triggers that cover every input dependency
The calculation depends on Quantity, UnitPrice and DiscountPct. If the determination triggers only on Quantity, changing the price can leave a stale amount. Include creation and all relevant field-change triggers according to supported syntax. A rule's method name does not cause the framework to infer its dependencies. [1] [2]
The validation declarations identify the fields and create/save conditions that need checking. Choose broader operation triggers when the rule depends on relationships or state that cannot be captured by one changed field. Review deletion and child-parent effects separately. A root total depending on items needs the appropriate modeled orchestration; a root determination cannot simply declare arbitrary child fields as its own trigger fields.
determination deriveNetAmount on modify
{ create; field Quantity, UnitPrice, DiscountPct; }
validation validateQuantity on save
{ create; field Quantity; }
validation validateDiscount on save
{ create; field DiscountPct; }
// Mark derived output read-only to consumers where appropriate:
field ( readonly ) NetAmount;05 Recompute from authoritative inputs rather than accumulating again
A stable determination reads current instance values and computes the resulting NetAmount from those inputs. It should not blindly add another discount or quantity delta to an already derived amount each time it executes. Repeated invocation with the same valid inputs should leave 54 EUR, not reduce it to 48.60 after applying 10% twice.
Use a shared pure calculation where useful so tests can exercise arithmetic independently of RAP orchestration. Keep business context such as currency, unit and rounding explicit. Write the derived fields through the supported RAP modification path and avoid unnecessary writes when the value is unchanged where the contract permits. Do not create circular trigger chains that keep changing each other's inputs.
read current Quantity, UnitPrice, DiscountPct and currency/unit context
if inputs are calculable under the model:
newAmount = Quantity * UnitPrice * (1 - DiscountPct /100)
apply the defined currency/rounding policy
update only the intended derived amount through supported RAP logic
else:
retain an explicit invalid-input condition for validation as needed
Repeat with 12,5,10 ->54 every time
Do not apply 10% repeatedly to the previous 5406 A validation reports failure instead of changing the input
Read the relevant transactional instance state and evaluate the invariant. For invalid Quantity, add the affected instance to the appropriate failed response and attach an explanatory message to the relevant field through reported. A message alone is not a substitute for a failed outcome when the operation must be rejected. [2]
Do not correct Quantity to 1 from inside a validation just to allow saving. That mixes acceptance and derivation and can violate the read-only validation contract. If defaulting a missing quantity is a legitimate business requirement, model that separately and still validate the final state. SAP's modeling guidance also notes that determinations do not have a failed response; validation must handle relevant negative calculation conditions explicitly. [1]
07 Read transactional state and keep draft/active handling consistent
A database SELECT can miss changes already present in the RAP transactional buffer. Use the supported RAP read pattern for the rule's context, including local-mode semantics only where appropriate inside the owning behavior pool. Preserve technical instance identity and draft indicators rather than manually forcing all inputs into active state. [1]
The reviewed modeling guidance requires runtime-independent behavior for rules used in different phases. A validation called through a determine action should not decide differently solely because it ran during interaction rather than save. If draft completeness rules differ from activation rules, model that distinction deliberately and document the actual supported trigger path instead of adding hidden phase-dependent shortcuts. [1]
08 Immediate UI feedback and final save protection are complementary
A determination on modify can make a derived value available after an edit, while side effects can coordinate refresh of the dependent field. A determine action can expose selected supported validations for immediate feedback in a draft UI. These improve usability but do not replace the business object's final acceptance rules.
Test direct service and EML consumption as appropriate. A user should not be able to bypass Quantity validation by sending the API request without triggering the UI feedback path. Conversely, a stale displayed amount does not prove the determination failed; inspect the same draft/backend state before changing rule timing. Keep calculation, validation and refresh evidence separate.
09 Troubleshooting rule timing and inconsistent state
Inspect the declaration, actual trigger input and current transactional state before adding another rule. More handlers can create conflicting responsibilities rather than fix a missed dependency.
| Observation | Question | Next evidence |
|---|---|---|
| Price change leaves amount stale | Is UnitPrice a trigger? | BDEF dependencies and current buffer |
| Amount changes again on repeated trigger | Does logic accumulate from old result? | Pure calculation versus incremental mutation |
| Error message shown; save still succeeds | Was failed response populated? | Validation outcome and persisted state |
| Validation changes input | Acceptance and derivation mixed? | Handler implementation contract |
| Draft correct; activation differs | Phase/draft shortcuts or incomplete trigger? | Same fixture across supported paths |
| Rules run fewer times after upgrade | Runtime optimization changed? | Release notes and final-state assertions |
| External notification sent before rollback | Wrong lifecycle hook? | Supported post-save/event design |
10 Verify derivation, rejection and repeated execution
The positive fixture changes Quantity 10 to 12 and expects 54 EUR. Change UnitPrice to 6 and expect 64.80 EUR at the same 10% discount. Repeat the supported trigger with unchanged inputs and expect no further change. These assertions detect missing dependencies and repeated-discount defects.
Negative checks use Quantity 0, a negative quantity and DiscountPct 110, confirming failed instance/message behavior and no accepted invalid active state. Boundary checks use 0% and 100% discount, an empty instance set and a mixed multi-instance request containing valid and invalid records. Verify the documented transaction outcome rather than assuming all instances always commit or roll back together. These tests remain proposals until executed.
11 Save notifications and performance need the right lifecycle
An on-save determination can execute before the final durable outcome and can run under framework optimization rules. Do not send an irreversible external notification there merely because its name includes save. SAP's modeling guidance directs saved-change notification logic to an appropriate provider implementation after the save sequence's point of no return, such as the documented additional-save context. [1]
For performance, read needed fields in suitable sets rather than repeating a lookup per key, while preserving each instance's messages and identity. Profile actual behavior if a rule is expensive. Optimizing away a validation because it appears redundant can weaken a business invariant; optimize the read/calculation design while preserving its acceptance contract.
12 Frequently asked questions
Can a validation supply a default? Keep value derivation/defaulting separate from the read-only acceptance check.
Can a determination reject an instance? It has no failed response under the documented model; represent relevant invalid conditions for validation and follow the supported rule design.
Should I rely on a fixed rule order or call count? No. Make results stable and dependencies explicit, and test final state across supported runtime paths.
Why is a correct total still stale on screen? The client may need a declared dependent refresh. Inspect backend state before changing calculation logic.
What belongs in review? Formula, rounding and units; trigger fields; validation invariants; failed/reported mapping; draft/active context; repeated-execution tests and actual saved-state evidence.
Related services and next steps
Primary sources
Found this useful?
Share this guide with your network, or leave a like.
Your like is saved in this browser.