Exit Based Characteristic Relationships with BW-PAK
In BW Integrated Planning, SAP provides the functionality of defining characteristic relationships on a planning cube. These so-called relationships can be used in 4 different ways – Attribute, Exit, Hierarchy and DSO. More information on this can be found here. Exit based characteristic relationships are used when the derivations are customer specific and cannot be derived directly via the other 3 types.
In order to check if a planning sequence can be executed in-memory, SAP recommends running the program RSPLS_PLANNING_ON_HDB_ANALYSIS. Based on the report results, we can analyze further, as to what is blocking the planning sequence from being executed in-memory. In this case, we figured out that if a characteristic relationship of type ABAP exit class is used, the planning sequence is NOT executed in-memory. In this blog post, I would like to describe how to analyze the results of this program and implement a quick fallback method that SAP recommends.
In transaction SE38, execute program RSPLS_PLANNING_ON_HDB_ANALYSIS. In the selection screen, any one of the options can be selected – Infoproviders, Planning functions or Planning sequence. We have chosen a planning function as an example.
After execution, we see that the status is red.
AMDP in Exit Based Characteristic Relationships?
Based on the analysis from running the program RSPLS_PLANNING_ON_HDB_ANALYSIS, we checked to see if we could use an AMDP (ABAP managed database procedure) in the exit-class, as it is SQL Script based and will allow the planning cube to be PAK compliant.
When trying to use the AMDP interface, IF_AMDP_MARKER_HDB & implementing an AMDP method using IF_RSPLS_CR_METHODS~CREATE_HDB, the system throws a syntax error, because the importing parameter ‘I_TSX_SELDR’ in the method must be structured and all components of the row-type must be elementary. According to SAP’s AMDP documentation, the parameter interface of an AMDP method has to fulfill specific prerequisites (such as the one we faced). Thus, it can be concluded that the methods available for Characteristic Relationships are not AMDP compatible.
Alternative Approach – ABAP as a Fallback
As an alternative approach, SAP recommends ABAP as a fallback. In this case, the exit-class needs an interface IF_RSPLS_CR_EXIT_HDB to be implemented. The two methods of the interface, IF_RSPLS_CR_EXIT_HDB~GET_SQLSCRIPT_INFO and IF_RSPLS_CR_EXIT_HDB~GET_SQLSCRIPT_PARAMETERS have to be implemented but they can be empty. The characteristic relationship will call the interface methods at run-time and because the returned values for names of SQL-script implementations are empty, the corresponding ABAP-implementation is called as a fallback. The interfaces mentioned above only serve as markers, indicating that PAK deep HANA integration is requested.
After making the above changes in the exit-class, re-run the program RSPLS_PLANNING_ON_HDB_ANALYSIS. It is very evident by the green status, that the planning function is now ready to execute in-memory!
Conclusion and Next Steps
It is evident that AMDP is not ready to be used yet in Exit based characteristic relationships. The ABAP as a fallback approach is a quick and easy win, to make the planning cube PAK compliant. However, there are some limitations on how and when this method can be used and the developer needs to exercise caution on this. Please refer to the SAP note 1956085, for more details.
Based on the above findings we have considered the following next steps to be dealt with:
- Test the behavior of all planning functions built on the cube, which has has a Characteristic Relationship with the ABAP fallback method implemented. It is possible that the planning function may give undesirable results and the planning function code may need to be revisited.
- Raise an idea with SAP to have the Characteristic relationship interface be AMDP compliant
- Check possibilities of using a normal SQL Script procedure in the exit class, instead of the fallback method