SAP Profitability and Performance Management – How to manage sequence of functions in execution chain
In this blog, I would like to show how to make flexible execution chain of functions in SAP Profitability and Performance Management (PaPM).
You have some Result function in Model that calculated by several functions which needed to be executed in specific order.
PaPM compiles the execution chain for this function that consists of all involved functions. Functions in this execution chain located in consistent order. Step-by-step: the result of previous function is the input to the next function.
How can we run functions in specific order? Can we run pre-calculation and use the result of it in next steps without recalculation?
For example, I give one of the scenarios that I met on the project.
Model has place in logic where calculation divided into several parallel flows with different conditions. This construction was packed in Join function where Pre-calculation functions and Next step functions added as steps with Rule Type “Union All”.
So, PaPM runs all calculations in Pre-calculation area for every calls of every Next step.
To improve performance, I realized this schema:
Оbviously, read the result of calculation from model table is faster than make every time calculations.
To realize this schema, we have to solve these issues:
- How to make single Execution chain.
- How to achieve single execution of writing to model table.
- How to read data from model table after writing is completed, because steps in Join functions runs in parallel order and there are no data in the model table in the beginning of execution.
To solve this issues, we need these functions and parameters:
- View that’s trigger Large volume calculations – functions from Pre-calculation area.
- Writer to save the result of Pre-calculation area to Model table.
- Model table with result from Pre-calculation area.
- Views that runs Next Steps.
- Execution Hub – Join what triggers Writer and Views that runs Next Steps. We need to achieve Writer executed first; Views executed second.
- Execution View – View that executes Execution Hub in advance mode.
1. Add Parameter to Environment
First, we need to add Parameter to Environment that will manage order of execution.
2. Add Parameter to Run Parameter Precondition
Then we add this Parameter to views in Advanced Tab as Run Parameter Precondition. Trigger that saves result to model table runs if Exec_order = 1. Views that read data from model table run if Exec_order = 2.
Note: Run Parameter Precondition checks the condition before executing the logic of only that function itself. But all the previous input functions will be executed (rel.SP11). So, to prevent the execution of all input functions, you need to find first input function in full HANA procedure of this View. Then you need to maintain there the same Run Parameter Precondition.
4. Maintain Execution Hub
The Execution Hub contains all functions. They added as Rules with Rule Type “From” and “Union all”.
3. Maintain Execution View
The Execution View is trigger that runs Execution Hub. We make it with Iteration Type – “For Loop”, set Low = 1, High = 2, Iteration Parameter = Exec_order. So, the Execution View runs Execution Hub twice. First execution is for Writer to table, second is for Views.
This is idea how can you use Run Parameter Precondition and how can you manage sequence of functions in execution chain.
The necessary set of objects that you need are:
- Execution Hub
- Execution View
Here you can find View function help documentation.
Hope this blog was helpful and informative for you. For more clarification questions about this blog post, please feel free to leave a comment below.
I also encourage you to post any questions in the Q&A area of the SAP PaPM community: https://answers.sap.com/tags/73555000100800000092.
If you find this post helpful click on the LIKE button and share it with a friend or colleague.
Thanks a lot for your time!
Thank you for sharing. Great way to realise complex scenarios
Hi Andrey, good post! Can we discuss (LinkedIn request sent)?
Hi Andrey, thanks for sharing!
Chain control with only in-build PaPM functionality - is a very elegant solution! No BW-chains or SQL/ABAP developments, very well done!
Thanks a lot for sharing. It's a very good idea.
I tried with an example followed the steps you mentioned. However, the Writer function didn't really writes data into the model table.
Could you please kindly comment, what might the the root cause.
Thanks a lot.
Thank you for your effort to create this blog. Please create more detailed tips related to PaPM. Appreciate it.
Hi Andrey, is it possible to create an execution chain where writers are of the type "Delete and insert"? Also, do you recommend writers to be sub-function or executable for such a process? Thanks, excellent article!