Tuesday, 20 January 2015

Attribute View creation in SAP HANA(Using Single and Multiple Tables)

In this document, I am going to explain the steps involved in creating Attribute View in SAP HANA.
We can create Attributes Views....

1) Using single or Multiple Tables
2) Using existing attribute view to enhance your current one ( you want to show material description for each material number).

1) Using Single or Multiple Tables:
The below diagram shows the major steps involved in creating Attribute View.

SAP HANA Tutorial

The pre-requisites to create Attribute View are..
i) Tables should exist with data
ii) Package should exist.

In my earlier documents I have shown how to create tables and package.

Now we will discuss the steps involved in creating Attribute View.
Step1: Right click on your Package -->New -->Attribute View.

SAP HANA Multiple Table

Step2: Give the technical name, description and type of attribute view.

SAP HANA Tutorial, SAP HANA Certifications, SAP HANA Material

We can create Two types Attribute Views.
i) Standard
ii) Time
If we are creating Time type Attribute View then we have to mention which type of time data system has to use (Gregorian/Fiscal). We are not going to discuss this here.
We have below options also while creating Attribute Views
i) Copy from: If you want to use already existing attribute view s template then go for this(you can modification if required for current one).
ii) Derived: This is kind of reference type. You cannot do modifications to the current one (Do the changes for main one).
click on next to proceed further.
Step3: In the next screen, we have to select the tables on which we are going to build Attribute View.
for this example I am using 'CUST_INFO' and 'SALES_EMPLY' tables. Here we can select single or multiple tables (using control key), however I am going to select one table here and I will show how to add tables later.
Drill down appropriate schema, select the tables and click on 'add' to move to right side.

SAP Certifications, SAP HANA Tutorial

Click on 'Finish' to go to the Modeler Screen.
Define Key Attributes: These are used as the keys when we join this Attribute with another Attribute or Analytic View. Right click any attribute --> Add as Key Attribute.

SAP HANA Certifications, SAP HANA Analytics

Define Attribute: We have to explicitly define the attributes which are all we need in output. Right click on Attribute --> Add as Attribute.
In this example I have taken 'Customer_Number' as key attribute, 'Customer_name' and 'Customer_Location' as attributes.
We can see the output structure in Right side.

SAP HANA Single and Multiple Tables

Step4: Now I want to populate the sales employee information for each customer in same Attribute View?
I have created table 'Sales_Emply' but how to add this table to this view.
Using the 'Plus' in the same screen(right top), we can add the table to this existing attribute view.

Now click on 'Add table' and search for the table with name and click on Ok.

SAP HANA Attribute View

Note: Disadvantage with this is we can not add more than one table at a time.
Step6: Define the joining condition between this two tables. Here I have joined Customer Number from both the tables.

SAP HANA Certifications, SAP HANA Material
The different types of Joins available in SAP HANA are.
i) Referential
ii) Inner
iii) Left Outer
iv) Right Outer
v) Text Join

Step7: Creating Hierarchies is optional while creating Attribute Views. In SAP HANA we can create two types of Hierarchies.
1) Level Based -- This is one to one mapping(one attribute one hierarchy)
2) Parent-Child -- This is one to many(one attribute can have multiple hierarchy levels)

Step8: We have to save the attribute view and then activate it. Only activated views will be available for reporting clients and data preview as well.
We can identify the difference between saved or saved and activated with rhombus' symbol. Only saved views will have rhombus' symbol.
After Save and Before Activation:

SAP HANA  Attribute View

After Activation:

SAP HANA Certifications, SAP HANA Single and Multiple Tables

Once the view is activated system will create 'column view' for each view and this will be stored in '_SYS_BIC_ schema.The naming convention of the column view will be as follows.
<Package Name>/<View Name>

Step9: The  of the beauty of SAP HANA is 'Data Preview' feature.Once the view creation was done, we can directly analyze the data in view in different perspectives.
The 3 options available in Data Preview are
i) Raw Data
ii) Distinct Values
iii) Values.

SAP HANA , SAP, SAP Certifications

Source: scn.sap.com

No comments:

Post a Comment