前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >SAP ABAP老司机平时是怎么做代码审查的

SAP ABAP老司机平时是怎么做代码审查的

作者头像
Jerry Wang
发布2019-05-31 11:29:24
6700
发布2019-05-31 11:29:24
举报

In line 27:strange callstack.Why from API layer directly to local class level? In line 28:LCL_REQUEST_MANAGER=>PROCESS called 139 times and consumes 4 seconds. Even taking sub nodes into consideration, why 139 times? Need to compare in our own system and perhaps debug in Lenovo sandbox system. In line 29: lt_processable: 148 times. In line 31: CL_CRM_UIU_BT_TOOLS=>SAVE. Check whether it is called within LOOP. Total time: 3.86 seconds In line 32: LCL_REQUEST_MANAGER=>PROCESS_REQUESTS why it is called 7 times? In line 42:Call Func. CRM_ORDER_SAVE: it took 2.5 seconds to save a service order via API! In line 67:CL_BSP_PAGE_CONTEXT=>IF_BSP_PAGE_CONTEXT~ELEMENT_PROCESS: this UI element render method is called 407 times and consumes 2.2 seconds. In line 78: why the API is called again although control is handed over back to UI layer? In line 79: Call Func. CRM_ORDER_SAVE_PREPARE_MULT_OW 1.6 seconds for CRM_ORDER_SAVE_PREPARE_MULT_OW In line 92: Call M. CL_CHTMLB_CONFIG=>IF_BSP_ELEMENT~DO_AT_BEGINNING:why DO_AT_BEGINING triggers expensive Genil READ again? In line 98: Call Func. CRM_ACTION_DETERM_COMPL_DOC – is this standard action implementation: could it be disabled? In line 101: Call Func. CRM_ORDER_READ_OW – why is it called? In line 107: Call M. CL_CRM_INTLAY_BTIL=>READ_ORDERS is called 138 times In line 117: Submit Report SAPMSSY4 : synchronous or Asynchronous call? In line 118: Call M. CL_BSP_WD_CONTEXT_NODE_TV=>GET_T_TABLE: 0.8 seconds for a pure UI layer operation!? In line 127: Call Func. CRM_ORDER_UPLOAD_SINGLE why is it called? In line 130: Call M. ZL_BT116H_S_OVVIEWSET_IMPL=>ZCHECK_VENDOR_ADDRESS:Lenovo BAdI implementation to check vendor address( 0.6 second) Any space to improve? In line 131: Call M. CL_IM_CRM_BUS20001_UPLOAD=>IF_EX_ORDER_SAVE~CHANGE_BEFORE_UPDATE – standard BAdI implementation. Could it be deactivated? In line 134: Program SAPMSSY4 synchronous or Asynchronous call? In line 135: why it does dynpro related record? In line 138: Perform LOCAL_UPDATE_TASK - could it be avoided? In line 139: Call M. CL_CRM_PARTNERSET_RUN_BTIL=>IF_CRM_RUNTIME_BTIL~READ_ATTRIBUTES - why partner set related function is called here? In line 144: Call M. CL_CHTMLB_CONFIG_TABLE=>IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START – a large number of calls In line 160: Call M. CL_CONTEXT_MANAGER_PPF=>CONSTRUCTOR-constructor consumes 0.3 seconds In line 162: Perform(Ext) BAL_DB_INTERNAL_IN_UPDATE_TASK - application log: 0.3 seconds In line 170: Select PPFTTRIGG 0.2 seconds In line 173: Call M. CL_BSP_WD_CONTEXT_NODE_TV=>GET_V_T_TABLE get value help: 0.27 seconds In line 175: Call M. CL_CRM_INTLAY_BTIL=>GET_DATA:a large number of GET_DATA called In line 180 :Call M. CL_EX_ORDER_SAVE=>IF_EX_ORDER_SAVE~CHECK_BEFORE_SAVE - 0.259 seconds for BAdI implementaton call In line 181: Call M. CL_SF_MAIL_PPF=>SET_TRIGG - is mail send functionality really necessary?

  1. From trace I can confirm that Service order save is done in a synchronous way in webclient UI. 同步操作哦。

And there is a business function to enable Asynchronous search. If the Asynchronous search has no impact, the 0.8 seconds could be deducted from the total 7.6 seconds to save in Webclient UI.

clipboard1
clipboard1

It is necessary to clarify that, the 7.6 times consists of both the execution on Webclient UI layer, the Genil layer and API Layer.

In pricing Validation scenario, it is most likely to directly call API ( CRM_ORDER_SAVE ) to persist the order. For this API call, it took 2.5 seconds in Lenovo production system to finish the save.

Of course we need to seek the improvement in both UI save and API save, nevertheless I think we should clearly communicate about the difference between this 7.6 seconds and 2.5 seconds.

Furthermore, the save API is mass-handling enabled, which means the total number of saving N order at one time != N * 2.5 seconds.

clipboard2
clipboard2

I update my progress today: 工作进度汇报。

I have written a report using BOL API to save service order. Tested in BG3 but I don’t have a development user to create it in sandbox system.

I will try to ask for an user with enough authorization. Then I use SAT to do a trace in sandbox system on transaction CRMD_ORDER( search out one service order, change its description and save ).

In sandbox system there are 238322 entries in order header table. 1.9 second for Modify API 3.3 second for Save API

clipboard3
clipboard3
clipboard4
clipboard4

To do: Need to figure out what action implementation is done here. ( 1.7 second )

clipboard5
clipboard5

I have gone through the source code of ZL_BT116H_S_OVVIEWSET_IMPL. The basic feeling is the custom code is not so good, although some of them may not have a BIG impact on performance. Some examples:

There are some useless code in order save. The highlighted code are always executed during order save but the final result lv_category is never used later. So it could be deleted.

clipboard6
clipboard6

“REINVENT the wheel”: There are quite lots of looping at the BOL collection to find the very bol entity by application code, even in the nested WHILE statement. However, this function is already provided by framework. I just test in BG3 that framework solution is several times faster than implemented by application.

clipboard7
clipboard7
clipboard8
clipboard8

For the order save, several methods are executed in the same session, however the same check logic is done in every method related to save again and again.

In sap standard implementation, the best practice is to buffer the check result to avoid later repeated call.

clipboard9
clipboard9

As I said those bad coding style may not impact the overall performance too much since all of the custom coding only cost 29% of total time, but just from my point of view there is indeed improvement space regarding their custom code.

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019年01月31日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档