For example, the requirement is to figure out under what circumstances the function module CRM_PRODUCT_I_A_CHANGE_ORGM_EC will be called. Of course, the most time-consuming thing to do is to set up a breakpoint and then run through the scene to see when the breakpoint is triggered. There is another method of analysis that does not pass debugging:

Using the transaction code CRMV_EVENT, enter the function name CRM_PRODUCT_I_A_CHANGE_ORGM_EC:

Results obtained:

The business implication of the above results is that the function Module we queried is automatically called by the One Order framework every time a Sales Area is created or updated.

Observe the following call stack:

So why, from a business perspective, does this callback function need to be called every time the Organization Model data for an order changes? Open up the source code for this function, In line 102 you see one of the SETTypes of the CRM Product, CRMM_PR_SALESG(Set type allowing you to group products for various purposes. As this set type is dependent on Distribution chains, a distribution chain has to be selected before data can be read).

For more information on this setType, refer to SAP Help.

This setType is a Distribution chain-related settype, which is meaningless without a specific Sales area.

Therefore, whenever the Organization model data of an order changes, the data of CRMM_PR_SALESG must be re-read according to the latest Organization Model data after the change. Using the One Order framework, this Organization model change and CRMM_PR_SALESG read dependency is actually accomplished through the “observer pattern” in the design pattern. CRM_PRODUCT_I_A_CHANGE_ORGM_EC is one of many observers of Organization Model data changes and subscribles to the event of Organization Model data changes through the transaction code CRMV_EVENT. Whenever there is a change in Organization and model data, the change is published through the CRM_EVENT_PUBLISH_OW in the following figure, and other observers can process the change based on the event published by the publisher. In the example of my article, Call CRM_PRODUCT_I_A_CHANGE_ORGM_EC to read setType CRMM_PR_SALESG data based on the latest Organization model.

For more of Jerry’s original technical articles, please follow the public account “Wang Zixi” or scan the following QR code: