SAP CRM WebClient UI,如何快速定位到抛出错误消息的那一行代码

简介:

本文是Jerry的原创,最早发表于SAP官方社区,英文版链接如下:

https://blogs.sap.com/2013/09/25/how-to-quicly-locate-the-source-code-where-raises-a-given-message-in-webclient-ui/

As a developer in my daily life I always need to quickly locate the source code where raises a given message in webclient ui.

If you would like to know how to quickly find the source code which raises message in SAP GUI environment, please refer to this blog of mine instead.

Here below are four approaches using which almost all messages I meet with so far could be located:

  1. If some invalid data is input which blocks the account save, the generic message saying “data contains error” without dedicated erroneous field is not helpful. Suppose I would like to find the exact code which raises error message. You can observe that if I put the mouse onto the error message, there would be a tooltip poped up with message technical information like message id and message number. By default this behavior is not activated for your user. You can manually activate it via:

go to transaction code SU3 and maintain user parameter BSPWD_USER_LEVEL = 6

6 means “Experienced user”. You can find the description of all possible value in domain BSPWD_MSGLEVEL.

Now we know the message id is CRM_BUPA_BOL and number is 036. Go to transaction code SE91 and search code via where use list:

we get 2 hits: double click on one of them. Why there is if 1 = 2 whose condition will never be met?

actually the red code below is just what we look for. The above code in line 86 is just simply written in order to enable itself to be found by where use list,
since where used list in abap workbench would only find the static message usage like keyword MESSAGE +
(). The red code does not really raise message via keyword MESSAGE but just put the given message into an internal table via global message service and thus would not be found by where use list.

  1. In IC agent inbox, if an unsupported search attribute is specified, the search could not be performed and the corresponding message is raised in ui.

unfortunately now if I follow approach 1, no hit in where use list.

so I try to use report RS_ABAP_SOURCE_SCAN, use 559 as search key, and maintain CRM_IC_APPL_INBOX as package. The report will scan 559 within all ABAP source codes which are stored in that package.

So how can I get the package name CRM_IC_APPL_INBOX? Just click F2 on UI, I can know the view name ICCMP_INBOX/InboxSearch.

in its event handler for event SEARCH, I can know that the search implementation is actually provided by class CL_CRM_AUI_QUERY_SERVICE.

so now I can ensure that the code which raises the information message is definitely inside that package.

after a while the report runs over and I can simply double click the result to jump into the source code.

  1. When it comes to product area, it is pretty easy to find the source code of given message. Almost all underlying messages in product application is raised by utility function module COM_PRODUCT_ADD_MESSAGE. In example below I input an invalid item category group WWW and would like to find which code does validation check and raise error message. All I have to do is just to set a breakpoint in that function module, and re-save in UI:

breakpoint is hit as I expect after I click save button again:

the sy-subrc indicates that there is some exception raised, and just above the FM COM_PRODUCT_ADD_MESSAGE, we can find the FM COM_PRODUCT_CHECK_FIELD_ENTRY complains that the input WWW is not valid.

  1. This is the most powerful debugging method. Suppose I need to find which line of code raises this message below:

Use F2 button I know that the current search page is built on BP_HEAD_SEARCH/MainSearch:

So I set a break point on search event handler:

The breakpoint is hit when I click search again. However I will not debug it line by line. Click tab “Break./Watchpoints”, and create a dynamic breakpoint for ABAP command MESSAGE. As a result the breakpoint will be triggered wherever the keyword MESSAGE is written in ABAP code.

I just click F8, and debugger automatically stops in the line below, which is just what we are looking for.

Summary

all the four methods above makes my trouble shooting life easier. If you have any other approaches to achieve the same, welcome to share with us

本文来自云栖社区合作伙伴“汪子熙”,了解相关信息可以关注微信公众号"汪子熙"。

相关文章
|
16天前
|
人工智能 搜索推荐 Serverless
使用金庸的著作,来测试阿里通义千问最新开放的长文档处理功能
使用金庸的著作,来测试阿里通义千问最新开放的长文档处理功能
36 7
使用金庸的著作,来测试阿里通义千问最新开放的长文档处理功能
|
1月前
|
前端开发 搜索推荐 开发者
SAP UI5 sap.m.Column 控件的 minScreenWidth 属性介绍
SAP UI5 sap.m.Column 控件的 minScreenWidth 属性介绍
27 0
|
1月前
|
JavaScript 前端开发 开发者
SAP UI5 控件 sap.m.ListBase 的 inset 属性的作用介绍
SAP UI5 控件 sap.m.ListBase 的 inset 属性的作用介绍
13 0
|
1月前
|
前端开发 JavaScript API
SAP UI5 sap.ui.require.toUrl 的作用介绍
SAP UI5 sap.ui.require.toUrl 的作用介绍
28 0
|
16天前
什么是 SAP ABAP 里的 Subscreen
什么是 SAP ABAP 里的 Subscreen
13 1
什么是 SAP ABAP 里的 Subscreen
|
1月前
|
开发者 UED
关于 SAP UI5 sap.m.Column 的 demandPopin 属性
关于 SAP UI5 sap.m.Column 的 demandPopin 属性
15 0
|
1月前
|
Web App开发 数据采集 前端开发
纯技术讨论:如何让 SAP UI5 应用无法被别人在浏览器里调试 - 这种做法不推荐试读版
纯技术讨论:如何让 SAP UI5 应用无法被别人在浏览器里调试 - 这种做法不推荐试读版
15 0
|
1月前
|
XML 存储 数据格式
SAP UI5 控件 customData 属性的应用介绍
SAP UI5 控件 customData 属性的应用介绍
31 0
|
1月前
|
搜索推荐
如何让 SAP UI5 Smart Table 支持多项选择(Multiple-Selection)试读版
如何让 SAP UI5 Smart Table 支持多项选择(Multiple-Selection)试读版
18 0
|
1月前
使用 SAP UI5 Event Bus 机制,修复 SAP UI5 分页显示数据的一个 bug 试读版
使用 SAP UI5 Event Bus 机制,修复 SAP UI5 分页显示数据的一个 bug 试读版
20 0