Hello Everyone,
In PaPM on-prem, the modeler knows that the package selections used in process templates are applied as filters during function runtime execution. Filter values maintained in the package selection fields are dynamically applied as filters in the modeling setup.
For instance, if a processing function is executed using a process selection field with Quarter = ‘Q3’, and the field Quarter is present in the modeling setup, the value provided is automatically applied as a filter across the overall modeling setup during execution without requiring any additional complex selection filter configuration. This reduces the processing of irrelevant records during function execution and calculation. As a result, modeling performance improves significantly, leading to faster execution times.
Coming to PaPM Cloud Universal Model, UM supports modeling setups using both normal functions (that is, non-model functions such as Calculation, Join, View, etc.) and Model Functions.
In PaPM Cloud Universal Model, I observed unexpected behavior when using Model Functions as part of the modeling setup. When Model Functions are used as the core of the modeling setup, the package selection filters used in the process do not work as expected.
The expected behavior is that filters should be applied prior to the calculation during function execution. However, the actual behavior is that the filters are applied only after the calculation, not before.
Let me explain this behavior using a simple business example for better understanding.
Modeling Setup 1 – Expected BehaviorModeling Setup 2 – Actual Behavior
The business example is to calculate the Total Discount Amount for High-Value Orders. Two tables are used: CustomersModelEntity and OrdersModelEntity.
The goal is to calculate the total discount amount for a selected customerGroup and a defined orderAmount range. In this example, a static 10% discount is used in the formula to calculate the discountedOrderAmount.
Modeling Setup 1 – Expected Behavior (without using Model Functions)
To calculate the discountedOrderAmount for the selected customerGroup and defined orderAmount range during processing, a calculation function is used.
This calculation function calculates the totalDiscount amount for the selected customerGroup and defined orderAmount range during processing.
The function is executed using activities created for the writer function along with package selections where:
customerGroup = ‘Retail’orderAmount between 10,000 and 50,000
Below is the expected result screenshot after successful execution using the package selection fields.
Modeling Setup 2 – Actual Behavior (when using Model Functions)
The below screenshot shows the Model Calculation function, which is used to calculate the discountedOrderAmount using the same formula as in the expected behavior modeling setup for the selected customerGroup and defined orderAmount range.
The Model Calculation function is then used to calculate the totalDiscount amount using the same formula as in the expected behavior modeling setup.
The function is executed using activities created for the writer function along with package selections where:
customerGroup = ‘Retail’orderAmount between 10,000 and 50,000
Below is the actual result screenshot after successful execution using the package selection fields.
Here, the expected result is 4,000, which is the correct aggregation of the discounted amount for the selected customerGroup and defined orderAmount range. However, in Modeling Setup 2, what actually happens is that the calculation defined in the Model Functions is executed first, and only in the final result are the filter values from the activity selection applied.
As a result, the value 6,800 is shown, which represents the aggregation of all discounted amounts irrespective of customer group and other filters.
I am wondering whether this is the intended behavior of Model Functions, or if something needs to be enhanced or fixed in the Universal Model component. If any SAP UM experts read this blog, please share your thoughts.
Conclusion
When using Model Functions in the modeling setup, filters are not properly applied during function execution. The filters are applied only after the calculation, which leads to incorrect results. To avoid such issues, the recommended approach is to use normal functions instead of Model Functions for processing.
If anyone has faced a similar challenge, please share the workaround you have used. Also, feel free to leave a comment if you have any questions or suggestions.
Hello Everyone,In PaPM on-prem, the modeler knows that the package selections used in process templates are applied as filters during function runtime execution. Filter values maintained in the package selection fields are dynamically applied as filters in the modeling setup.For instance, if a processing function is executed using a process selection field with Quarter = ‘Q3’, and the field Quarter is present in the modeling setup, the value provided is automatically applied as a filter across the overall modeling setup during execution without requiring any additional complex selection filter configuration. This reduces the processing of irrelevant records during function execution and calculation. As a result, modeling performance improves significantly, leading to faster execution times.Coming to PaPM Cloud Universal Model, UM supports modeling setups using both normal functions (that is, non-model functions such as Calculation, Join, View, etc.) and Model Functions.In PaPM Cloud Universal Model, I observed unexpected behavior when using Model Functions as part of the modeling setup. When Model Functions are used as the core of the modeling setup, the package selection filters used in the process do not work as expected.The expected behavior is that filters should be applied prior to the calculation during function execution. However, the actual behavior is that the filters are applied only after the calculation, not before.Let me explain this behavior using a simple business example for better understanding.Modeling Setup 1 – Expected BehaviorModeling Setup 2 – Actual BehaviorThe business example is to calculate the Total Discount Amount for High-Value Orders. Two tables are used: CustomersModelEntity and OrdersModelEntity. The goal is to calculate the total discount amount for a selected customerGroup and a defined orderAmount range. In this example, a static 10% discount is used in the formula to calculate the discountedOrderAmount.Modeling Setup 1 – Expected Behavior (without using Model Functions)To calculate the discountedOrderAmount for the selected customerGroup and defined orderAmount range during processing, a calculation function is used.This calculation function calculates the totalDiscount amount for the selected customerGroup and defined orderAmount range during processing.The function is executed using activities created for the writer function along with package selections where:customerGroup = ‘Retail’orderAmount between 10,000 and 50,000Below is the expected result screenshot after successful execution using the package selection fields.Modeling Setup 2 – Actual Behavior (when using Model Functions)The below screenshot shows the Model Calculation function, which is used to calculate the discountedOrderAmount using the same formula as in the expected behavior modeling setup for the selected customerGroup and defined orderAmount range.The Model Calculation function is then used to calculate the totalDiscount amount using the same formula as in the expected behavior modeling setup.The function is executed using activities created for the writer function along with package selections where:customerGroup = ‘Retail’orderAmount between 10,000 and 50,000Below is the actual result screenshot after successful execution using the package selection fields.Here, the expected result is 4,000, which is the correct aggregation of the discounted amount for the selected customerGroup and defined orderAmount range. However, in Modeling Setup 2, what actually happens is that the calculation defined in the Model Functions is executed first, and only in the final result are the filter values from the activity selection applied.As a result, the value 6,800 is shown, which represents the aggregation of all discounted amounts irrespective of customer group and other filters.I am wondering whether this is the intended behavior of Model Functions, or if something needs to be enhanced or fixed in the Universal Model component. If any SAP UM experts read this blog, please share your thoughts.ConclusionWhen using Model Functions in the modeling setup, filters are not properly applied during function execution. The filters are applied only after the calculation, which leads to incorrect results. To avoid such issues, the recommended approach is to use normal functions instead of Model Functions for processing.If anyone has faced a similar challenge, please share the workaround you have used. Also, feel free to leave a comment if you have any questions or suggestions. Read More Technology Blog Posts by Members articles
#SAP
#SAPTechnologyblog