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.

SAP HANA Analytic view SAP HANA Tutorial

The familiar window opens up again asking for a technical name and description.

SAP HANA Analytic view SAP HANA Tutorial

Provide the details and press Ok.

SAP HANA Analytic view SAP HANA Tutorial

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.

SAP HANA Analytic view SAP HANA Tutorial

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.

SAP HANA Analytic view SAP HANA Tutorial

The two tables now become available. The next step is to enable the fields we need.

SAP HANA Analytic view SAP HANA Tutorial

Once the fields are enabled as below, the join link needs to be built based on the join condition.

SAP HANA Analytic view SAP HANA Tutorial

1

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.

SAP HANA Analytic view SAP HANA Tutorial

The join properties would reflect this change.

SAP HANA Analytic view SAP HANA Tutorial

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.

SAP HANA Analytic view SAP HANA Tutorial

The data preview returns the below data as required. Thus our first analytic view has been successfully constructed.

SAP HANA Analytic view SAP HANA Tutorial

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.

SAP HANA Analytic view SAP HANA Tutorial

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.

SAP HANA Analytic view SAP HANA Tutorial

The Impacts will also be mentioned in a separate information message. Press OK.

SAP HANA Analytic view SAP HANA Tutorial

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.

SAP HANA Analytic view SAP HANA Tutorial

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.

SAP HANA Analytic view SAP HANA Tutorial

Disable the fields you don’t need and also enable a join between them as we did earlier.

SAP HANA Analytic view SAP HANA Tutorial

Save and activate this view. Execute a data preview to confirm that the analytic view works perfectly as desired.

SAP HANA Analytic view SAP HANA Tutorial

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.

<<Previous Tutorial                                                         >Start with SQL for HANA Tutorial>    

Tagged , .

82 Comments

  1. I think there is a use case scenario for Analytical view when we are working on BW on HANA landscape . Its used to import DSO’s build in BW layer, when imported gets converted to AV’s

Leave a Reply

Your email address will not be published. Required fields are marked *