专栏首页Jerry的SAP技术分享SAP Fiori里的两种锁机制

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.

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 如何把一个ABAP视图添加到SAP GUI的收藏夹里

    The idea comes from Sougata Chatterjee’s anwser in this thread:

    Jerry Wang
  • 如何把ABAP视图添加到SAPGUI的收藏夹里

    Suppose I need to add the maintenance view COMV_PARTNER_FCT to my favorite list....

    Jerry Wang
  • 如何自行分析SAP WebClient UI开发环境里抛出的错误消息根源

    In this blog I will demonstrate how I resolve the error message “endless binding...

    Jerry Wang
  • Codeforces Round #408 (Div. 2)(A.水,B,模拟)

    A. Buying A House time limit per test:2 seconds memory limit per test:256 megaby...

    Angel_Kitty
  • 如何把一个ABAP视图添加到SAP GUI的收藏夹里

    The idea comes from Sougata Chatterjee’s anwser in this thread:

    Jerry Wang
  • Redis ZSET

    For the past 2 years I’ve been all about Redis, and something I’m continually ex...

    九州暮云
  • 如何把ABAP视图添加到SAPGUI的收藏夹里

    Suppose I need to add the maintenance view COMV_PARTNER_FCT to my favorite list....

    Jerry Wang
  • 用.NET Framework 2.0创建 Form设计器[翻译]

        这两天赶鸭子上驾,学习Form设计器,下面这篇在Msdn Magazine的文章可谓是经典,这两天学习了感觉还是做个翻译出来,更能够加强理解。对各位同...

    张善友
  • Hack the box: Bastion

    In conclusion, Bastion is not a medium box. But it would be easier to solve this...

    madneal
  • ​Linux 后门系列之 python3 反弹shell & 隐藏后门

    报错这一部分都是python本身代码的报错,并不是说可以作为分隔符。当然了,在某些场景下会有作用

    意大利的猫

扫码关注云+社区

领取腾讯云代金券