HANA Modeling Exercises
HANA Modeling Exercises
HANA Modeling Exercises
Exercise Objectives
After completing this exercise, you will be able to:
Create Standard and Derived Attribute Views
Create Analytical Views
Create and Use Calculated Attributes in Attribute Views
Business Example
You are at a customer site where SAP_HANA_DEMO schema is available.
Information of the Business Partners is dispatched in several tables. The purpose
will be to regroup Information of the Business Partners and to analyze Purchase
Orders by Product and Partners.
So you have been asked to build Attribute Views and Analytic Views for HANA.
This section takes you through the process to create the Attribute Views and
Analytical Views to be used for reporting.
Task 1:
Create your packages in Content folder. For ex.
STUDENTXX
For
For
For
For
Close all open views prior to creating a new attribute view for Business Partners.
1. Create an attribute view AT_HA300_UNIT3_BP_TRAINXX (xx being your student
number), with description Business Partners. Use your package STUDENTXX. (If it
does not exit, please create a new one.)
Attribute Type: Standard
Press Next.
Add the following tables in the Data Foundation, from the SAP_HANA_DEMO
schema, to define the view and click Finish when done:
BusinessPartner
Addresses
Add to Output (right click on the table on the Data Foundation tab) from
BusinessPartner Table:
PARTNERID Key Attribute
EMAILADDRESS Attribute
PHONENUMBER Attribute
Add to Output from Addresses Table as Attributes
ADDRESSID
COUNTRY
In the Semantics view, define all columns as attributes, making PARTNERID a Key
Attribute
Activate.
View the logs. Dependent objects that are already active should not get reactivated.
From the context menu of ATTRVIEW_STUDENTXX, view the results by selecting
Data Preview.
In the Data Preview, select the Raw Data tab to see the actual data.
There is also a provision to add CALCULATED COLUMNS to the Attribute view.
Right click on the Calculated Columns to create a new column. (We are adding a
new Column MOD_PHONE1 to the view).
Enter the name of the column and description. Provide a valid expression for the
calculated column.
Activate.
View the logs. Dependent objects that are already active should not get reactivated.
From the context menu of ATTRVIEW_STUDENTXX, view the results by selecting
Data Preview.
In the Data Preview, select the Raw Data tab to see the actual data.
Close.
Task 2:
Create an attribute view for Products.
1. Create an attribute view AT_HA300_UNIT3_PD_TRAINXX (XX being your
student number allocated), with description Products.
Attribute type: Standard.
Add PRODUCTS table in the Data Foundation tab.
Finish.
Define the following fields (add to Output doing a right click on the table in the Data
Foundation tab):
PRODUCTID Key Attribute.
TYPECODE Attribute.
CATEGORY Attribute.
SUPPLIERID.PARTNERID Attribute.
Task 3:
Create an Analytic View for Purchase Orders.
1. Create an analytic view AN_HA300_UNIT3_PO_TRAINXX (xx being your student
number allocated), with description Purchase Orders. .
Press Next.
Add the following tables in the Data Foundation tab:
EPM.PO.HEADER
EPM.PO.ITEM
Choose OK.
NETAMOUNT
In the logical view, join the data foundation to the Procduct view with the following
fields.
PRODUCTID to PRODUCTID_PRODUCTID (Product View).
Use referential join and cardinality of n:1.
Then, join the data foundation to the Business Partner view with the following
fields.
PARTNERID to PARTNERID_PARTNERID (Business Partner View).
Use referential join and cardinality of n:1.
Task 4:
Create a derived attribute view from the Product view.
1. Try to add the Attribute View, AT_HA300_UNIT3_PD_TRAINXX , to the analytic
view AN_HA300_UNIT3_PO_TRAINXX again, by dragging the
Attribute View from the Navigator to the Logical View of the Analytic View.
What is the result? (Not possible).
Note: To add another Attribute view to an existing Analytic View, just select the
Attribute from the Navigator and drag it into the Logical view of the Analytic View. If
you try to drag an Attribute
View into an Analytic View that already exists in the Analytic View, it will not work.
If your model requires that you have 2 identical Attribute Views in the same
Analytical View, you will have to create a Derived Attribute with Aliases.
Create a new Attribute View, AT_HA300_UNIT3_PD_DERIVED, derived from
AT_HA300_UNIT3_PD_TRAINXX.
Note: To create a Derived Attribute View, choose Subtype: Derived from within
the New Information View screen.