In SAP RAP (RESTful Application Programming Model), the strict ( 2 )
keyword in a behavior definition plays a crucial role in enforcing stricter syntax and semantics for RAP BO development.
define behavior for ZI_MY_VIEW
strict ( 2 )
…
strict ( 2 )
activates the strict mode version 2, which enforces stronger design-time checks and stricter rules to help ensure the RAP application is upgrade-stable, future-proof, and consistent.
What strict ( 2 )
Does
Here are the key restrictions/enforcements introduced by strict ( 2 )
:
1. No Implicit Features
You must explicitly declare everything. RAP will not assume default behavior.
-
E.g., actions, fields, operations must be explicitly defined.
2. Field Control Must Be Explicit
Fields must be explicitly declared for update, mandatory, readonly, etc.
field ( update ) my_field;
3. No Implicit Save
There is no automatic save of changes — save logic must be handled explicitly in the implementation class.
4. Cleaner Contract
The behavior is more predictable, meaning the framework won’t “guess” developer intent. This leads to better maintainability.
5. Future Compatibility
SAP intends to make strict ( 2 ) the standard mode going forward. Using it now ensures you’re aligned with the long-term RAP roadmap.