Skip to Content
Author's profile photo Ravindra Channe

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.

Generate_XML_1.JPG

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

Export_option.JPG

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 :

base_model.JPG

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.

currency_setting_initial.JPG

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.

currency_conversion_xml.JPG

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:

currency_setting_final.JPG

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:

restricted_kf.JPG

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.

calculated_kf.JPG

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:

model_after_import.JPG

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. 🙂

Assigned Tags

      13 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Raj Kumar S
      Raj Kumar S

      Hi Ravi,

      Excellent one. Got opportunity to learn from you 🙂

      Regards

      Raj

      Author's profile photo Lars Breddemann
      Lars Breddemann

      Thumbs up, Ravi!

      Author's profile photo Ravindra Channe
      Ravindra Channe
      Blog Post Author

      Thanks a lot Raj, Lars.

      Learning opportunity is mutual. I get to learn a lot from both of you and others as well. 🙂

      Regards,

      Ravi

      Author's profile photo Rama Shankar
      Rama Shankar

      Nice blog  - Thanks Ravi

      Author's profile photo Former Member
      Former Member

      Very informative blog ravi,,

      Thanks for all your efforts.

      Regards,

      Mahesh

      Author's profile photo Fernando Da Ros
      Fernando Da Ros

      Hi Ravindra,

      I'm used to do these tricks but I need to came here and congratulate you because it's not only informative but also a beatiful document.

      Thanks for share.

      Best regards, Fernando Da Rós

      Author's profile photo Ravindra Channe
      Ravindra Channe
      Blog Post Author

      Thank you Rama, Mahesh, Fernando for your kind words. 🙂

      Regards,

      Ravi

      Author's profile photo Former Member
      Former Member

      Absolutely great 🙂

      Author's profile photo Former Member
      Former Member

      Thanks Ravi for sharing your explorations

      Author's profile photo Prashanth Dsouza
      Prashanth Dsouza

      Indeed a great new perspective to data modelling in Enterprise HANA!

      Author's profile photo Parameswari Paramasivam
      Parameswari Paramasivam

      This really helped us out! We have hundreds of measures in the Calc View for which currency conversion has to be done. XML modification saved the time and effort in doing this!

      Author's profile photo Valentin Franke
      Valentin Franke

      Hi Parameswari Paramasivam,

      could give an example how the XML today looks like? I am trying to do the same in SAP BW Eclipse but am kind of stuck.

      Author's profile photo Valentin Franke
      Valentin Franke

      Hi, Ravindra Channe

      thank you very much for this blog post. When I today export Restricted Figures the XML file looks very different. Could you perhaps give an update?