{"id":7473,"date":"2025-08-07T14:25:20","date_gmt":"2025-08-07T08:55:20","guid":{"rendered":"https:\/\/www.sapewmhelp.com\/?question=why-strict-2-is-used-in-behaviour-definition"},"modified":"2025-08-07T14:25:20","modified_gmt":"2025-08-07T08:55:20","slug":"why-strict-2-is-used-in-behaviour-definition","status":"publish","type":"question","link":"https:\/\/www.sapewmhelp.com\/?question=why-strict-2-is-used-in-behaviour-definition","title":{"rendered":"Why strict ( 2 ) is used in Behaviour definition"},"content":{"rendered":"<p>In <strong>SAP RAP (RESTful Application Programming Model)<\/strong>, the <code>strict ( 2 )<\/code> keyword in a <strong>behavior definition<\/strong> plays a crucial role in enforcing stricter syntax and semantics for RAP BO development.<\/p>\n<p>define behavior for ZI_MY_VIEW<br \/>\nstrict ( 2 )<br \/>\n&#8230;<\/p>\n<p><code>strict ( 2 )<\/code> activates the <strong>strict mode version 2<\/strong>, which enforces <strong>stronger design-time checks<\/strong> and <strong>stricter rules<\/strong> to help ensure the RAP application is <strong>upgrade-stable<\/strong>, <strong>future-proof<\/strong>, and <strong>consistent<\/strong>.<\/p>\n<p><strong>What <code>strict ( 2 )<\/code> Does<\/strong><\/p>\n<p>Here are the <strong>key restrictions\/enforcements<\/strong> introduced by <code>strict ( 2 )<\/code>:<\/p>\n<p><strong>1. No Implicit Features<\/strong><\/p>\n<p>You must <strong>explicitly declare<\/strong> everything. RAP will not assume default behavior.<\/p>\n<ul>\n<li>\n<p>E.g., actions, fields, operations must be explicitly defined.<\/p>\n<\/li>\n<\/ul>\n<p><strong>2. Field Control Must Be Explicit<\/strong><\/p>\n<p>Fields must be explicitly declared for update, mandatory, readonly, etc.<\/p>\n<p>field ( update ) my_field;<\/p>\n<\/p>\n<p>3. <strong>No Implicit Save<\/strong><\/p>\n<p>There is no automatic save of changes \u2014 save logic must be handled explicitly in the implementation class.<\/p>\n<p>4. <strong>Cleaner Contract<\/strong><\/p>\n<p>The behavior is more <strong>predictable<\/strong>, meaning the framework won&#8217;t &#8220;guess&#8221; developer intent. This leads to better maintainability.<\/p>\n<p>5. <strong>Future Compatibility<\/strong><\/p>\n<p>SAP intends to make <strong>strict ( 2 ) the standard mode<\/strong> going forward. Using it now ensures you&#8217;re aligned with the long-term RAP roadmap.<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","question-category":[175],"question_tags":[206,201,200,177],"class_list":["post-7473","question","type-question","status-publish","hentry","question-category-rap","question_tags-behaviour-definition","question_tags-btp","question_tags-rap","question_tags-sap"],"_links":{"self":[{"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=\/wp\/v2\/question\/7473","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=\/wp\/v2\/question"}],"about":[{"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7473"}],"wp:attachment":[{"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7473"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fquestion-category&post=7473"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fquestion_tags&post=7473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}