Legacy: SAP HANA Analytic view
Welcome back fellow learners to our SAP HANA Tutorial where we would learn about SAP HANA Analytic View. These are the third type of HANA information views we would be learning after Calculation views and Attribute views which we have gone through already.
Note: Analytic views, just like attribute views are no longer recommended to be used in development. Calculation views with Data Category “CUBE” should be used instead. Thus, this tutorial is created with a “Legacy” title. The only reason to still include this in our tutorial is due to the fact that some projects still have analytic views passed on from their old developments. The only case where you should create a new analytic view is when due to some performance issue, someone from SAP support team recommends you to create one (which is again, a rare scenario).
Building an analytic view
To create a new analytic view, right click on your package New Analytic View.
The familiar window opens up again asking for a technical name and description.
Provide the details and press Ok.
The below flow opens up. In this case, we have a Semantics node as always, a data foundation where tables are added and in addition, there is a Star Join node which as you see below already has the Data Foundation as one of its input as default.
As in the attribute view, the data foundation only accepts tables. No views can be added here to the join. But, in an analytic view, there must be exactly one central transaction table. This means that you can add more transaction tables to the join provided they only supply attributes and all of their measure fields are disabled. Usually, there is only one transaction table and other master data tables. The result of this join passes on to the Star join.
The star join contains the data foundation already. It also accepts attribute views but no individual tables can be added here. It is called a star join because an analytic view is basically a star schema structure in itself –a central transactional data table surrounded by master data.
To start, let’s build a view with fields employee ID, country and salary coming in from EMP_SALARY and also the field first name from EMP_NAMES table.
Pull both these tables into the data foundation node.
The two tables now become available. The next step is to enable the fields we need.
Once the fields are enabled as below, the join link needs to be built based on the join condition.
Employee ID field connects both tables and hence connect those two fields by drag and drop. This establishes a referential join link between these tables by default. Click on the linking line between the two tables to enable the join properties window on the bottom right. Switch the Join type as required. In this case, switch it to left outer join with the transaction table on the left.
The join properties would reflect this change.
Click on the Star Join node and you would see the result of the data foundation as if it were an independent table. Let’s not add anything here for now.
Save and activate this view. Execute a data preview when done.
The data preview returns the below data as required. Thus our first analytic view has been successfully constructed.
Now, let’s take up an additional scenario wherein we take some Employee master data from the Attribute view we built in the previous tutorial.
Firstly remove the EMP_NAMES table from the data foundation by right clicking on the table and then choose remove from the context menu.
The below warning pops up telling you that the further data flow for the fields of this table would also be removed, Press Yes to confirm.
The Impacts will also be mentioned in a separate information message. Press OK.
Now, we add the EMPLOYEE_DETAILS attribute view created in the previous tutorial to the Star join node. As explained earlier, we add it here as views cannot be added in the data foundation.
Click on the Star join node and you would see that all the fields from this view are auto-enabled by default to the output.
Disable the fields you don’t need and also enable a join between them as we did earlier.
Save and activate this view. Execute a data preview to confirm that the analytic view works perfectly as desired.
This ends our tutorial on analytic views. I hope this was helpful.
If you feel the website helped you, please also contribute any small amount by using the “Donate button” on the right side of this page to help with the operational costs of this website and other systems involved.
Share, subscribe and comment on this tutorial to help others reach this website.