torstai 21. maaliskuuta 2013

Creating Calculation View

In this document, I tried to explain “how to create Calculation view in SAP HANA studio”.

Calculation views are used to create your own data foundation using database tables, attribute views, and analytic views to address a complex business requirement. When running a calculation view it is executed by the Calculation Engine. It should however be noted that it may not be as fast as an Analytical View.

Calculation view is a column view that is visible to reporting tools. When the view is accessed, a function is implicitly executed. There are two types of calculation views i.e. Graphical view (Composite views, re-uses Analytical and Attribute views) and SQL/SQL Script/Custom Functions.

Procedure for creating Calculation view:

1. Navigate to the Calculation View under your Sulabh package. Right click package, select New and choose Calculation View to create a new Calculation View. Name your calculation view, Description, Specify view type Graphical and select your schema. Click on Next.


2. Since we will be reading from existing Analytical Views i.e. you do not have to select any tables from the catalog folder -> Expand Content folder -> Select the previously created Analytical Views -> Click finish button.


3. As a result the Graphical Calculation View editor will open.


4. From the Tools Palette select 2 Projection graphical nodes one for each Analytical View. Double Click on each Projection node to rename.


5. Add a Union Graphical node and rename the node to Union. With the mouse pointer hover over each graphical node and draw a connection line between the nodes as shown on the below representing a data flow graph






6. Add all the fields of AN_ECC_PLANNING to the Output of the Pro_AP node. Select the Pro_AP node, within the details view select all the fields -> Right Click -> Add to Output



7. Add a new Calculated Column called KPLIKZ. In the diagram select the Pro_AP node. Within the Output right click on Calculated Columns -> New


8.  Enter KPLIKZ for the name of the field. Select INTEGER and enter 0 in the Expression Editor as the Planned Indicator value. Click OK.


9. Ensure the Calculated Column KPLIKZ is visible in the Output of Pro_AP.


10. Proceed to work on the Pro_PP node. As before add the field KPLIKZ but this time set the Expression value to 1 as an indication for planned data.


11. Add all the fields of AN_ECC_29012013 to the Output of the Pro_PP node. Select the Projection A node, within the details view select all the fields -> Right Click -> Add to Output


12. Select on UNION_AP_PP and use automatic by name



13. Click on the Output Node in the main diagram. Within the Details view pane select each field -> Right Click -> ‘Add the field as Attribute (Material_Number, Material_Description, Region, LAND1, city, Landx, PERIO, VKORG, KPLIKZ’) or as Measure (Gross_Revenue, Sales_Deduction, Production_Variance, Other_Expenses, Net_Revenue, CM1, and CM2).


14. Save validate, activated and data-preview of calculation view



Sulabh Bartaula 
SAP HANA certified consultant 
+358 40 4163 717 
sulabh.bartaula@sapfox.com

Ei kommentteja:

Lähetä kommentti