SAP CRM One Order函数SAVE_EC的设计原理

简介: SAP CRM One Order函数SAVE_EC的设计原理

In previous blogs the READ and UPDATE logic of Opportunity header field Closing Date are explained:


Buffer logic in One Order header extension read

Logic of FILL_OW function module in One Order

Logic of CHANGE_OW function module in One Order

In this blog we will research what happens when end user clicks save button after Closing Date is changed in WebClient UI.

This time we use naming convention CRMSAVE_EC to list the function modules which will be responsible to trigger the persistence of the change into corresponding database table.


image.png

The corresponding function module for Opportunity header is: CRM_OPPORT_H_SAVE_EC

The research could be done from below report:

image.png

Execute the report via tcode SAT, and we can find out that the persistence of Opportunity header field consists of two steps:

(1) CRM_OPPORT_H_SAVE_EC


image.png

(2) Update function module CRM_OPPORT_H_UPDATE_DU

image.png

The left part of this blog will explain these two steps in more detail.

Step1: CRM_OPPORT_H_SAVE_EC

image.png

The reason why CRM_OPPORT_H_SAVE_EC is called during save is because it is registered as callback for event SAVE in order CRMV_EVENT:

image.png

Update on 2017-04-24 4:27PM in Walldorf

How this registration information is loaded in the runtime could be found from this wiki page.


This callback function module does not have any logic but directly delegates the call to CRM_OPPORT_H_SAVE_OB, which calls a generic function module CRM_ORDER_TABLE_SAVE to determine the kind of current change ( Insert, Update or Delete ) and call update function module CRM_OPPORT_H_UPDATE_DU to perform database change.

image.png

CRM_ORDER_TABLE_SAVE consists of the following steps:

(1) call CRM_OBJECT_NAMES_DETERMINE to get corresponding DDIC object names and update function module name for OPPORT_H.

(2) call CRM_ORDER_UPDATE_TABLES_DETERM to extract the detail changed data. In my example, 1 update operation is detected for OPPORT_H.

image.png

The change of closing date specified by code is already included in <RECORDS_TO_UPDATE>:

image.png

How this change detection is done?

First Opportunity header object buffer( latest data) is retrieved via CRM_OPPORT_H_GET_MULTI_OB:

image.png

Then database buffer is read via CRM_OPPORT_H_GET_MULTI_DB:

image.png

By comparison on these two buffer we can know the given opportunity has a change on Closing Date field in header level.


(3) CRM_ORDER_SET_OBJECTS_TO_SAVE

image.png

It simply inserts the guid of changed opportunity to be saved into a global internal table gt_guids_to_save.


(4) call update function module CRM_OPPORT_H_UPDATE_DU

image.png

Step2: CRM_OPPORT_H_UPDATE_DU

In my example report, the execution of this update function module is triggered by COMMIT WORK AND WAIT.

image.png

The corresponding OPEN SQL statement is executed according to changed data in INSERT, UPDATE or DELETE mode.

image.png

Further reading

I have written a series of blogs to explain how One Order API works. The blogs are written based on a simple scenario: read, change and save field “Closing Date” in Opportunity header level.


Buffer logic in One Order header extension Read


Change Scenario


CRM_ORDER_MAINTAIN


|- CRM_ORDER_MAINTAIN_MULTI_OW


|- CRM_ORDER_MAINTAIN_SINGLE_OW


|- CRM_ORDER_H_MAINTAIN_OW


|- CRM_OPPORT_H_MAINTAIN_OW


|- CRM_OPPORT_H_CHANGE_OW


|- CRM_OPPORT_H_READ_OB


|- CRM_OPPORT_H_FILL_OW


|- CRM_OPPORT_H_CHECK_OW


|- CRM_OPPORT_H_PUT_OB


|- CRM_OPPORT_H_PUBLISH_OW


Save Scenario


CRM_ORDER_SAVE


|- CRM_ORDER_SAVE_OW


|- CRM_EVENT_SET_EXETIME_MULTI_OW


|- CRM_OPPORT_H_SAVE_EC


|- CRM_ORDER_TABLE_SAVE


|- CRM_OBJECT_NAMES_DETERMINE


|- CRM_ORDER_UPDATE_TABLES_DETERM


|- CRM_ORDER_SET_OBJECTS_TO_SAVE


CRM_OPPORT_H_UPDATE_DU


Create Scenario


CRM_ORDER_MAINTAIN


|- CRM_ORDER_MAINTAIN_MULTI_OW


|- CRM_ORDER_MAINTAIN_SINGLE_OW


|- CRM_ORDER_H_MAINTAIN_OW


|- CRM_ORDERADM_H_MAINTAIN_OW


|- CRM_ORDERADM_H_CREATE_OW


|- CRM_OPPORT_H_MAINTAIN_OW


|- CRM_OPPORT_H_READ_OB


|- CRM_OPPORT_H_CREATE_OW


|- CRM_OPPORT_H_CHANGE_OW


Index table CRMD_ORDER_INDEX and its update logic


相关文章
|
1月前
|
API
在阿里云RPA中,你可以使用"SetForegroundWindow"函数来将SAP控件置顶
【2月更文挑战第28天】 在阿里云RPA中,你可以使用"SetForegroundWindow"函数来将SAP控件置顶
23 1
|
3月前
|
存储 前端开发
SAP UI5 federatedLogout 函数源代码分析
SAP UI5 federatedLogout 函数源代码分析
22 0
|
3月前
|
缓存 JavaScript 前端开发
如何理解 SAP UI5 的 sap.ui.define 函数?
如何理解 SAP UI5 的 sap.ui.define 函数?
47 0
|
23天前
什么是 SAP ABAP 里的 Subscreen
什么是 SAP ABAP 里的 Subscreen
16 1
什么是 SAP ABAP 里的 Subscreen
|
2月前
|
XML JavaScript 数据格式
SAP UI5 XML Preprocessor 的工作原理和 instructions 指令详解
SAP UI5 XML Preprocessor 的工作原理和 instructions 指令详解
28 0
|
2月前
SAP Fiori Elements 应用里图片字段(Image)的显示原理介绍试读版
SAP Fiori Elements 应用里图片字段(Image)的显示原理介绍试读版
17 0
|
2月前
|
前端开发
问题解答:SAP UI5 应用设置禁止被其他应用嵌入运行的工作原理解析试读版
问题解答:SAP UI5 应用设置禁止被其他应用嵌入运行的工作原理解析试读版
113 0
|
3月前
|
数据库
SAP ABAP 更新函数(Update Function Module)执行出错的原因分析试读版
SAP ABAP 更新函数(Update Function Module)执行出错的原因分析试读版
35 0
|
3月前
|
数据库
130. SAP ABAP 更新函数(Update Function Module)执行出错的原因分析
130. SAP ABAP 更新函数(Update Function Module)执行出错的原因分析
25 0
|
5月前
一个查看 SAP CRM One Order 运行时生成的应用日志(Application Log)的小工具
一个查看 SAP CRM One Order 运行时生成的应用日志(Application Log)的小工具
61 0