Debugging planning functions in SAP BI-IP
SAP came up with the FOX scripting language, to make it easier for anyone with no solid programming experience, to create custom planning functions in SAP Integrated Planning.
Some of the FOX operators were actually ahead of ABAP/4 of these times when FOX was introduced. So real analogue of FOX's "FOREACH" was only introduced with ABAP 7.40 release, as "FOR".
Depending on business requirements, FOX formulas can become quite complex and include hundreds line of code, which could be a stumblingstone of support and enhancement of the existing solution, which was developed years back, by long forgotten consultants.
Luckily, SAP has debugging option also for FOX based planning functions, which is however not as easy to reach as traditional ABAP/4 debugger.
Due to it's non-ABAP nature, it is not possible to simply put an ABAP breakpoint in a FOX code, nor ABAP debugger can "just pick it up".
Deep inside the application server, SAP translate FOX into ABAP/4 code to run it and so, utilize a specific service for this. Debugging the service is a key to debug a FOX formula.
As a start, we need to go to a class CL_RSPLFR_CONTROLLER, which is responsible for executing the FOX related services and put an external breakpoint somewhere inside it. Recommended place is an EXECUTE_SERVICE method.
Next start your planning application. ABAP debugger will start at the breakpoint.
Since you need to debug FOX and not ABAP, FOX debugging script must be used. You would need to navigate to "Script" tab and load RSPLFC_DEBUGGING_SCRIPT_FOX
Press Start and you will see another screen with FOX debugger.
At the first screen you will have an option to start debugging of the block or skip it and proceed to another block. Should you decide to debug the block it is recommended to set breakpoint right at the 1st screen, before the actual debugger start.
Planning function process data by blocks, so it will technically run once per each block.
Block is defined by characteristics that are used by planning function, but not selected to be changed.
So if we take above example and check characteristics usage of the planning function:
We can clearly see how function defined blocks.
Important notes:
For systems running on HANA, SAP HANA execution for FOX formulas is enabled by default. This greatly increase performance and decrease application server memory consumption, as FOX planning functions being pushed to the HANA side. However, it also means that FOX planning functions cannot be debugged anymore. HDB must be disabled temporary, to make FOX executing fully on application server side.
There are few ways doing so. The table view RSPLS_HDB_ACT_IP in SM30 can be used to deactivate the ABAP Planning Applications KIT for individual InfoProviders.
There is, however, a global RSADMIN parameters, which allows to disable HDB for the whole system.
That can be set using report SAP_RSADMIN_MAINTAIN with parameter object RSPLS_HDB_PROCESSING_OFF.
Possible values are:
'F': Force Off No HANA optimized processing, cannot be overruled any user
'X': Off No HANA optimized processing, but can be overruled for single users for special purposes
Not set: switch inactive (default and usual value)
More details on how to override 'X' setting as well as more info on HDB is available in note 1637199
Some of the FOX operators were actually ahead of ABAP/4 of these times when FOX was introduced. So real analogue of FOX's "FOREACH" was only introduced with ABAP 7.40 release, as "FOR".
Depending on business requirements, FOX formulas can become quite complex and include hundreds line of code, which could be a stumblingstone of support and enhancement of the existing solution, which was developed years back, by long forgotten consultants.
Luckily, SAP has debugging option also for FOX based planning functions, which is however not as easy to reach as traditional ABAP/4 debugger.
Due to it's non-ABAP nature, it is not possible to simply put an ABAP breakpoint in a FOX code, nor ABAP debugger can "just pick it up".
Deep inside the application server, SAP translate FOX into ABAP/4 code to run it and so, utilize a specific service for this. Debugging the service is a key to debug a FOX formula.
As a start, we need to go to a class CL_RSPLFR_CONTROLLER, which is responsible for executing the FOX related services and put an external breakpoint somewhere inside it. Recommended place is an EXECUTE_SERVICE method.
Since you need to debug FOX and not ABAP, FOX debugging script must be used. You would need to navigate to "Script" tab and load RSPLFC_DEBUGGING_SCRIPT_FOX
Press Start and you will see another screen with FOX debugger.
At the first screen you will have an option to start debugging of the block or skip it and proceed to another block. Should you decide to debug the block it is recommended to set breakpoint right at the 1st screen, before the actual debugger start.
Planning function process data by blocks, so it will technically run once per each block.
Block is defined by characteristics that are used by planning function, but not selected to be changed.
So if we take above example and check characteristics usage of the planning function:
We can clearly see how function defined blocks.
Important notes:
For systems running on HANA, SAP HANA execution for FOX formulas is enabled by default. This greatly increase performance and decrease application server memory consumption, as FOX planning functions being pushed to the HANA side. However, it also means that FOX planning functions cannot be debugged anymore. HDB must be disabled temporary, to make FOX executing fully on application server side.
There are few ways doing so. The table view RSPLS_HDB_ACT_IP in SM30 can be used to deactivate the ABAP Planning Applications KIT for individual InfoProviders.
There is, however, a global RSADMIN parameters, which allows to disable HDB for the whole system.
That can be set using report SAP_RSADMIN_MAINTAIN with parameter object RSPLS_HDB_PROCESSING_OFF.
Possible values are:
'F': Force Off No HANA optimized processing, cannot be overruled any user
'X': Off No HANA optimized processing, but can be overruled for single users for special purposes
Not set: switch inactive (default and usual value)
More details on how to override 'X' setting as well as more info on HDB is available in note 1637199
Comments
Post a Comment