Reject bad input; derive predictable values
A requested amount must be positive. Separately, a new request can start with an initial status. RAP provides different extension points for these jobs:
- A validation checks data and can report an error that prevents the transaction from saving.
- A determination derives or adjusts data at a defined point in the interaction/save lifecycle.
Declare the trigger conditions
validation validateAmount on save {
create;
field RequestedAmount;
}
determination setInitialStatus on modify {
create;
}
These declarations belong in a behavior definition. Their implementations live in a behavior pool and must populate RAP response information correctly. The exact trigger and implementation logic should follow the BO contract; don’t put a rule in a determination just because it changes data.
For complex behavior, use focused methods and add ABAP Unit coverage. Syntax and available trigger additions depend on the target release.
Sources
- SAP Samples: RAP BDEF validations and determinations
- ABAP Keyword Documentation: RAP validations and determinations
Developer practice · ABAP
Practice: validate a requested quantity
Declare a save-time validation for create operations on RequestedAmount and a determination on create.
Complete the task using the syntax and structure described above. Variable names can differ if you use them consistently. This browser checker checks structure only; it does not compile or run ABAP.
0 required structures detected · 0 checks
Write your solution, then check its structure.
One possible solution
validation validateAmount on save {
create;
field RequestedAmount;
}
determination setInitialStatus on modify {
create;
}