SAP CRM索引数据库表CRMD_ORDER_INDEX的更新原理
For project reason I need to figure out the logic how fields in index table CRM_ORDER_INDEX are updated. For example, I have an opportunity with ID 21 and closing date 2017.03.25.
I get its guid 6C0B84B759DF1ED6BDF05763B3DC8841 from CRMD_ORDERADM_H and query CRM_ORDER_INDEX with this guid against field HEADER, 2 records found:
Most of the fields in these two records have the same value except fields like PARTNER_NO, which represent the two involved parties as found in WebUI:
What I am curious about is: the field DATE_2 seems to store the timestamp of Closing Date 2017.03.25 as observed in WebUI. My doubt is, since WebUI only displays the date information, where does this time 22:59:59 come from?
I wrote the following simple report to change Closing Date by code:
PARAMETERS: end TYPE CRMT_OPPORT_H_COM-expect_end DEFAULT '20170319'.
CONSTANTS: gv_guid TYPE crmt_object_guid VALUE '6C0B84B759DF1ED6BDF05763B3DC8841'.
DATA: lt_opport_h TYPE crmt_opport_h_comt,
ls_opport_h LIKE LINE OF lt_opport_h,
lt_change TYPE crmt_input_field_tab,
ls_change LIKE LINE OF lt_change,
lt_saved TYPE crmt_return_objects,
lt_exception TYPE crmt_exception_t,
lt_to_save TYPE crmt_object_guid_tab,
lt_not_to_save TYPE crmt_object_guid_tab.
ls_opport_h-ref_guid = gv_guid.
ls_opport_h-expect_end = end.
ls_change = VALUE #( ref_guid = gv_guid ref_kind = 'A' objectname = 'OPPORT_H' ).
APPEND 'EXPECT_END' TO ls_change-field_names.
APPEND ls_change TO lt_change.
APPEND ls_opport_h TO lt_opport_h.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_opport_h = lt_opport_h
CHANGING
ct_input_fields = lt_change
EXCEPTIONS
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4.
APPEND gv_guid TO lt_to_save.
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
it_objects_to_save = lt_to_save
iv_update_task_local = abap_true
IMPORTING
et_saved_objects = lt_saved
et_exception = lt_exception
et_objects_not_saved = lt_not_to_save
EXCEPTIONS
document_not_saved = 1.
WRITE: / sy-subrc.
COMMIT WORK AND WAIT.
The SAT trace shows clearly that the index table will also be updated during order save:
The main logic of CRM_ORDER_INDEX_SAVE
(1) call order header from object buffer and DB buffer separately via CRM_ORDERADM_H_READ_OB and CRM_ORDERADM_H_READ_DB to check whether there is really header change. (2) get old index data from DB via CRM_ORDER_INDEX_SELECT_DB. (3) transfer the latest order data from object buffer to index buffer. This is done in subroutine fill_data. Before subroutine is executed, date_1 is initial:
After execution, date_1 is filled with data now. So I can find answer how date_1 is populated later by debugging into fill_data subroutine.
(4) The change mode ( insert, update or delete ) is evaluated in subroutine fill_update_tables by comparing the latest change stored in lt_index_ob ( object buffer ) and original data from DB, lt_index_db.
In this example the determined result is that two records ( stored in table lt_index_update ) must be updated. The comparison logic is described in blog Logic of SAVE_EC function module in One Order. The real database update is done in update function module CRM_ORDER_INDEX_UPDATE_DU.
Closing Date update logic in CRMD_ORDER_INDEX-DATE_2 It is easy to find the logic by debugging into subroutine fill_data.
The Closing Date in WebUI is stored in CRMD_OPPORT_H-EXPECT_END.
The time of Closing Date is hard coded as 235959 and converted to timestamp based on time zone configured in the backend.
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- 【DB宝14】在Docker中只需2步即可拥有Oracle 11g企业版环境(11.2.0.4)
- 别忘了给gcc编译器工具链加上-fno-common选项
- 轻量安全的部署方案
- 算法集锦(34) | 强化学习| 出租车载客问题
- 前端测试题:(解析)关于ajax跨域的说法,下面错误的是?
- 什么才是定制化 IDE 的核心价值?
- RTOS内功修炼记(八)— CMSIS RTOS API,内核通用API接口
- 从零搭建Spring Boot脚手架(1):开篇以及技术选型
- 盘点 Python 10 大常用数据结构(下篇)
- 「干货」你需要了解的六种渲染模式
- 分享两个操作Java枚举的实用方法
- 从零开始强化学习:在Python笔记本中设计和解决一个任务
- 基于深度学习的新闻推荐算法(1)
- 以复现图表的方式来学习一篇文章
- 盘点 Python 10 大常用数据结构(上篇)