Sie sind auf Seite 1von 13

Exercise 2: Creating Attribute Views

Exercise Duration: 20 Minutes

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

HYD (use STUDENT01 -20)


Gurgaon (use STUDENT21 -30)
Mumbai (use STUDENT31 -35)
Bangalore (use STUDENT36 -50)

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

Figure 70: Add tables

Join tables with a Inner join and cardinality 1:1.

Figure 71: Creating joins

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

Figure 72: Add columns to output

In the Semantics view, define all columns as attributes, making PARTNERID a Key
Attribute

Figure 73: Define semantics

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.

Figure 74: Add tables

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.

Figure 75: Add columns to output

In the Semantics view, define all columns as attributes, making


PRODUCTID a Key Attribute

Figure 76: Define semantics

Save and Activate.


From the context menu of AT_HA300_UNIT3_TRAINXX, view the results by
selecting Data Preview.
In the Data Preview, select the Raw Data tab to see the actual data.
Close.

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

Figure 77: Add tables

Add the following Attribute views from your Package, STUDENTXX:


AT_HA300_UNIT3_BP_TRAINXX and
AT_HA300_UNIT3_PD_TRAINXX

Choose OK.

Figure 78: Add Attribute Views

Figure 79: Set properties

In the DATA FOUNDATION, join the two tables.


Table PO.HEADER is the left table.
Join the field PURCHASRORDERID from PO.HEADER to the
PURCHASEORDERID.PURCHASEORDERID field in PO.ITEM.
For the join properties, select Referential join and a cardinality of 1:n for both joins
in the properties of the join.
From the table PO.HEADER, define the following fields as Attributes
PURCHASEORDERID
PARTNERID.PARTNERID
From the table PO.ITEM, define the following fields as Attributes
PURCHASEORDERITEM
PRODUCTID.PRODUCTID
GROSSAMOUNT

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.

Figure 82: Define joins

In the Semantics screen, define the column PURCHASEORDERID &


PURCHASEORDERITEM as an attribute, and the columns GROSSAMOUNT and
NETAMOUNT as measures.

Figure 83: Define semantics

Save and Activate.


View the Log. From the context menu of AN_HA300_UNIT3_PO_TRAINxx, select
Data Preview to review the contents.
Close.

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.

Figure 85: Create a derived attribute

Can you modify the derived attribute view?


Save.
Activate the Derived Attribute View, AT_HA300_UNIT3_PD_DERIVED.

Figure 86: A derived attribute view

Das könnte Ihnen auch gefallen