SAP / SAP Mid Level (3 to 8 yrs) Interview questions
How do you implement validations and determinations in RAP?
Validations and determinations are both declared in the behavior definition and implemented in the corresponding ABAP behavior implementation class, but they serve different purposes: a validation checks whether data is valid and can raise an error blocking the operation; a determination automatically derives or sets a field's value based on other data, without blocking anything.
" behavior definition validation validateAmount on save { field Amount; } determination setStatus on save { field Status; } " behavior implementation class METHOD validateAmount. LOOP AT keys INTO DATA(ls_key). IF ls_key-%data-Amount < 0. APPEND VALUE #( %key = ls_key-%key %msg = ... ) TO failed-salesorder. ENDIF. ENDLOOP. ENDMETHOD. METHOD setStatus. " automatically set Status field based on other data, e.g. Amount ENDMETHOD.
Both run automatically at defined trigger points (like on save) declared in the behavior
definition, without the consuming Fiori app needing to explicitly call them — the framework invokes them
at the right moment as part of the standard save/transaction sequence.
More Related questions...
