Flow Builder: Generic Hints for ‘Out of memory’ issue and performance issue
One Exposure is the central storage which targets to all actual and forecast operational business transactions, it plays as the single source of truth for all financial risks from operations. The SAP Cash Management is using One Exposure as it’s storage for the apps.
Flow Builder is one of the available programs, tools that will generate flows by parsing accounting documents (via document chain). With respect to the data volume of the real business, the flows generated by Flow Builder is the majority among all source applications.
Flow Builder support the flows generation from both accounting part and material management part. And the kernel logic of Flow Builder implemented in AMDP (ABAP managed HANA Stored Procedure) to leverage the power of SAP HANA provided.
Flow Builder can be used for both initial load (Mass Run Mode) and delta load (Delta Run Mode) to synchronize the records in FQM_FLOW with accounting posts and material management documents. And it could be the some cases that Flow Builder may run into troubles, especially the ‘Out of memory’ issue on the system whose HDB set a smaller memory limit and performance issue when processing large chains.
This post try to provide some generic hints to eliminate ‘out of memory’ issue and performance issue. And this post focus only on accounting part as accounting part is the most problematic part for those two issues.
This post valid for following releases:
Hint 1. ‘maximum chain step’ matters.
The default variant ‘SAP&BG4‘ was used to process accounting documents in Delta Run mode with max. chain step 4.
However, it may not suits the real business need. Please refer to the official product documentation for the definition of ‘maximum chain step’ (shorten as ‘chain step’ below).
The smaller chain step in use, the less memory consumption will be, and the better performance will be.
Hint 1.1 If Cash Position is enough, create a new variant with Chain Step = 0;
The flows generated by Flow Builder generates flows which can be used for Cash position (via FF7AN) purpose and Liquidity Item Analysis (via Fiori App Cash Flow Analysis) both.
When the business need is just Cash Position, it is highly recommended to change the ‘Max. Chain Step’ to 0 to avoid chain tracing.
To change the maximum chain step with a new variant, please refer to post Flow Builder: Change the ‘Maximum Steps of Chain Tracing’ in OP1909 and higher releases | SAP Blogs.
Hint 1.2 If Liquidity Item analysis needs, the granularity of liquidity item counts.
Given the fact the liquidity item analysis is required, the granularity of liquidity item (or other accounting assignment fields) may differ with default value 4.
Choose a smaller chain step other than 4, like 2, will also benefit the memory consumption as well as the performance.
Hint 2. Use ‘Further Evaluation’ indicator.
For the cases that business scenario do need liquidity item analysis and demands a ‘non-zero’ chain step, the business also need provide the restrict on GL account itself.
The Further indicator helps on shortening the long chain, it result in less memory consumption and a better performance.
Maintenance View: V_FLQACC_INFO_AP
Please refer to official example for the usage of ‘Further evaluation’ indicator.
Hint 3. Use ‘Initial Balance Upload’
The Initial balance of the specific account coming from the business need: do the elder Actual flows are still need? Or simply, is there any business need to drill down to show the detail Actual flows which are 1 years ago? Or, in another format, how long shall those elder actual flows keep in the system?
WIth the given answer to the questions above, use the initial balance to limit the accounting documents which need be proceeded. Flow builder will exclude those document items which earlier than the IBU date.
The IBU flows restrict the accounting documents need be proceed, it definitely result in less memory consumption and a better performance.
SAP Program: FQM_INITIAL_BALANCE_UPLOAD
Hint 4. Package Size matters.
Flow Builder now enriched to support ‘Package Size’ in both Mass Run mode and Delta Run mode. And there is one more specificity in Delta Run mode with Package Size inputted, Flow Builder will change package size in an intelligent way if there is Out of Memory exception.
The package size limits the accounting documents need be proceed at one time, it definitely result in less memory consumption and a better performance. It's highly recommended to set the package size for Delta Run.
For instance, there is package size 200000 used for Flow Builder.
- Flow Builder split the inputted documents by using package size 200000. See post for the generic idea: Flow Builder: Splitting search criteria to void memory issue | SAP Blogs
- Flow Builder process the packages one by one;
- When one package failed due to OOM exception, Flow Builder will reduce the package size and retry that package (and all packages behind).
- The minimum package size is 1, means the one document.
- When Flow Builder failed with package size, it will mark that entry’s Error Flag.
It is hardly for product team to provide a suitable package size. Package size shall be provided by project team after well tests.
Hint 5. HDB setting helps.
Flow Builder leverage the capacity of HDB. So adjust the setting of HDB will benefit Flow Builder.
The ‘global_allocation_limit’ and ‘statement_memory_limit’ can be increased to reduce the out of memory exceptions.
Contact your HDB admin for a better setup.
Hope this post helps.