Reduce HANA Information model development effort with XML editing
In HANA development, if you happen to have a need to perform same modifications to the model multiple times in the same model or copy them over to different models, then XML editing would help you save a lot of effort.
In cases like, if your data is based on “Account model”, but the reporting requirement is “Key Figure model”, then you may end up creating a lot of Restricted Key figures and Calculated Key figures. Or consider a case, when the data model contains more than 70 – 80 key figures and you need to apply currency conversion to these Key figures, then the XML editing can help you reduce a lot of manual effort.
If your XML coding skills are advanced, then it can certainly help model large UNION operations, which in current eclipse editor can certainly be painful and may result in hanging the HANA studio.
And in case, if you don’t have any such requirement mentioned above, it would still help you look into the generated XML for the HANA information models to understand how different settings like Default schema, Default Client, Default Language, various input parameters, variables, data sources etc are mapped.
Steps to generate the XML model of the schema:
The XML file can be generated from the right hand side option as shown below, but I prefer the EXPORT functionality so that the same file can be imported back after editing.
The EXPORT / IMPORT option can be found in HANA Studio as shown below. A detailed document on how to use the EXPORT / IMPORT functionality can be found at http://scn.sap.com/docs/DOC-26381
For the demonstration purpose, let us consider a data model with
- one base Key figure with currency conversion applied (C_SALES)
- 3 base Key Figures which are currently modeled as “simple”, but need to be modeled as “Amount with Currency” and also need to apply currency conversion (C_SALES_1, C_SALES_2, C_SALES_3)
- 1 Restricted Key Figure (SALES_2012) with C_SALES restricted to Year 2012
- 1 Calculated Key Figure (SALES_10PER_CC) with 10% of the Sales to be added to the Sales for further calculation.
The model can look like :
Case 1: Modify Key Figures from Simple to Amount with Currency and apply Currency conversion:
The Key Figure (C_SALES) has been defined as Amount with Currency with Dynamic Currency conversion as shown below. Such setting can be copied to the other Key Figures in the generated XML file. This can save considerable effort as compared to performing the modifications in HANA Studio, when the number of Key figures to be modified are significantly high.
Please note that the Schema for currency conversion has been hidden in the screenshot above.
The setting in the XML file can be seen in the following screenshot.
The changes to be done for the Key Figures C_SALES_1, C_SALES_2, C_SALES_3 are as follows:
- Change the measureType from “simple” to “amount” like for C_SALES
- Copy the code block highlighted in the screenshot between <descriptions> and <measureMapping> tab like for C_SALES
After the re-import of the XML file, the changes can be seen in the Key Figures C_SALES_1, C_SALES_2, C_SALES_3 as follows:
Please note that the Schema for currency conversion has been hidden in the screenshot above. The same technique can be used to create additional Key Figures in the model as mentioned below.
Case 2: Create additional Restricted and Calculated Key Figures:
Additional Key figures can also be created by copying the existing code blocks for Restricted and Calculated Key figures and modifying the technical name, description and filter / expression conditions. For simplicity, we can copy the existing RKF and CKF and modify the filter conditions and calculations.
To add a Restricted Key figure with Sales for 2013, the XML file can be modified as shown below. The <measure> block can be copied and modified as shown in the screenshot below:
The measure id, description and the restriction values (including the attributes) can be modified after copying. The same concept can be applied for the Calculated Key Figures as shown in the below screenshot. The <measure> block can be copied and modified for the new Calculated Key Figure.
After the modification to the XML file, it can be re-imported and the view can be VALIDATED and ACTIVATED in HANA Studio. The validation process can identify any error in the imported model and can be corrected. The generated model can look like:
Please note that the above mentioned process is an alternative approach to the development based on personal experience. It could be debatable, if this process is supported by SAP. But since the IMPORT of the XML file feature is provided in HANA Studio and the Re-imported model can be validated and activated in HANA studio, I believe the process does not have any negative impact.
Apart from the above mentioned use cases, there could be multiple other use cases, where the XML file modification can help you in the development.
So I leave it to your better judgement on the alternative approach, which can help you reduce your development effort. 🙂