Wednesday, 11 October 2023

Do not try this at home – performance improvement in the LIME engine

Disclaimer – this post is about changes in the customer namespace, which maybe belong in the standard and it is not a good idea to develop them in a customer project.

But, as we know, necessity is the mother of invention…

Recently within a customer project the customer was experiencing performance issues with the standard /scwm/pi_upload transaction.

The load of a .CSV file would end in a short dump, saying that the current work process was out of memory. And the system limit per WP was around 8G.

The file itself was not big, but even reducing it to a small number of lines, around 20-30, would not help solve the issue.

After some debugging, i observed that the culprit was the internal table /LIME/PI_DOC_ALL-T_EXIST, that was growing exorbitantly big over time.

The where-used list on this table showed that it was used only in a few places, namely in the program /LIME/LPI_COREPI1 and in the class /SCWM/CL_IM_PI_OP_CORE. In all of these places, it seemed that the logic was only considering entries where data-hu_item-huident was not initial.

SAP ABAP Career, SAP ABAP Skills, SAP ABAP Jobs, SAP ABAP Prep, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Certification

So i came up with the idea to reduce this table, and get rid of the entries where the field huident is empty.

The structure /LIME/PI_DOC_ALL was extended

SAP ABAP Career, SAP ABAP Skills, SAP ABAP Jobs, SAP ABAP Prep, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Certification

Also i created an enhancement implementation ZSCM_EI_ADD_ITEM_PROP_AND_BOOK.
Changed the include /LIME/LPI_COREPI1, and added an enhancement point ENHANCEMENT 1 ZSCM_EI_ADD_ITEM_PROP_AND_BOOK.

SAP ABAP Career, SAP ABAP Skills, SAP ABAP Jobs, SAP ABAP Prep, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Certification

After the table had been reduced, i needed to adjust also the logic that reads it.
As the logic to be changed fell in the midddle of the method /SCWM/CL_IM_PI_OP_CORE-> /LIME/IF_EX_PI_OPERAT_CORE~CREATE_DIFFERENCE, i created an overwrite exit of /SCWM/CL_IM_PI_OP_CORE-> /LIME/IF_EX_PI_OPERAT_CORE~CREATE_DIFFERENCE,
created a new class zcl_ewm_im_pi_op_core as a copy and friend of /SCWM/CL_IM_PI_OP_CORE.

SAP ABAP Career, SAP ABAP Skills, SAP ABAP Jobs, SAP ABAP Prep, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Certification

SAP ABAP Career, SAP ABAP Skills, SAP ABAP Jobs, SAP ABAP Prep, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Certification

SAP ABAP Career, SAP ABAP Skills, SAP ABAP Jobs, SAP ABAP Prep, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Certification

In the overwrite exit i would call the zcl_ewm_im_pi_op_core-> /LIME/IF_EX_PI_OPERAT_CORE~CREATE_DIFFERENCE implementation, which can then access all protected data and logic of the productive class instance.

And in the zcl_ewm_im_pi_op_core-> /LIME/IF_EX_PI_OPERAT_CORE~CREATE_DIFFERENCE implementation the following lines were added

SAP ABAP Career, SAP ABAP Skills, SAP ABAP Jobs, SAP ABAP Prep, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Certification

For the given scenario, this helped get the process running and coming to a successful end. Again, i am not encouraging such interventions, and hope SAP will deliver an improvement here. Also, there could be potential side effects, this is fully acknowledged.

As for the system SP level, it looked like that:

SAP ABAP Career, SAP ABAP Skills, SAP ABAP Jobs, SAP ABAP Prep, SAP ABAP Preparation, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorial and Certification

What is also to be mentioned, is that the bin being counted is particularly large in terms of items. It more or less plays the role of a PSA.

No comments:

Post a Comment