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

简介: 关于 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/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

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

image.png

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

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

image.png


相关文章
|
中间件
使用 SAP Fiori Tools 部署 SAP UI5 应用到 ABAP 服务器时遇到的各种错误和解决办法
使用 SAP Fiori Tools 部署 SAP UI5 应用到 ABAP 服务器时遇到的各种错误和解决办法
SAP 系统里的中文数据,用 ABAP 导出成 Excel 文件时遇到乱码的分析和解决办法试读版
SAP 系统里的中文数据,用 ABAP 导出成 Excel 文件时遇到乱码的分析和解决办法试读版
150 0
|
5月前
|
前端开发 开发工具 Android开发
小技巧分享 - 使用 Visual Studio Code 查看和修改 ABAP 代码试读版
小技巧分享 - 使用 Visual Studio Code 查看和修改 ABAP 代码试读版
小技巧分享 - 使用 Visual Studio Code 查看和修改 ABAP 代码试读版
|
5月前
|
BI
工具分享 - 将一个 ABAP Function Group 内所有 Function Module 按照代码行数从高到低排序并显示
工具分享 - 将一个 ABAP Function Group 内所有 Function Module 按照代码行数从高到低排序并显示
工具分享 - 将一个 ABAP Function Group 内所有 Function Module 按照代码行数从高到低排序并显示
|
5月前
|
开发者 供应链 BI
SAP ABAP CALL SUBSCREEN 代码解析
SAP ABAP CALL SUBSCREEN 代码解析
|
5月前
|
存储 数据处理 开发者
ABAP 如何把 unicode 代码点转换成字符
ABAP 如何把 unicode 代码点转换成字符
|
5月前
|
存储
使用 ABAP 代码打印出 SAP CRM 系统里所有维护了 Sales Area 的 business partner id
使用 ABAP 代码打印出 SAP CRM 系统里所有维护了 Sales Area 的 business partner id
|
5月前
|
SQL 数据库
小技巧:如何让 ABAP OPEN SQL 代码具有自解释性(Self-Explained)
小技巧:如何让 ABAP OPEN SQL 代码具有自解释性(Self-Explained)
|
5月前
|
JSON 应用服务中间件 API
使用 ABAP 代码消费 SAP 系统的 OData 服务
使用 ABAP 代码消费 SAP 系统的 OData 服务
|
5月前
|
开发工具 Web App开发 IDE
如何对 SAPGUI 里的 ABAP 代码语法检查功能进行自定义增强配套代码
如何对 SAPGUI 里的 ABAP 代码语法检查功能进行自定义增强配套代码
如何对 SAPGUI 里的 ABAP 代码语法检查功能进行自定义增强配套代码
下一篇
无影云桌面