{"id":7192,"date":"2025-07-31T20:49:34","date_gmt":"2025-07-31T15:19:34","guid":{"rendered":"https:\/\/www.sapewmhelp.com\/?question=concurrency-control-etag-optimistic"},"modified":"2025-07-31T20:49:34","modified_gmt":"2025-07-31T15:19:34","slug":"concurrency-control-etag-optimistic","status":"publish","type":"question","link":"https:\/\/www.sapewmhelp.com\/?question=concurrency-control-etag-optimistic","title":{"rendered":"Concurrency Control: eTag ( Optimistic )"},"content":{"rendered":"<p><strong>Concurrency <\/strong>in SAP RAP (RESTful ABAP Programming Model) refers to handling situations where multiple users try to modify the same data simultaneously \u2014 a classic case of the <em>&#8220;lost update problem.&#8221;<\/em><\/p>\n<p>SAP RAP provides built-in mechanisms to ensure data consistency, conflict detection, and safe updates, especially in Fiori apps or other UI\/front-end scenarios.<\/p>\n<p>We need to add the fields like timestamp in the database table.<\/p>\n<p>Book table &#8211;&gt;\u00a0 changedat<br \/>\n<img decoding=\"async\" class=\"content-img\" src=\"https:\/\/www.sapewmhelp.com\/wp-content\/uploads\/2025\/07\/Etag-table.png\" \/><\/p>\n<p>Then add the annotation in the CDS view Entity &#8211;&gt; interface<\/p>\n<p><img decoding=\"async\" class=\"content-img\" src=\"https:\/\/www.sapewmhelp.com\/wp-content\/uploads\/2025\/07\/etag-entity.png\" \/><\/p>\n<p>Now add eTag in the Behavior Definition<br \/>\n<img decoding=\"async\" class=\"content-img\" src=\"https:\/\/www.sapewmhelp.com\/wp-content\/uploads\/2025\/07\/etag-bdef.png\" \/><\/p>\n<p>And use the eTag in the Behavior projection<\/p>\n<p><img decoding=\"async\" class=\"content-img\" src=\"https:\/\/www.sapewmhelp.com\/wp-content\/uploads\/2025\/07\/etag-bdef-pr.png\" \/><\/p>\n<p>Output : when 2 users try to modify the same data fields at same time.<\/p>\n<p><img decoding=\"async\" class=\"content-img\" src=\"https:\/\/www.sapewmhelp.com\/wp-content\/uploads\/2025\/07\/etag-output.png\" \/><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","question-category":[175],"question_tags":[178,199,204,203,200,177],"class_list":["post-7192","question","type-question","status-publish","hentry","question-category-rap","question_tags-abap","question_tags-cds","question_tags-etag","question_tags-lock-object","question_tags-rap","question_tags-sap"],"_links":{"self":[{"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=\/wp\/v2\/question\/7192","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=7192"}],"wp:attachment":[{"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7192"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fquestion-category&post=7192"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/www.sapewmhelp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fquestion_tags&post=7192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}