SAP Fiori裡的兩種鎖機制
Approach 1: ETAG mechanism
This approach is used in SAP CRM Fiori. Suppose user Jerry has opened a given opportunity with ID = 3456 and clicked the Edit button:
A read operation is fired and sent to ABAP backend:
We can observe in Chrome development tool that the ETAG field of HTTP response header is filled accordingly.
This ETAG value ending up with “26AE” is actually calculated by application. The common calculation logic is to either leverage the last changed timestamp of OData model node being read, see example below:
or use the calculated HASH value based on the whole content of model node:
Now say another user has changed this opportunity and saved the change successfully. Jerry was not aware of it at all, he just changed the opportunity, and pressed the Save button.
And Jerry saw this error message: Data has been changed by another user. Choose OK to retrieve the latest data.
Open Chrome Development Tool again, and we can find that once Jerry has pressed the Save button, a batch request is sent to ABAP backend whose request header contains one field If-Match. This field is filled with the very ETAG value got from the response header field ETAG of the first read request ( which ends up with 26AE ).
What has happened under the hood? A comparison between latest ETAG and the ETAG passed by Fiori UI is made in method CHECK_BEFORE_MODIFICATION:
CHECK_BEFORE_MODIFICATION will delegate to method CHECK_ETAG_MATCH in line 57. If check fails, the save will not be performed at all.
Approach 2: lock mechanism based on BOPF
This logic is used in S/4HANA Fiori application, such as Material application, which consumes OData service implemented on top of CDS view plus BOPF. Open one Material and press Edit button:
Now locks related to a series of Material tables could be found in tcode SM12:
In S/4HANA backend system, launch tcode BOBX to open BO model with name I_PRODUCTWD. Navigate to Edit action and double click, to find implementation class CL_I_DR_PRODUCTWD.
It’s responsible for method LOCK_ACTIVE_DOCUMENT to react on the Edit button click in Fiori UI.
Set a breakpoint on it, click Edit button and breakpoint is triggered. From the callstack we can clearly know how the execution flow is delegated from BOPF framework code to Material application code. The acutal enqueue operation is achieved by the enqueue function module owned by Material application.
要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2703959/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 如何分辨 SAP Fiori Launchpad 裡的真假 Fiori 應用
- Mysql各種鎖機制MySql
- SAP CAP Fiori Elements 應用配置 UI 的兩種方式以及自定義 index.htmlUIIndexHTML
- SAP Fiori Elements 應用裡和 Fiori 3 相關的外觀設定
- SAP Cloud for Customer和SAP Fiori系統裡的OData測試工具Cloud
- SAP Fiori裡Contact Support的按鈕渲染邏輯
- SAP Fiori Elements裡Drop down list的實現原理
- SAP Commerce Cloud 裡 OAuth2 Client 的兩種配置方法CloudOAuthclient
- SAP Fiori Launchpad 應用的兩個實用技巧分享
- 如何讓SAP S/4HANA的Material Fiori應用配置到Fiori Launchpad裡
- redis的RDB和AOF兩種持久化機制Redis持久化
- SAP ABAP, Fiori, Android和Hybris裡的非同步操作Android非同步
- SAP Fiori應用裡日期格式的顯示奧祕
- SAP Fiori Elements 裡 Smart Table column 的寬度問題
- 如何在SAP Fiori應用裡使用React componentReact
- SAP Fiori + Vue = ?Vue
- SAP CDS view自學教程之八:SAP Fiori Elements裡不同型別的annotationView型別
- SAP Fiori應用索引大全工具和 SAP Fiori Tools 的使用介紹索引
- mysql myisam的鎖機制MySql
- Mysql中的鎖機制——MyISAM表鎖MySql
- 把經典的ABAP webdynpro應用配置到SAP Fiori Launchpad裡Web
- SAP Fiori應用裡出現http request錯誤的原因分析HTTP
- SAP CRM WebUI, CRM Fiori和C4C裡的Direct NavigationWebUINavigation
- SAP Fiori 應用裡圖示(Icon)的渲染原理和使用技巧
- SAP Fiori Elements 應用裡的 Title 顯示的內容是從哪裡來的
- SAP Fiori裡的List是如何做到懶載入Lazy load的
- SAP Fiori 簡介
- SAP Fiori Elements 概述
- PHP 鎖機制PHP
- SQLite鎖機制SQLite
- 一步步把SAP GUI的事務碼配置到SAP Fiori Launchpad裡GUI
- 如何把SAP UI5應用部署到SAP雲平臺的Fiori Launchpad裡去UI
- 鎖機制到加鎖的必要性
- SAP Fiori Belize 主題應用在 SAPGUI 裡的一些要點GUI
- SAP Fiori Elements 框架裡 Smart Table 控制元件的工作原理介紹框架控制元件
- SAP Fiori image的顯示原理
- SAP Fiori 的 UI 新主題 HorizonUI
- 【MySQL】MySQL中的鎖機制MySql