关于 SAP ABAP gateway OData 的一个诡异问题及解决办法

简介: You can see that the old version of cache re-appears in the table in gateway system.Our SEGW project name: CRM_OPPORTUNITY.Gateway system: GM6/001Backend system: AG3/001I am doing some new enhancement on CL_CRM_OPPORTUNITY_MPC_EXT~ DEFINE to add some new nodes. ( The enhancement is done by dir

问题

You can see that the old version of cache re-appears in the table in gateway system.


Our SEGW project name: CRM_OPPORTUNITY.

Gateway system: GM6/001

Backend system: AG3/001


I am doing some new enhancement on CL_CRM_OPPORTUNITY_MPC_EXT~ DEFINE to add some new nodes. ( The enhancement is done by directly changing the source code of ABAP class CL_CRM_OPPORTUNITY_MPC_EXT without any re-activation in SEGW.


P.S: As an experienced developer, I felt really shameful to tell my Product owner something like “I don’t know why this issue occurs, and I guess it is not caused by our enhancement”. I am eager to know the root cause of this issue. I did made some pre-analysis and the entry point for cache table filling is done via method /IWFND/CL_MED_MDL_PROVIDER~ GET_META_MODEL, so I would like to know what types of operations and which user has triggered the method call. I am evening considering to ask our IT colleagues to switch on the table log on this cache table so that at least I would know the SAP name of the user who has filled this old version cache.


image.png


Although there are some suggestions or workarounds like clicking “Load Metadata” to force a cache synchronization with backend, and once we see the successful load popup,


image.png


The cache in GM6 will become latest version. However, I don’t think this is acceptable since it would be a disaster for a customer to do this stupid activity again and again.

I believe in that every issue has its root cause, and now I have trouble to find it L


image.png


分析

The Metadatacache is refreshed with Call $metadata or if the user press ‚load metadata‘ in /IWFND/MAINT_SERVICE.


The cache is not refreshed by any automatism.


With NW 7.40 SP10 there is a Metadata Invalidation for Business Data Requests, this means that with Get Requests – Call the Framework is checking the Metadata and if there is newer data the Cache will be deleted.


If the Cache is deleted it will be automatically loaded with a Business Data Request.


The metadata Cache can be controlled with overwriting Method /IWBEP/IF_MGW_MED_LOAD~GET_LAST_MODIFIED in the DPC Class and this can also lead to errors.

This method is called to determine the last version. Can you please check that this method is not overwritten.


Yes we have to redefine GET_LAST_MODIFIED in our CL_CRM_OPPORTUNITY_MPC_EXT since the metadata of BP Model is reused so we just return compare the last-modify timestamp of BP and Opportunity model and return the latest one. The logic is as below, very simple and I don’t think the code will cause trouble.


Since today I have to make some changes on the model for development, I add a “trap” in line 15.

Since in principle all cache entries in GM6 must come from backend system AG3/001, so suppose the cache in GM6 returned to an older version, that older version must also come from AG3. In that case the line in 15 will cause a dump in AG3/001.


Let’s wait and see if any prey will fall into this trap…


image.png


Ghost appears again. The cache in AG3/001 is still latest:


image.png


However the cache in GM6/001 returns to old version again:


image.png


However, my ASSERTION does not take effect – there is no ASSERT failure runtime error in ST22 in AG3/001.

image.png

I am extremely confused why this very version 20150108130735 is returned but not the others.


I am writing to you regarding another very strange issue.


If you log on GM6/001, tcode /IWFND/ERROR_LOG, and you can find there are many errors for user LIROS as displayed below:


image.png


The annoying thing is, sometimes this issue will occur but some other times everything just works perfectly.


I debugged and find some hint that, every time the issue occurs, it is because there is no corresponding entry existed in internal table ms_model_class-associations.

Take the below screenshot for example. In the wrong situation, no corresponding entry for OpportunitycomplexNotesSet in the internal table.


image.png


But in the working case, the entry for our new enhanced node are there in the table, see example below:

image.png

It looks like it is quite unstable. Do you have any suggestions?


Finally we have found the root cause. I have written a report ZJERRY_CACHE_TEST in GM6/001 and schedule it as background job to track the change of that buffer table

with interval like 10 seconds.


It has shown that in GM6/001 there are TWO types of caches for Opportunity model. The red one which has our latest enhancement is the correct one, has timestamp

20150205074407 which exactly matches to AG3/001:


image.png


The question is, where does another version 20150205092736 come from? ( it does not have our latest enhancement ).

It comes from QHD/504. Since QHD/504 still has the older version of OData model, every time an OData request is sent from GM6 to QHD/504, the cache of lower version in QHD/504 will be fetched and filled in GM6/001, which causes the trouble.


image.png


In the past it is configured that GM6 could connects both to AG3 ( latest version ) and QHD ( lower version ). After we remove the System alias for QHD/504, this issue is resolved.

image.png


相关文章
|
22天前
|
SQL 数据库 索引
关于 SAP ABAP REPOSRC 数据库表在 HANA 中的 DDL Definition
关于 SAP ABAP REPOSRC 数据库表在 HANA 中的 DDL Definition
18 1
关于 SAP ABAP REPOSRC 数据库表在 HANA 中的 DDL Definition
|
1月前
|
安全 开发者
什么是 SAP ABAP 调试器里的 TRFC Block Sending 设置
什么是 SAP ABAP 调试器里的 TRFC Block Sending 设置
22 0
|
18天前
|
存储
使用 ABAP 代码打印出 SAP CRM 系统里所有维护了 Sales Area 的 business partner id
使用 ABAP 代码打印出 SAP CRM 系统里所有维护了 Sales Area 的 business partner id
19 0
|
18天前
|
人工智能
Suno AI 生成 SAP ABAP 顾问之歌
Suno AI 生成 SAP ABAP 顾问之歌
14 1
|
18天前
|
存储 安全 数据库
SAP ABAP 中数据类型 xstring 的使用介绍
SAP ABAP 中数据类型 xstring 的使用介绍
19 0
|
22天前
什么是 SAP ABAP 里的 Subscreen
什么是 SAP ABAP 里的 Subscreen
15 1
什么是 SAP ABAP 里的 Subscreen
|
22天前
|
数据库 存储 BI
SAP ABAP CDS View 源代码存储的数据库表揭秘和其他相关数据库表介绍试读版
SAP ABAP CDS View 源代码存储的数据库表揭秘和其他相关数据库表介绍试读版
12 0
SAP ABAP CDS View 源代码存储的数据库表揭秘和其他相关数据库表介绍试读版
|
22天前
|
数据库
迈入 SAP CDS View 世界的前置知识 - SAP ABAP 数据库视图介绍试读版
迈入 SAP CDS View 世界的前置知识 - SAP ABAP 数据库视图介绍试读版
10 0
迈入 SAP CDS View 世界的前置知识 - SAP ABAP 数据库视图介绍试读版
|
22天前
|
数据库 SQL 应用服务中间件
SAP ABAP CDS View 和 HANA CDS View 相同点和不同点辨析
SAP ABAP CDS View 和 HANA CDS View 相同点和不同点辨析
20 0
SAP ABAP CDS View 和 HANA CDS View 相同点和不同点辨析
|
1月前
SAP ABAP ALV 的分组显示和 Subtotal 显示实现的技术步骤试读版
SAP ABAP ALV 的分组显示和 Subtotal 显示实现的技术步骤试读版
33 0