Skip to Content
Author's profile photo Adinarayanan MN

How to create Attribute View in SAP HANA

Attribute View

Hi all. In this document I will be walking you through what is an attribute view and how to create the same.

What is an attribute view:

An attribute view can be regarded similar to master data/dimensions in SAP BW system. This can be joined with analytic

views to produce a star schema based structure. The same attribute view can be reused in multiple analytic and calculation views.

The following are types of Attribute View:

1. Standard

2. Derived

3. Time

Here we will see how to create a standard attribute view.

Creation of Attribute View:

Before starting with creation of attribute view, the following are the required privileges/roles need to be assigned to your user:

  1. Access to schema from which your source tables are going to be fetched. If the source tables are present in your schema,

then you will be having full access by default.

  1. Modeling role.
  2. Select on your schema should be granted to _SYS_REPO user.

Log into SAP HANA system, and confirm whether you have all the above said Privileges/Roles and then

open SAP HANA Modeler perspective.

Right click on the package “Example” as shown below:

Image 01.jpg

Select New -> Attribute View as shown below:

Image 02.jpg

Enter the details the blow details in the dialog box that appears:

Name: ATTR_VIEW_01

Label: ATTR_VIEW_01 (by default the value for label will be taken from the Name field). This can be left as it is.

Package: Example (This cannot be modified. The package name under which this attribute view is being created will be displayed here).

Subtype: Standard (There are various subtypes which we will see later, for now choose standard).

Image 03.jpg

After keying in all the details click on “Finish” button to create the attribute view.

Note: We have not yet created the attribute view, but just the skeleton of it is created.

Image 04.jpg

In the left pane, the layout of the attribute view can be seen. It is split into two parts:

  1. Semantics
  2. Data Foundation

The screen on right side pane will changed based upon what is selected in the left pane.

Data Foundation:

As the name implies, this is the foundation of this attribute view. A data foundation can contain multiple column tables.

Let us add the table “ARTICLE_COLOR_LOOKUP” which is present in schema “EFASHION_TUTORIAL”.

Image 05.jpg

Drag the table ARTICLE_COLOR_LOOKUP and drop it into the “Data Foundation” box.

Once the table is dropped into data foundation, the below details will be displayed in the right side pane as shown.

Image 06.jpg

Select field “ARTICLE_ID” to enable it in output of attribute view. Once “ARTICLE_ID” is selected the button near the field

will turn into Orange colour. Also the same can be seen in the output pane displayed under “Columns”.

Image 07.jpg

Similar to ARTICLE_ID, select other required fields to be displayed in output of attribute view.

Go to “Semantics” node.

Image 08.jpg

Here you can see what all fields are added to the output of attribute view, type of the field (here it is attribute which is symbolized

by the blue coloured trapezoidal icon). If any of the column is required not to be displayed in the output, but is required for

granularity of data, then the same column can be made as hidden by using the check box “Hidden” in the semantics node.

Select the tick icon highlighted in below screenshot “Validate and Save”.

Image 09.jpg

The attribute view should now be saved and logs will be displayed.

Now select “Activate” button .

Image 10.1.jpg

The attribute view should get activated. The same can be seen in the Job Log.

Image 10.jpg

The above log will be displayed in red if the activation got failed.

Now let us check on the data that this attribute view can display. Click on the “Data Preview” button as shown below.

Image 11.jpg

Select “Raw Data”. The data will be displayed in table format.

Image 12.jpg

The tab “Analysis” will provide you with a graph overview:

Image 13.jpg

Distinct values will give count of distinct value present in the selected attribute:

Image 14.jpg

Let us add some more complexity to this attribute view by adding one more table “ARTICLE_LOOKUP” in the data foundation as below:

Image 15.jpg

Select all the fields from the output and click remove to remove all the fields.

Image 16.jpg

Select the fields “ARTICLE_ID” and “CATEGORY” from the table “ARTICLE_LOOKUP”

Image 17.jpg

Select the node “ARTICLE_ID” from table “ARTICLE_LOOKUP” and join it with the field “ARTICLE_LOOKUP”


Note: In the attribute view the direction of Join decides which table is left table and which is right table. As we join ARTICLE_ID from table

ARTICLE_LOOKUP to ARTICLE_ID of table ARTICLE_COLOR_LOOKUP, the table ARTICLE_LOOKUP is left table and table

ARTICLE_COLOR_LOOKUP becomes the right table.

Image 18.jpg

Choose the Join (link) between the two tables and check the properties pane. Here you can identify which table is selected as

left element and which is selected as right element. Also the default Join type is “Referential Join”.

Note: The direction in which you perform the join decides which is right and which is left table.

Referential join acts as inner join when in report fields from both tables are selected. If in report, field from only left table is selected,

this join acts as left outer join.

As join is always not performed in referential join its performance is better compared to an inner join.

We have also selected the field COLOR_CODE from table “ARTICLE_COLOR_LOOKUP”. So when we check data preview, for all values

of ARTICLE_ID present in table “ARTICLE_LOOKUP” the corresponding entries of “COLOR_CODE” is selected from table


Activate this attribute view, it will throw an error.

Image 19.jpg

Image 20.jpg

The error is that “No key attribute has been specified”. If you remember, we did not encounter any error while activating the attribute view with

a single table in data foundation. This is because, when there is only one table in data foundation, it is not mandatory to select an attribute as

key field. But when there are more than 1 table present in the data foundation, it is mandatory to select at least 1 field/attribute as key.

Select the field “ARTICLE_ID” from output pane and set its Key Attribute property to “TRUE” in the properties pane as shown below:

Image 21.jpg

Now click on “Save and Activate”. Check the Job log, the activation is successful.

Image 22.jpg

Now check data preview:

Image 23.jpg

The selected fields alone are displayed in output.

The different tables present in data foundation can be joined with one another using the below Join types:

  1. Referential Join (default type)
  2. Inner Join
  3. Left Outer Join
  4. Right Outer Join
  5. Text Join (This is applicable only when you have a language field in text table, and is possible only within an attribute view)

Hope you all would find this document useful. Thanks.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Adi,

      Nicely written article. Thanks for Sharing.


      Author's profile photo Former Member
      Former Member

      Good work, keep posting more blogs on advanced concepts of  HANA.

      Best Regards