Extending HANA Live Views
In this blog I will describe how we can extend HANA Live Views
I hope many of you are familiar with HANA Live.
If you are not familiar with HANA Live, then you can refer the below blog:
To extend HANA Live Views we generally make a copy of it and then make changes to it as per our needs.
You can check the document given in the blog mentioned above on how to extend HANA Live Views.
Now SAP has created a new tool called SAP HANA Live Extension Assistant.
Using this tool we can easily extend Reuse Views and Query Views.
Lets start with the Installation of Extension Tool:
First download HANA Content Tools from Service Marketplace and then import Delivery Unit HCOHBATEXTN.tgz
Once this Delivery Unit is installed, we can see the extn folder as shown in the below screenshot.
It also generates a role sap.hba.tools.extn.roles::ExtensibilityDeveloper and we will need to assign this role to the User to work with this tool.
Now to complete the installation, Go to Help -> Install New Software and click on Add button and enter the details as shown below:
The path would be http://hostname:80[instancenumber]/sap/hba/tools/extn
On clicking OK, we will see the Extension tool and then we need to install it
Once this tool is installed, and we R-Click on any View, we can see the option Extend View.
This option is enabled only for HANA Live Reuse and Query Views and disabled for Private Views as shown below.
We can easily identify Query Views from HANA Studio as they end with Query but we can’t distinguish between Reuse and Private Views.
So to know which View is a Reuse View and which View is a Private View, logon to HANA Live Browser and check there as shown below.
Lets say that we want to make changes in the GLAccountInChartOfAccounts Reuse View, so we will R-Click on that view and select Extend View and then we will be greeted with the below screen
It will create a new View with the same name as the Reuse View
Here we will select the package where we want Extended View to be created.
All the fields that are present in the Reuse View are marked as Grey and we cannot change them
On the left side, we get list of all the tables that are used in the View.
These tables only show those fields that are not used in the View
So we can select any field from the table and add it, lets say we want to select SAKAN field from the table, so we will click on SAKAN field and then Click on the + button on right side of the screen, this will add it to our view
Then we will select Next… by default the Join type is Left Outer Join and we cannot change it but we can change the Cardinality of the View
On the right side, it shows fields for Join. As the table SKA1 is already used in this View, so it proposes fields for Join, we can either use these fields or add our own fields by selecting + button as shown below
Then we will Validate and Activate the View
The Extended View copies the semantic properties of the Reuse View – if Semantic Node in Reuse View is Projection then in Extended View also the Semantic Node will be Projection
Below is the newly created view.
We can also observe one more thing that after installing Extension tool, the Join Node and other Nodes are shown in a more elegant and colorful way
Now lets extend GLAccountInChartOfAccountsQuery Query View
R-Click on the View and select Extend View, then we will see the below screen
By default it takes the package in which we extended Reuse View earlier
It shows us those columns which are present in Query View but are not selected in Output
We can also select our extended Reuse View and then its additional fields are also available to be added to the output as shown below
Lets select both the fields and Validate and Activate the View
Both the Views are available inside ExtTest Package as shown below
Now Lets check out the Extended Query View and now we can see that both our selected fields are present in the View
The tool has both its benefits and limitations:
It is a simple tool.
It is easier to extend an existing Query or Reuse View if we just want to add additional Columns from the underlying Tables the View is already using
If we update HANA Live Views later on then out Extended View also get updated
It has many limitations at present
We cannot extend Query Views with Unions and we can also not directly extend Query Views in which Aggregation Node is present at levels other than Top Node(Node before Semantic Node).
At present we can not add fields from other Tables(Tables that are not used in a View) to an existing Reuse View, but hopefully this option will be available in next version
We cannot create Calculated Columns or change Filter options
Hopefully, this tool will get better with time