Sei sulla pagina 1di 84

INTRODUCTION TO SAP HANA MODELING

RDP160
Hands-on Exercises
SAP TechEd 2013

Getting started with your session


Login credentials and group numbers can be found in the My Reservation tab on the SAP TechEd Virtual Hands-On
Workshops website (https://saptechedhandson.sap.com/).
Important: Some of the sessions use place holders for users (e.g. CD300_XX) or objects (e.g. ZCD400_Exercise_##).
The place holders XX or ## must be replaced with your assigned group number, which you find in the My Reservation
tab on the above mentioned website.

BEFORE YOU START


In this session RDP160 you have the opportunity work on several exercises that focus primarily on SAP HANA
Attribute- and Analytic Views for multidimensional reporting scenarios.
Different optional exercises have been prepared to allow you investigating advanced scenarios of your personal
interest. These also extend in making use of Calculation Views in for multidimensional reporting scenarios.
Due to time constraints during the Hands-on session, it is recommended that you first take an overview look at the
different exercises. Note, you should only work on the optional ones, if you are ahead of the timing, as the timings for
the sections are estimated without the optional exercises. Then, if at all, decide which optional ones you would like to
work through later.

Initial Setup ....................................................................................................................................................................... 3


Section 1 Designing Basic Attribute- & Analytic- Views [35mins] .......................................................................... 9
Exercise 1.1 Create a basic Attribute View ..................................................................................................................... 9
Exercise 1.2 Create a basic Analytic View ................................................................................................................... 14
Exercise 1.3 Exploring the Analytical Views with SAP Lumira (Optional) .................................................................... 19
Exercise 1.4 Enhancing Attribute- and Analytic View with calculated columns............................................................ 22
Section 2 Enhancing the Analytical View I [45mins] ............................................................................................... 29
Exercise 2.1 Creating an advanced Attribute View ...................................................................................................... 29
Exercise 2.2 Building Analytic Views with multiple Dimension-Attribute Views ............................................................ 35
Exercise 2.3 Adding a Variable Prompt to Analytic Views ............................................................................................ 41
Section 3 Enhancing The Analytical view II [25mins] ............................................................................................. 45
Exercise 3.1 Building Dynamic Views with Input Parameters ...................................................................................... 45
Exercise 3.2 Using HANA Unit Conversion with a Calculated Measures (Optional) .................................................... 49
Exercise 3.3 Using HANA Currency Conversion with a Calculated Measures ............................................................ 54
Section 4 Optional Exercises Section (Optional) .................................................................................................... 59
Exercise 4.1 Use Temporal Joins in Analytic Views for time-dependent Attribute Mapping (Optional) ....................... 59
Exercise 4.2 Restrict access to Analytic Views with Dynamic Modeled Analytic Privileges (optional) ........................ 65
Exercise 4.3 Building Multidimensional Calculation Views with DistinctCount-Measures (optional) ............................ 70
Exercise 4.4 Building Multidimensional Calculation Views integrating Plan/Actuals-Measures (optional)................... 77
Appendix ......................................................................................................................................................................... 83
ITeIO Enterprise Procurement Data Model Reference ................................................................................................. 83

INITIAL SETUP
During the exercises, you will work on a SAP HANA system with the following system properties:
Host name:
coe-he-084.wdf.sap.corp
Instance number:
10
SAP System ID (SID):
M31
Database user name:
RDP160_# (# = your assigned student ID, maybe 1 or 2 digits)
Password:
Welcome13
Database Schema
RDP160
Student exercise package RDP160.sessionX.# (X = your assigned session number, # = student ID)
Solution package
RDP160.solution

As preparatory steps, make sure a connection to the backend SAP HANA database system is defined with your
assigned user (RDP160_#).
Explanation
1. Start the SAP HANA Studio (SP6 Revision 61)
from the Windows-Start Menu.

Select Start > Programs > SAP > SAP


HANA > SAP HANA Studio SP6 (Revision 61)

Screenshot

Explanation
2. Open the Modeler Perspective from the SAP
HANA Studio start screen

In the Overview Start Screen Select > Open


Modeler

For the virtual Hands-on workshops the user and


password is unique and was changed before you get
access to the system.
Therefore the password of the secure store needs to
be recovered/unlocked.

You need to recover the password first.


Choose Window->Preferences

Screenshot

Explanation
Then open
General -> Security
-> Secure Storage

Click on Recover Password

Answer the questions


Question 1: 1972
Question 2: Hoffenheim
And click OK.

Screenshot

Explanation
And click OK.

And click OK.

Unlock the Secure Store by clicking on Unlock.


Now you can continue with the exercises.

If the Overview Start screen, doesnt show up,


open the Modeler Perspective
3. Either select
from the editor toolbar
or
select from the studio menu: Windows>Open
Perspective>

Screenshot

Explanation

Screenshot

4. Connect to the HANA System.

In the HANA Systems View right-click on the


background of the white area, then^

Select > Add System from the context


menu

5. Specify Connection details:


Enter the connection details

Host Name:

Instance Number: 10

Click > Next

coe-he-084.wdf.sap.corp

Enter your assigned user and password


credentials

User Name: RDP160_#


(replace # with your assigned student id)

Password:

Click > Finish.

Welcome13

Explanation
6. Explore the SAP HANA Database Catalog and
Repository Content structure for the Workshop
The Database Catalog, i.e. the SAP HANA
database schema with the tables for this
workshop is the schema RDP160.
To explore the schema:
Expand the Catalog folder > RDP160 >
Tables

Note: A data model overview is provided in


the appendix of the workshop notes.
In order to browse a table, right-click on the table
and select > Open Content from the context
menu.

The content area, where all the SAP HANA Model


content is stored in the HANA repository for this
workshop is also named RDP160.
To explore your assigned content folder package.
Expand the Content folder > RDP160 > your
assigned session folder > your assigned
student id

Note: Any SAP HANA Model you create


during this workshop will be stored in your
personal content folder package!
For your reference, the solution content for this
workshop is located under the Content folder >
RDP160 > solution.

Screenshot

SECTION 1 DESIGNING BASIC ATTRIBUTE- & ANALYTIC- VIEWS [35MINS]


Overview of Section 1 exercises

Exercise 1.1 Create a basic Attribute View


This exercise guides students how to create a basic SAP HANA Attribute View. You will use the graphical editor and
walk through the process of creating an attribute view getting familiar with the editors core components (scenario,
details, output, properties and semantic) and how basic activities are handled in the editor (selection, joins, ).
You will create and Attribute View for the Customer Dimension, based on the BusinessPartner,
BusinessPartnerContacts and the addresses-tables.
Steps and Explanation
1. Start and Open the Editor to create an
Attribute View

Navigate in the content tree to your


personal assigned content package

With the Right Mouse Button > Select New


> Attribute View

2. Enter the name of the Attribute View:

Name: S1EX1_DIM_CUSTOMER.

Description: accept the default value

Select Standard Attribute View

Click Finish

As a result the Attribute View editor will


open and appear.

Screenshot

10

Steps and Explanation


3. Select the table to use in the Attribute View
Drag and Drop the following tables from the
schema RDP160 into the Data FoundationNode within the scenario area of the editor:

BusinessPartner

Addresses

BusinesPartnerContacts

4. Create the join definition in the Data


Foundation details area
Note: to maximize the editor workspace use
keyboard shortcut Cntrl + M.

Select Data Foundation


in the scenario

In the details area of the


editor re-arrange the tables as appropriate

To create the joins click and select the


PartnerId column from the BusinessPartner
table and drag it
to the ContactId column of the
BusinessPartnerContacts table.

Click and select the AdressId column from


the Adresses table and drag it to the
AdressId column of the
BusinessPartnerContacts table.

Note: At the right bottom of the editor in the


property area, additional join properties (type of
join, column cardinality) can be specified.

The join type should be defaulted to


Referential, which refers to a special inner
join.

Note: The cardinality property can be left


empty, it is determined and run-time by the
HANA engines.
If specified wrongly a suboptimal join path may
be chosen or unexpected result sets returned.

Screenshot

11

Steps and Explanation

Screenshot

5. Add a Filter to the BusinessPartner-Table


column PartnerRole in order to select only
customers from the table and not partners or
suppliers.

In the details area, right click on the column


PartnerRole on the BusinessPartner table.

Select Apply Filter

Operation: Equal

Value: 01

6. Select columns from the Data Foundation


tables to be added to the output of the Attribute
View.
Note: You add a column to the output by
selecting (click) the grey icon ( ) to the left of
the column, which then switches to orange ( )
and the column appears added on the right in
the output area.

Select the following columns from the


BusinesPartnerContacts table
TITLE
FIRST_NAME
LAST_NAME
SEX
PHONE_NUMBER
EMAIL_ADDRESS
ContactId

Select the following columns from the


Addresses table
CITY
COUNTRY

In the output area move ContactId to the


top of the column list using move-uptoolicons (

Alternatively to add columns,


right-click on selected
columns, then from the
context menu you can choose
Add to Output.

12

Steps and Explanation

Screenshot

7. Review the View Output Semantic and


specify the KEY Attribute for the Attribute
View.

Select Semantic in the scenario area

In the column pane of the details area,


select the ContactId attribute and from the
type drop-down selector choose key
attribute.
The icon changes from
attribute.

to

for the key

Review the Attribute View output structure


and confirm that your model is equivalent to
the image on the right.

8. Validate the Attribute View with internal model


validation checks.

Click the validate icon (


) on the top right
toolbar of the editor to validate the model.

Confirm that the validation job completed


successfully by opening the SAP HANA
Modeler Job-Log-Eclipse View (

).

Note: If not yet opened, you can open the


Job-Log-View from the Eclipse menu Window >
Show View > Other > Modeler > Job Log

By double-clicking on the newest (top)


entry in the Job-Lob View current list,
validation job details can be reviewed and
reasons for potential errors can be
identified.
Errors or warnings would indicate that the
model cant be activated in the current
state.

13

Steps and Explanation


9. Activate the Attribute View

Click the Save and Activate icon ( ) on


the top right toolbar of the editor to activate
the model.

Confirm that the activation job completed


successfully by opening the SAP HANA
Modeler Job-Log-Eclipse View .

Again by double-clicking on the last entry


in the Job-Lob View current list, activation
job details can be reviewed and reasons for
potential errors can be identified.

10. Preview the Attribute View.

Click on the Data Preview Icon (


) on the
top right toolbar of the editor to validate the
model.

As a result the Preview-View opens, where


the Views Output data can be explored
via
an Analysis-, Distinct Values- or RawdataViewer.
Here, choose raw data and the output data
(39 rows) are shown.

11. Review your assigned content folder


package.

Re-open the SAP HANA SystemView from its collapsed state on the
left or
use the keyboard shortcut Cntrl+M to
resize the Attribute View Editor back to its
previous non-maximized size.

Confirm that the attribute view you have


created appears in your package assigned
to you for this workshop.

Screenshot

14

Exercise 1.2 Create a basic Analytic View


This exercise guides students how to create a basic SAP HANA Analytic View. You will use the same graphical editor
walking through the process of creating an analytic view and getting familiar with its the additional capabilities, like
joining the Data Foundation with the Facts-data (measures) with Attribute Views in the Logical Join-Node of the
scenario.
You will create an Analytic View, joining the SalesOrder data with the Dim_Customer Attribute View created in the
previous exercise.
Explanation
1. Start and Open the Editor to create an
Analytic View

Navigate in the content tree to your


personal assigned content package

Right-click on your package, then from the


context menu choose Select New >
Analytic View

2. Enter the name of the Analytic View:

Name: S1EX2_FACT_SALESORDERS.

Description: accept the default value

Click Finish

As a result the Analytic View editor will


open and appear.

Screenshot

15

Explanation
3. Select the fact data table to be used in the
Analytic View
From the catalog tree in the SAP HANA
Systems View Drag and Drop the following
tables from the schema RDP160 to the Data
Foundation in the scenario area of the editor:

SALESORDER

4. Select the Attribute View to be used in the


Analytic View
In the content tree of the SAP HANA Systems
View from your personal assigned content
package Drag and Drop the following Attribute
View to the Logical Join-Node in the scenario
area of the editor:

S1EX1_DIM_CUSTOMER (Attribute View


was created in the previous exercise)

Then maximize the editor workspace again


with keyboard shortcut Cntrl + M.

5. Select columns from the Salesorder table to


be used in the Data Foundation of the Analytic
View.

In the Scenario area, select the Data


Foundation

Select the following columns from the


SALESORDER table by selecting the grey
icon ( ) to the left of the column, which
then switches to orange ( ) indicating the
selected status:
SalesOrderId
ParnterId
GrossAmount
NetAmount
TaxAmount
BillingStatus

Validate, that the column appears added


on the right in the output area.

Screenshot

16

Explanation
6. Create the join between fact data
of the Data Foundation and the
Attribute Data in the Logical JoinNode of the scenario area

In the Scenario area, select


the Logical Join-Node

In the details area of the editor re-arrange


the tables to your convenience.

To create the join click and select the


ContactId column from the
DIM_CUSTOMER attribute view
and drag it
to the PartnerId column of Data
Foundation.

At the right bottom of the editor in the


property area, change the join type
property from Referential to Left Outer.
The cardinality can be left empty, it is
determined and run-time by the HANA
engines.

Note: When drawing the join connection in


the Logical Join of an Analytic View, the Data
Foundation is always selected as the Left Outer
Table.

7. Review the output definition at the level of the


the Logical Join-Node.

Compare the output to the screenshot on


the right.
The attributes under the folder Attribute
Views in the Output pane are inherited from
the S1EX1_DIM_CUSTOMER Attribute
View that you included in the definition of
this Analytic View.

Note: Additional specification indicated on


the output area like calculated columns,
hierarchies, etc. will be worked with in later
exercises.

Screenshot
Join Defintion

17

Explanation

Screenshot

8. Review the View output semantic and specify


the column types.

Select Semantic in the scenario area

To quick-classify the columns deriving from


the Data Foundation to its default column
type, based on its column definition use the
Auto Assign-Tool (
the column area.

) at the right top of

Note: Column type Attribute (

) or

Measure (
) will be assigned as well as the
default aggregation-function for measure
columns.
Columns deriving from the Data Foundation are
displayed on the local-tab, inherited columns
from the contributing Attribute Views are
displayed on the shared-tab.

9. Validate the Analytic View with internal model


validation checks.

Click the validate icon (


) on the top right
toolbar of the editor to validate the model.

Confirm that the validation job completed


successfully by reviewing the Job-Log..

10. Activate the Analytic View

Click the Save and Activate icon ( ) on


the top right toolbar of the editor to activate
the model.

Confirm that the activation job completed


successfully by reviewing the Job-Log.

18

Explanation
11. Preview the Analytic View.

Click on the Data Preview Icon (


) on the
top right toolbar of the editor to validate the
model.

As a result the Preview-View opens, where


the Views Output data can be explored
via
Choose Analysis, then
select and Drag/Drop Column Country to
the Label Axis area
next select and Drag/Drop Column
GrossAmount to the value axis area.

12. Review your assigned content folder


package.

Re-open the SAP HANA SystemView from its collapsed state on the
left or
use the keyboard shortcut Cntrl+M to
resize the Analytic View Editor back to its
previous non-maximized size.

Confirm that the attribute view you have


created appears in your package assigned
to you for this workshop.

Screenshot

19

Exercise 1.3 Exploring the Analytical Views with SAP Lumira (Optional)
For preview purpose, you can optionally alternatively use SAP Lumira to explore SAP HANA Analytic and Calculation
Views. SAP Lumira is a self-service solution that makes it easy to combine, manipulate, transform and visualize
business data and analysis.
Explanation
1. Start the SAP Lumira from the Windows-Start
Menu.

Select Start > Programs > SAP > SAP


Business Intelligence > SAP Lumira > SAP
Lumira

2. Create a new SAP Lumira Document

Select New Document

Screenshot

20

Explanation

Screenshot

3. Specify the Data Source Type

Select SAP HANA ONLINE

4. Specify Connection details:


Enter the connection details

Host Name:

Instance Number: 10

coe-he-084.wdf.sap.corp

Enter your assigned user and password


credentials

User Name: RDP160_#


(replace # with your assigned student id)

Password:

Welcome13

Then Select Connect to SAP HANA Instance

21

Explanation

Screenshot

5. Select the SAP HANA View

Select S1EX2_FACT_SALESORDERS

6. Explore the Analytic View

Select Total GrossAMount from


Measures and Drag it to Y Axis 1

Select County and Drag it to X Axis

Note, if you choose to create a new visualization with different data, you have to go back to the step create
New Document, specify Data Source Type and connection details before you can select a different HANA View to
explore.

22

Exercise 1.4 Enhancing Attribute- and Analytic View with calculated columns
This exercise guides students how to create Attribute- and Analytic View based on existing views and how to created
calculated columns for both.
For the Customer Attribute View, we want to create a continent calculated attribute column and for the
SalesOrder Analytic View, we want to create a calculated measure for paid amounts.
Explanation
1. Start and Open the Editor to create an
Attribute View

Navigate in the content tree to your


personal assigned content package

With the Right Mouse Button > Select New


> Attribute View

2. Enter the name of the Attribute View:

Name: S1EX4_DIM_CUSTOMER.

Description: accept the default value

Select
Copy from and Browse to
navigate the content tree to select the
Attribute View from exercise 1.1 as the
starting point for the new Attribute View,
select S1EX1_DIM_CUSTOMER

Click Finish

As a result the Attribute View editor will


open and appear.

Screenshot

23

Explanation

Screenshot

3. Create a calculated column to enhance the


Attribute View:

Select Data Foundation in the scenario

In the output area and its top tool-list select


the new object tool (
) to open the
calculated column editor.

Specify the column details as follows:


Name:
Continent
Data Type: VARCHAR
Length:
12
Expression:
if("Country"='US', 'America', 'Europe')

Validate the column expression by selecting


and make use
expression specified is qualified as valid.

Then select OK

The calculated column in shown in the


output area. Calculated attribute columns
are shown with a specific icon (

).

4. Review the View output semantic.

Select the Semantic-Node in the scenario


area.

The calculated attribute column is similarly


shown in the semantic output column list
and indicated by the icon as type
calculated.

24

Explanation
5. Validate and Activate the Attribute View.

Click the validate icon (


) on the top right
toolbar of the editor to validate the model.

Confirm that the validation job completed


successfully by reviewing the Job-Log..

Click the Save and Activate icon ( ) on


the top right toolbar of the editor to activate
the model.

Confirm that the activation job completed


successfully by reviewing the Job-Log

6. Now, start and open the editor to create an


Analytic View with a calculated column.

Navigate in the content tree to your


personal assigned content package

Right-click on your package, then from the


context menu choose Select New >
Analytic View

Screenshot

25

Explanation
7. Enter the name of the Analytic View:

Name: S1EX4_ANV_SALESORDERS.

Description: accept the default value

Select
Copy from and Browse to
navigate the content tree to select the
Analytic View from exercise 1.2 as the
starting point for the new Analytic View,
select S1EX2_FACT_SALESORDERS

Click Finish

As a result the Analytic View editor will


open and appear.
8. Replace the existing S1EX1_DIM_CUSTOMER
Attribute View with the new one, containing the
calculated attribute column.

In the Scenario area, select the Logical


Join-Node

Right-click on S1EX1_DIM_CUSTOMER in
the Logical Join-Node, then from the
context menu choose Remove
and
confirm deletion when prompted.

When hovering with the mouse over the


Logical Join-Node, the context
pane appears and offers the add
ojects-tool.
Click Add Objects

Type S1EX4
and then select the previously created
AttributeView, which is stored in your
personally assigned content package:
S1EX4_DIM_CUSTOMER.

Screenshot

26

Explanation
9. Recreate the join relationship between the
existing Attribute View and the Analytic View
Data Foundation (Refer to Ex1.2 step 6).

In the details area, to create the join click


and select the ContactId column from the
DIM_CUSTOMER attribute view
and drag it
to the PartnerId column of Data Foundation.

Select the join connection. Then at the right


bottom of the editor in the property area,
change the join type property from
Referential to Left Outer.

10. Create a calculated column to enhance the


Analytic View:

Select Logical Join in the scenario

In the output area and its top tool-list select


the new object tool (
) to open the
calculated column editor.

Specify the column details as follows:


Name:
Paid_GrossAmount
Data Type: DOUBLE
Column Type: Measure
Expression:
if("BillingStatus"='P', "GrossAmount", 0)

Tip: Select arguments to the expression


from the lower boxes (Elements, Operators,
Functions).

Validate the column expression by selecting


and make use
expression specified is qualified as valid.

Then select OK).

Screenshot

27

Explanation

Screenshot

11. Review the View output structures.

In the logical join output definition area


on the right the calculated columns are
shown and indicated with the calculated
measure icon (

).

Similarly in the semantic-node output


column list and indicated by the icon as
type calculated.

12. Validate and Activate the Analytic View.

Click the validate icon (


) on the top right
toolbar of the editor to validate the model.

Confirm that the validation job completed


successfully by reviewing the Job-Log..

Click the Save and Activate icon ( ) on


the top right toolbar of the editor to activate
the model.

Confirm that the activation job completed


successfully by reviewing the Job-Log

28

Explanation
13. Preview the Analytic View.

Click on the Data Preview Icon (


) on the
top right toolbar of the editor to validate the
model.

As a result the Preview-View opens, where


the Views Output data can be explored
via
Choose Analysis, then
select and Drag/Drop Column Continent to
the Label Axis area
Next select and Drag/Drop Column
GrossAmount and Paid_Gross_Amount to
the value axis area.

Screenshot

29

SECTION 2 ENHANCING THE ANALYTICAL VIEW I [45MINS]


Overview of Section 2 Exercises

Exercise 2.1 Creating an advanced Attribute View


This exercise guides students how to create an enhanced Attribute View for the Product Dimension, including
hierarchies for multidimensional reporting clients and make use of text joins to enable use of language-specific
product names.
Explanation
1. Start and Open the Editor to create an
Attribute View

Navigate in the content tree to your


personal assigned content package

With the Right Mouse Button > Select New


> Attribute View

2. Enter the name of the Attribute View:

Name: S2EX1_DIM_PRODUCT.

Description: accept the default value

Select Standard Attribute View

Click Finish

As a result the Attribute View editor will


open and appear.

Screenshot

30

Explanation
3. Select the tables to use in the Attribute View
Drag and Drop the following tables from the
schema RDP160 into the Data Foundationnode in the scenario area of the editor:

Products

texts

4. Create text join between the Product and Texttable to lookup ProductName.

Select Data Foundation in the scenario

In the details area of the editor re-arrange


the tables as appropriate

To create the text joins for the product


name click and select the NameId column
from the Products table and drag it
to the TexttId column of the second texts
table (aliased automatically as texts_1).

Select the join connection. Then at the right


bottom of the editor in the property area,
change the join type property from
Referential to Text Join, and change the
Language Column to the column
Language from the drop-down selection.

Screenshot

31

Explanation
5. Select columns from the Product table to be
used in the Attribute View.

Select the following columns from the


Products table:
ProductId
TypeCode
Category
NameId
DescId
SupplierId
QuantityUnit
WeightMeasure
WeightUnit
Price
Width
Depth
Height
DimensionUnit

Additionally, select the Text column from


the texts table.

Rename columns by selecting the column


in the output area and changing the name
and label in the property area below.
Rename column Category to
Name: ProductCategory
Label: Product Category
Rename column TypeCode to
Name: ProductTypeCode
Label:
Product Type Code
Rename column Text to
Name: ProductName
Label:
Product Name

Specify the Label Column property for the


column NamedId.
Select NameId in the output area, then in
the properties area below, set the Label
Column property to the renamed column
ProductName.

Screenshot

32

Explanation

Screenshot

6. Specify the KeyAttribute and create a


Hierarchy for the Products Attribute View.

Select Semantic in the scenario area

To set the key attribute, in the column


pane of the details area, select the
ProductId attribute and from the type dropdown selector choose key attribute.
The icon changes from
attribute

to

for the key

To create a hierarchy, in the hierarchy pane of


the details area select the add hierarchy tool (
) to open the hierarchy definition window.

Enter a Name: H_Products.

Accept the default label

Accept the default Hierarchy Type: Level


Hierarchy

Click the green + sign to add a level in the


column level list.
Repeat to create 2 levels.

In the Element column, select the following


column for each level from the drop-down
column list:
o

Level 1: ProductCategory

Level 2: ProductId

Accept the default Level Type: REGULAR

Click OK to finish.

Confirm that the new hierarchy appears in


the Hierarchies folder in the Output pane.

Specify hierarchy specific column properties

Select the Data Foundation in the scenario


area, and edit properties of columns
selected in the output area.

For column ProductId set


Drill Down Enabled: True
Hierarchy Active:
True

For column ProductCategory set


Drill Down Enabled: True
Hierarchy Active:
True

33

Explanation
7. Review the Attribute View output structures.

Confirm the column list, key attribute and


the hierarchy are defined as shown on the
right.

8. Validate and Activate the Attribute View.

Click the validate icon (


) on the top right
toolbar of the editor to validate the model.

Confirm that the validation job completed


successfully by reviewing the Job-Log..

Click the Save and Activate icon ( ) on


the top right toolbar of the editor to activate
the model.

Confirm that the activation job completed


successfully by reviewing the Job-Log

Screenshot

34

Explanation
9. Preview the Attribute View.

Click on the Data Preview Icon (


) on the
top right toolbar of the editor to validate the
model.

As a result the Preview-View opens, where


the Views Output data can be explored
via
Choose Analysis, then
select and Drag/Drop Column
ProductName to the Label Axis area
Next select and Drag/Drop Column Price to
the value axis area.

Tip: Not if the language local of a client


session was now changed, the ProductName
would appear in the selected different
language..

Screenshot

35

Exercise 2.2 Building Analytic Views with Attribute Views from multiple dimensions
This exercise guides students how to create an enhanced Attribute View, and joining Header-/Item-tables in the Data
Foundation of the Analytic View and joining with multiple Attribute Views in the Logical Join.
You will join the SalesOrder(header)- and SalesOrderItem-tables to link the SalesOrder data also to the Product
Attribute Views. Further you will additionally join with a prepared Time-Dimension Attribute View, to be able to
analyze the SalesOrder data by the Customer-, Product- and Time-Dimension.
Explanation
1. Now, start and open the editor to create an
Analytic View with a calculated column.

Navigate in the content tree to your


personal assigned content package

Right-click on your package, then from the


context menu choose Select New >
Analytic View

2. Enter the name of the Analytic View:

Name: S2EX2_ANV_SALESORDERS.

Description: accept the default value

Select
Copy from and Browse to
navigate the content tree to select the
Analytic View from exercise 1.4 as the
starting point for the new Analytic View,
select S1EX4_ANV_SALESORDERS

Click Finish

As a result the Analytic View editor will


open and appear.

Screenshot

36

Explanation
3. Remodel the Data Foundation of the Analytic
View to include the SalesOrderItem table.
Drag and Drop the following tables from the
schema RDP160 to the Data Foundation in the
scenario area of the editor:

SalesOrderItem

Create the Data Foundation-join between tables


SalesOrder and SaleOrderItem:

To create the join click and select the


SalesOrderId column from the
SalesOrderItem table
and drag it
to the SalesOrderId column of the
SalesOrder table.

At the right bottom of the editor in the


property area, keep the join type property
Referential.

Change the column selection of the Data


Foundation tables

Remove the following columns from the


SalesOrder table, by de-selecting the
orange column selector icon ( ):
GrossAmount
NetAmount
TaxAmount

Add the following columns from the


SalesOrder table
CreatedAt

Add the following columns from the


SalesOrderItem table:
SalesOrderItem
ProductId
Currency
GrossAmount
NetAmount
TaxAmount
Quantity
QuantityUnit

Screenshot

37

Explanation
4. Remodel the Logical Join of the Analytic View
to include the Time- and the Product Attribute
Views.
Add the additional Attribute Views:
In the content tree of the SAP HANA Systems
View Drag and Drop the following Attribute
Views to the Logical Join-Node in the
scenario area of the editor:
from your personal assigned content
package the S2EX1_DIM_PRODUCT
Attribute View
From the content package tree
\RDP160\solution\shared\ the DIM_TIME
Attribute View

Create the join relationship between the


existing Attribute View and the Analytic View
Data Foundation.

In the details area, to create the join click


and select the ProductId column from the
S2EX1_DIM_PRODUCT attribute view
and drag it
to the ProductId column of Data
Foundation.

To create the join for the DIM_TIME


Attribute View click and select the
DATE_SQL column from the DIM_TIME
attribute view
and drag it
to the CreatedAt column of Data
Foundation.

For both new join connections, change the


join type property from Referential to Left
Outer in the details property area

Remove the calculated column


PAID_GROSS_AMOUNT from the output area
of the logical join details.

Screenshot

38

Explanation

Screenshot

5. Rename columns from the output area of the


logical join details.
Open the column rename window from the icon
(
) at the top of the output area.

Rename the following columns

Rename
QuantityUnit to OrderQuantityUnit

Rename
Quantity

to OrderQuantity

6. Specify the column types in semantic column


list and review the overall output structure.

Select Semantic in the scenario area

To quick-classify the columns deriving


from the Data Foundation to its default
column type, based on its column definition
use the Auto Assign-Tool (
top of the column area.

) at the right

Make sure GrossAmount, NetAmount,


TaxAmount and OrderQuantity are
classified as Measures.

Confirm the column list, key attribute and


the hierarchy are defined as shown on the
right.
Note the additional Time-Hierarchies

39

Explanation
7. Validate and Activate the Analytic View.

Click the validate icon (


) on the top right
toolbar of the editor to validate the model.

Confirm that the validation job completed


successfully by reviewing the Job-Log..

Click the Save and Activate icon ( ) on


the top right toolbar of the editor to activate
the model.

Confirm that the activation job completed


successfully by reviewing the Job-Log

8. Preview the Attribute View.

Click on the Data Preview Icon (


) on the
top right toolbar of the editor to validate the
model.

As a result the Preview-View opens, where


the Views Output data can be explored
via
Choose Analysis, then
select and Drag/Drop Column Quarter and
ProductCategory to the Label Axis area
Next select and Drag/Drop Column
GrossAmount and OrderQuantity to the
value axis area.
Switch to the Map Chart for the analysis
display.

Screenshot

40

Explanation
9. Preview in SAP Lumira to explore HANA
hierarchies (Product Hierarchies)
OPTIONAL STEP!
In SAP Lumira follow the steps described in
chapter 1.3 to open a HANA View, in short:
create New Document
specify Data Source Type and connection
details
then select the view
before you can select
S2EX2_ANV_SALESORDERS
Explore the Analytic View

Select Total GrossAmount from Measures


and Drag it to Y Axis 1

Select from the Hierarchies


H_Productsand and Drag it to X Axis

Select from the Hierarchies


YQMD Time Hierarchy and Drag it to
Dimension Legend Colors

Drill down in the Time Hierarchy

Select the drop-down menu at the YQMD


Time Hierarchy and select Quarter

Observer the change chart after the Drill down.

Screenshot

41

Exercise 2.3 Adding a Variable Prompt to Analytic Views


This exercise guides students how to create a SAP HANA Variable, for creating a prompted Filter.
You will create Filter Variable prompts for Country and a Date Range, which multidimensional report users will be
prompted for and the processed SalesOrder Analytic View will be filtered on.
Explanation
1. Again, start and open the editor to create an
Analytic View with a calculated column.

Navigate in the content tree to your


personal assigned content package

Right-click on your package, then from the


context menu choose Select New >
Analytic View

2. Enter the name of the new Analytic View:

Name: S2EX3_ANV_SALESORDERS.

Description: accept the default value

Select
Copy from and Browse to
navigate the content tree to select the
Analytic View from exercise 2.2 as the
starting point for the new Analytic View,
select S2EX2_ANV_SALESORDERS

Click Finish

As a result the Analytic View editor will


open and appear.

Screenshot

42

Explanation
3. Create a Variable for Country and Date in the
Semantic Node.

Select Semantic in the scenario area

To create a Variable, in the Variables/Input


Parameter pane of the details area select
the create variable tool ( ) to open the
variable definition window.

Specify the following Variable details


Name: VAR_Country
Label: Filter Prompt for Country
Attribute: S1EX4_DIM_CUSTOMERS.Country
Selection Type: Single Value
Default Value: US (Select from the Value
Help Pop-up )

Select > OK

Create a second Variable

Specify the following Variable details


Name: VAR_Date_SQL
Label: Filter Prompt for Date Range
Attribute: DIM_TIME.Date_SQL
Selection Type: Interval
Default Value: <None>

Select > OK

The Variables/Input Parameter pane should


contain now the following Variables:

Screenshot

43

Explanation
4. Validate and Activate the Analytic View.

Click the validate icon (


) on the top right
toolbar of the editor to validate the model.

Confirm that the validation job completed


successfully by reviewing the Job-Log..

Click the Save and Activate icon ( ) on


the top right toolbar of the editor to activate
the model.

Confirm that the activation job completed


successfully by reviewing the Job-Log

Screenshot

44

Explanation
5. Preview the Analytic View.

Click on the Data Preview Icon (


) on the
top right toolbar of the editor to validate the
model.

As a result the Preview-View opens, with a


Variable/Input Parameter Prompt, specify
the following details:
VAR_Country accept the default US
VAR_DATE_SQL select for
From: 2012-10-01
To:
2013-03-31

Then the usual Preview opens and output


data can be explored
via
Choose Analysis, then
select and Drag/Drop Column Country and
YEARMONTH to the Label Axis area
Next select and Drag/Drop Column
GrossAmount and OrderQuantity to the
value axis area.
Note: the Country-List contains only US and
the YEARMONTH ranges only within the
selected prompt values.

Screenshot

45

SECTION 3 ENHANCING THE ANALYTICAL VIEW II [25MINS]


Overview of Section 3 Exercises

Exercise 3.1 Building Dynamic Views with Input Parameters


This exercise guides students how to create a SAP HANA Input Parameters, for enabling dynamic calculations based
on prompted Parameters.
You will create Input Pameter prompts for Discount Percentage and a Product Category, to dynamically calculate
a discounted gross amount measure.
Explanation
1. Again, start and open the editor to create an
Analytic View with a calculated column.

Navigate in the content tree to your


personal assigned content package

Right-click on your package, then from the


context menu choose Select New >
Analytic View

2. Enter the name of the new Analytic View:

Name: S3EX1_ANV_SALESORDERS.

Description: accept the default value

Select
Copy from and Browse to select
S2EX2_ANV_SALESORDERS

Click Finish

As a result the Analytic View editor will


open and appear.

Screenshot

46

Explanation
3. Create Input Parameter for Discount
Percentage and Product Category in the
Semantic Node.

Select Semantic in the scenario area

To create a Input Parameter, in the


Variables/Input Parameter pane of the
details area select the create input
parameter tool ( ) to open the definition
window.

Specify the following Input Parameter


details
Name: IP_Discount_PCT
Label: Discount Percentage Prompt
Parameter Type: Direct
Default Value: 10
Data Type:
INTEGER

Select > OK

Create a second Input Parameter

Specify the following Input Parameter


Name: IP_Product_Category
Label: Product Category Prompt
Parameter Type: Column
Reference Colum: DIM_PRODUCT.Category
Default Value: Ink Jet printers(Select
from the Value Help Pop-up )

Select > OK

The Variables/Input Parameter pane should


contain now the following Variables:

Screenshot

47

Explanation
4. Create a calculated column to enhance the
Analytic View referencing the Input Parameter.

Select Logical Join in the scenario

In the output area and its top tool-list select


the new object tool (
) to open the
calculated column editor.

Specify the column details as follows:


Name:
Discounted_GrossAmount
Data Type: DOUBLE
Column Type: Measure
Expression:
if("ProductCategory"
='$$IP_PRODUCT_CATEGORY$$',
"GrossAmount" * ($$IP_DISCOUNT_PCT$$
/100 ),
"GrossAmount" )

Tip: Select arguments like Input Parameter


reference to the expression from the lower
boxes (Elements, Operators, Functions).

Validate the column expression by selecting


and make use
expression specified is qualified as valid.

Then select OK).

5. Review the overall output structure.

Select Semantic in the scenario area


Confirm the column list includes the
calculated column and the input parameters
are shown.

Screenshot

48

Explanation
6. Validate and Activate the Analytic View.

Click the validate icon (


) on the top right
toolbar of the editor to validate the model.

Confirm that the validation job completed


successfully by reviewing the Job-Log..

Click the Save and Activate icon ( ) on


the top right toolbar of the editor to activate
the model.

Confirm that the activation job completed


successfully by reviewing the Job-Log

7. Preview the Analytic View.

Click on the Data Preview Icon (


) on the
top right toolbar of the editor to validate the
model.

As a result the Preview-View opens, with a


Variable/Input Parameter Prompt, specify
the following details:
IP_Discount_PCT accept the default: 10
IP_Product_Category: Use the Value Help
Pop-up
to select: Workstation
ensemble

Then the usual Preview opens and output


data can be explored
via
Choose Analysis, then
select and Drag/Drop Column Country to
the Label Axis area
Next select and Drag/Drop Column
GrossAmount and
Discounted_GrossAmount to the value
axis area.

Screenshot

49

Exercise 3.2 Using HANA Unit Conversion with a Calculated Measures (Optional)
This exercise guides students how to make use of Unit Conversion to create a ShippingVolume calculated
measures, which will again make use of an Input Parameter prompt, to select the target VolumeUnit used in the
calculation.
Explanation

Screenshot

1. Again, start and open the editor to create an


Analytic View with a calculated column.

Navigate in the content tree to your


personal assigned content package

Right-click on your package, then from the


context menu choose Select New >
Analytic View

2. Enter the name of the new Analytic View:

Name: S3EX2_ANV_SALESORDERS.

Description: accept the default value

Select
Copy from and Browse to
navigate the content tree to select the
Analytic View from exercise 2.2 as the
starting point for the new Analytic View,
select S2EX2_ANV_SALESORDERS

Click Finish

As a result the Analytic View editor will


open and appear.

3. Set the system table schema, containing the


conversion system tables.

Select Semantic in the scenario area

In the properties pane of the details area,


select the schema as follows:
Default Schema:

RDP160_SYS

50

Explanation

Screenshot

4. Create Input Parameter to prompt for the


Target Volume_Unit of the UnitConversion.

Select Semantic in the scenario area

To create a Input Parameter, in the


Variables/Input Parameter pane of the
details area select the create input
parameter tool ( ) to open the definition
window.

Specify the following Input Parameter


details
Name:
Label:

VOLUME_UNIT
Target Unit for volume
conversion

Parameter Type: Static List


Default Value: L
Data Type:
NVARCHAR
Length:
10
Manually add to the list of values
Name:
M3
Description:
Cubic Meters
Name:
Description:

Select > OK

L
Liters

51

Explanation

Screenshot

5. Create a calculated column to calculate the


Shipping Volume for the SalesOrders.

Select Logical Join in the scenario

In the output area and its top tool-list select


the new object tool (
) to open the
calculated column editor.

Specify the column details as follows:


Name:
ShippingVolume
Data Type:
DOUBLE
Column Type: Measure
Select : Calculate Before Aggregation
Aggregation Type: Accept Default SUM

On the expression-tab, specify the expression


as:
"Width" *"Depth" *"Height"

Validate the column expression by selecting


and make use
expression specified is qualified as valid.

Switch to the Advanced-tab to specify the


unit conversion details:
Type: Quantity with Unit of Measure
Unit: Use the Value Help Pop-up
Type:
Fixed
Select Unit: M3

Target Unit: Use value Help Pop-up


Type:
Input Parameter
Select
Volume Unit

Client for unit conversion:


Upon conversion failure:

Then select OK.

001
Set to NULL

52

Explanation
6. Review the overall output structure.

Select Semantic in the scenario area


Confirm the column list includes the
calculated column and the input parameter
is shown.

7. Validate and Activate the Analytic View.

Click the validate icon (


) on the top right
toolbar of the editor to validate the model.

Confirm that the validation job completed


successfully by reviewing the Job-Log..

Click the Save and Activate icon ( ) on


the top right toolbar of the editor to activate
the model.

Confirm that the activation job completed


successfully by reviewing the Job-Log

Screenshot

53

Explanation
8. Preview the Analytic View.

Click on the Data Preview Icon (


) on the
top right toolbar of the editor to validate the
model.

As a result the Preview-View opens, with a


Variable/Input Parameter Prompt, specify
the following details:
VOLUME_UNIT: Use the Value Help
Pop-up
to select: M3

Then the usual Preview opens and output


data can be explored
via
Choose Analysis, then
select and Drag/Drop column
ProductCategory to the Label Axis area
Next select and Drag/Drop Column
GrossAmount and ShippinVolume to the
value axis area.
Explore the data in the table-view.

Re-open or refresh the view and select L as


the VOLUME_UNIT in the prompt.

Compare values in the column


ShippingVolume_SUM between both target
unit selections.

Screenshot

54

Exercise 3.3 Using HANA Currency Conversion with a Calculated Measures


This exercise guides students how to make use of currency conversion in SAP HANA Views, to convert the mixed
currency salesorder values to fixed target currency values in USD.
Explanation

Screenshot

1. Again, start and open the editor to create an


Analytic View with a calculated column.

Navigate in the content tree to your


personal assigned content package

Right-click on your package, then from the


context menu choose Select New >
Analytic View

2. Enter the name of the new Analytic View:

Name: S3EX3_ANV_SALESORDERS.

Description: accept the default value

Select
Copy from and Browse to
navigate the content tree to select the
Analytic View from exercise 2.2 as the
starting point for the new Analytic View,
select S2EX2_ANV_SALESORDERS

Click Finish

As a result the Analytic View editor will


open and appear.

3. Set the system table schema, containing the


conversion system tables.

Select Semantic in the scenario area

In the properties pane of the details area,


select the schema as follows:
Default Schema:

RDP160_SYS

55

Explanation
4.

Change the column selection of the Data


Foundation tables

Select Data Foundation in the scenario


area

Add the following columns from the


SalesOrderItem table by selecting the grey
column selector icon, which then changes
to orange ( ):
DeliveryDate
Right-click on the GrossAmount-column
and from the context menu select > Add to
Output, then a GrossAmount_1 column
appears in the output on the right.

Select Sematic-node in the scenario area

Set the column type in the column listpane of the sematic details area
Select the drop-down list of the type column
for that:

5. Rename columns from the output area of the


logical join details.

Select Logical Join in the scenario area.


Open the column rename window from the
icon (
) at the top of the output area.
Rename the following columns
Rename GrossAmount
New Name: GrossAmount_MixedCurr
New Label: GrossAmount with mixed
Currencies
Rename GrossAmount_1
New Name: GrossAmountUSD
New Label: GrossAmount in USD

Screenshot

56

Explanation
6. Change the amount column from a standard
measure to Amount with Currencymeasure column.

In the output area of the Logical Join


Select column > GrossAmountUSD .
Then in the properties area below,
edit the Measure Type-Value (Simple)
by selecting the edit help icon
, the
create Currency/Unit of Measure windows
opens.
Specify the following conversion details:
Type:
Amount with Currency
Currency: Use the Value Help Pop-up
Type:
Column
Select column: Currency

Select
Enable for conversion
Target Currency: Value Help Pop-up
Type:
Fixed
Select Currency: USD

Exchange Type: Value Help Pop-up


Type:
Fixed
Select Exchange Type: 1001

continued on next page

Screenshot

57

Explanation

Screenshot

.. continued specifying column conversion details:

Conversion Date: value help pop-up


Type:
Column
Select:
DeliveryDate

Client for currency conversion: 800


Upon Conversion Failure:

Set to NULL

To Finish, select > OK

7. Validate and Activate the Analytic View.

Click the validate icon (


) on the top right
toolbar of the editor to validate the model.

Confirm that the validation job completed


successfully by reviewing the Job-Log..

Click the Save and Activate icon ( ) on


the top right toolbar of the editor to activate
the model.

Confirm that the activation job completed


successfully by reviewing the Job-Log

58

Explanation
8. Preview the Analytic View.

Click on the Data Preview Icon (


) on the
top right toolbar of the editor to validate the
model.

Then the Preview opens and output data


can be explored
via
Choose Analysis, then
select and Drag/Drop column
ProductCategory to the Label Axis area
Next select and Drag/Drop Column
GrossAmountUSD and
GrossAmountMixedCurr to the value axis
area.
Explore the data in the table-view.

Screenshot

59

SECTION 4 OPTIONAL EXERCISES SECTION (OPTIONAL)


Overview of Section 3 Exercises

Exercise 4.1 Use Temporal Joins in Analytic Views for time-dependent Attribute Mapping (Optional)
The customer status, is a time-dependent (slowly changing dimension) value, changing every quarter depending on
the previous quarters sales turnovers. In this exercise you will use temporal joins in Analytic Views to join the
SalesOrder facts time-dependently to a new Customer Status Attribute View.
Explanation
1. Again, start and open the editor to create an
Analytic View with a calculated column.

Navigate in the content tree to your


personal assigned content package

Right-click on your package, then from the


context menu choose Select New >
Attribute View

2. Enter the name of the new Attribute View:

Name: S4EX1_DIM_CUSTOMER_STATUS.

Description: accept the default text.

Select
Copy from and Browse to select
S1EX4_DIM_CUSTOMER

Click Finish

As a result the Analytic View editor will


open and appear.

Screenshot

60

Explanation
3. Remodel the Data Foundation of the Attribute
View to include the BusinessPartnerStatus
table.

Select Data Foundation in the scenario.

Right-click on the BusinessPartner table


in the DataFoundation-node, then from the
conext menu Select > Remove.
Confirm the removal when prompted.

Add the BusinessPartnerStatus table via


drag/drop from the schema RDP160 to the
Data Foundation in the scenario area of the
editor:

Create the join relationship between the


existing BusinessPartnerStatus and the
BusinessPartnerContacts table.

In the details area, to create the join click


and select the ParnertId column from the
BusinessPartnerStatus table
and drag it
to the ContactId column of
BusinessPartnerContacts table.

.At the right bottom of the editor in the


property area, keep the join type property
Referential.

Add the following columns from the


BusinessPartnerStatus table by selecting
the grey column selector icon, which then
changes to orange ( ):
PartnerId
ValidFROM
ValidTO
CustomerStatus

Screenshot

61

Explanation
4. Validate and Activate the Attribute View.

Click the validate icon (


) on the top right
toolbar of the editor to validate the model.

Confirm that the validation job completed


successfully by reviewing the Job-Log..

Click the Save and Activate icon ( ) on


the top right toolbar of the editor to activate
the model.

Confirm that the activation job completed


successfully by reviewing the Job-Log

5. Next, start and open the editor to create the


Analytic View with the temporal join condition.

Navigate in the content tree to your


personal assigned content package

Right-click on your package, then from the


context menu choose Select New >
Analytic View

6. Enter the name of the new Analytic View:

Name: S4EX1_ANV_SALESORDERS.

Description: accept the default value

Click Finish

As a result the Analytic View editor will


open and appear.

Screenshot

62

Explanation
7. Define the DataFoundation of the Analytic
View.
Add tables to the Data Foundation

Drag and Drop the following table from the


schema RDP160 to the Data Foundation in
the scenario area of the editor:
SalesOrder

Add the following columns from the


SalesOrder table by selecting the grey
column selector icon, which then changes
to orange ( ):
SalesOrderId
CreatedAt
PartnerId
GrossAmount
NetAmount
TaxAmount
BillingStatus

Screenshot

63

Explanation
8. Define the Logical Join of the Analytic View to
with the new DIM_CUSTOMER_Status and the
Dim_Time Attribute Views.

Select Logical Join in the scenario.

Add the S4EX1_DIM_CUSTOMER_STATUS


Attribute view able via drag/drop from your
content package to the Logical Join in the
scenario area of the editor:

In the content tree of the SAP HANA


Systems View Drag and Drop the following
Attribute Views to the Logical Join-Node
in the scenario area of the editor:
from your personal assigned content
package the S4EX1_DIM_CUSTOMER_STATUS
Attribute View
From the content package tree
\RDP160\solution\shared\ the DIM_TIME
Attribute View

In the details area, to create the following joins:

Select the DATE_SQL column from the


DIM_TIME attribute view
and drag it
to the CreatedAt column of Data
Foundation.
Select the join connection. Then at the right
bottom of the editor in the property area,
change the join type property from
Referential to Left Outer.

To create the Temporal Join relationship


select the PartnerId column from the
S4EX1_DIM_CUSTOMER_STATUS
attribute view
and drag it
to the PartnertId column of Data
Foundation.

Specify temporal join details to the join


relationship, in the lower right property area
(with the connection selected) as follows:
Join Type:
Referential
Temporal Column:
CreatedAt
From Column:
ValidFROM
To Column:
ValidTO
Temporal Condition: Include to Exclude
From

Screenshot

64

Explanation
9. Validate and Activate the Analytic View.

Click the validate icon (


) on the top right
toolbar of the editor to validate the model.

Confirm that the validation job completed


successfully by reviewing the Job-Log..

Click the Save and Activate icon ( ) on


the top right toolbar of the editor to activate
the model.

Confirm that the activation job completed


successfully by reviewing the Job-Log

9. Preview the Analytic View.

Click on the Data Preview Icon (


) on the
top right toolbar of the editor to validate the
model.

Then the Preview opens and output data


can be explored
via
Choose Analysis, then
select and Drag/Drop column
YEARMONTH and CustomerStatus to the
Label Axis area
Next select and Drag/Drop Column
GrossAmount and to the value axis area.
Explore the data in the table-view.

Screenshot

65

Exercise 4.2 Restrict access to Analytic Views with Dynamic Modeled Analytic Privileges (optional)
This exercise guides students on how to make use of dynamic analytic privileges to dynamically restrict and filter
data, based on the end-users identity.
In this scenario employees from the sales department, should be restricted to
access only their personal, or their sales team and channels sales figures.
A dynamic Analytic privilege ORGEMPLOYEE_RLS, referencing a Stored Procedures
ORGEMPLOYEE-SECFILTER and an Attribute View ORGSECURITY, which are all
provided in the content package tree \RDP160\solution\shared.
The following shows the analytic privilege definition and the stored procedure:

Now follow the exercise description to make use of the prepared ORGSECURITY Attribute View
Explanation
1. Again, start and open the editor to create an
Analytic View with a calculated column.

Navigate in the content tree to your


personal assigned content package

Right-click on your package, then from the


context menu choose Select New >
Analytic View

Screenshot

66

Explanation
2. Enter the name of the new Analytic View:

Name: S4EX2_ANV_SALESORDERS.

Description: accept the default value

Select
Copy from and Browse to
navigate the content tree to select the
Analytic View from exercise 2.2 as the
starting point for the new Analytic View,
select S2EX2_ANV_SALESORDERS

Click Finish

As a result the Analytic View editor will


open and appear.
3. Remodel the Data Foundation of the Analytic
View to include additional columns

Select Data Foundation in the scenario.

Add the following column from the


SalesOrder table by selecting the grey
column selector icon, which then changes
to orange ( ):
CreatedBy

Screenshot

67

Explanation
10. Remodel the Logical Join of the Analytic View
to include a prepared Organization Attribute
Views, used to filter data dynamically per
employee via Analytic privileges.
Add the additional Attribute View:
In the content tree of the SAP HANA Systems
View Drag and Drop the following Attribute
Views to the Logical Join-Node in the
scenario area of the editor:
From the content package tree
\RDP160\solution\shared\ the OrgSecurityAttribute View

Create the join relationship between the new


Attribute View and the Data Foundation.

To create the join for the OrgSecurity


Attribute View click and select the
EmployeeId column
and drag it
to the CreatedBy column of Data
Foundation.

For the new join connection, change the


join type property from Referential to Left
Outer in the details property area

Overview of the Logical Join

Screenshot

68

Explanation
10. Validate and Activate the Analytic View.

Click the validate icon (


) on the top right
toolbar of the editor to validate the model.

Confirm that the validation job completed


successfully by reviewing the Job-Log..

Click the Save and Activate icon ( ) on


the top right toolbar of the editor to activate
the model.

Confirm that the activation job completed


successfully by reviewing the Job-Log

10. Preview the Analytic View.

Click on the Data Preview Icon (


) on the
top right toolbar of the editor to validate the
model.

Then the Preview opens and output data


can be explored
via
Choose Analysis, then
select and Drag/Drop column
OrgUnitName to the Label Axis area
Next select and Drag/Drop Column
GrossAmount and to the value axis area.
Explore the data in the table-view.

Note: All data is displayed, because with


your assigned workshop userid, you are not
restricted, however if you open and explore this
Analytic view with an employee-userid you will
be restricted to see the SalesData only for the
respective Sales-department.

Screenshot

69

Explanation
11. Open the restricted Analytic View with an
employee userid

In the SAP HANA Systems View, add an


additional HANA Connection for an
employee (LoginName) of your choice:
Right-click on the existing connection,
then Select > Add Additional User from
the context menu

Then specify the chosen employee


(LoginName) credentials, e.g.
User Name: RDP160_FALLF
Password: Welcome13
Note: Password is the same for all
employee LoginNames

From the new connection, browse the


content tree to your personal assigned
content package of this workshop,
then right-click on the Analytic View
S4EX2_ANV_SALESORDERS and
Select Data Preview ( ) from the context
menue.

Create the same Preview as in Step 10.


Notice the restricted data display.

Screenshot

70

Exercise 4.3 Building Multidimensional Calculation Views with DistinctCount-Measures (optional)


In the following exercise you will learn how to create a simple calculation view for multidimensional reporting, i.e.
this calculation view will be build based on an Analytic View, and enriched with a distinct count calculation.
Exercise Description
Create a Calculation View
Create 2 counters (Distinct count calculations)
Preview the data
Explanation
1. Create a new calculation View

Right-click on your package then


select New > Calculation View

2. Give it a name

Enter in the name:


S4_EX3_CV_SALESORDERS_DC

and make sure the option to


create a Graphical calculation
view is chosen like on the
screen.

Screenshot

71

Explanation

Screenshot

3. Drag and drop the Analytical


View

Select the Analytical View


S3EX1_ANV_SALESORDERS
from your package hierarchy and
drag and drop it into the
aggregation node of your
calculation view.

Or use the + sign to search and


add the view

Note You should notice that you


are getting a warning. We will come
back in a minute. First lets add our
objects.
4. Add to Output

In the aggregation node, select


to output the fields below:
- SalesOrderId
- BillingStatus
- Country
- ProductCategory

Select them, right-click and


choose add To Output

or

72

Explanation

Screenshot

5. Add as Aggregated Column

Select the fields


- GrossAmount
- NetAmount
- OrderQuantity
- Row.count

Select them, right click and


select Add As Aggregated
Column

Your Output should look like this:

6. Create the counters

Select the + sign from the output


and choose create New counter

or

right-click on Calculated
Columns and select New
Counter

or

73

Explanation
7. Create two counters

Name your first counter


CountDistinctSalesOrders

Then click the + sign or Add


button to check the column that
you want to disctinct count:
SalesOrderId

Repeat those steps to create another


counter
Name it
CountDistinctProducts

Then click the + sign or Add


button to check the column that
you want to disctinct count:
ProductCategory

Screenshot

74

Explanation
7. Map the Input Parameters
Now that you are done with the
counters. You want to remove the
warning we have seen before. This
warning is self-explanatory, input
parameters from the analytical view
are not mapped.

Click on the manage mappings


options in the panel for Variables
and Input Parameters from your
semantics

You can notice the 2 input


parameters from our Analytical
view we have created
previously.

Just click on Auto map by name


icon on the left, at the top of the
source parameters

Then the 2 input parameters are


now automatically created in
your calculation view.

Click OK to close the wizard

Screenshot

75

Explanation
8. Column types

In the semantics make sure the


type of your Columns is correct.
You can refer to this screenshot:

9. Save and Activate


You can now save and activate and
check your logs that everything is ok.

Screenshot

76

Explanation

Screenshot

10. Data Preview


Finally click on data preview
Lets check different query analysis
as raw data is not really useful for
distinct counts, everything will be 1.
Leave default prompts as it is.
1) Drag and drop Country with the 1)
countDistinctProducts to
analyze that the product mix in
DK is much less than the
average of the others countries.
We got orders on only 5 of our
product categories.

2) Remove the
countDistinctProducts and add
CountDistinctSalesOrders
We notice that DE and US are
the places where we are getting
most of our orders.

2)

77

Exercise 4.4 Building Multidimensional Calculation Views integrating Plan/Actuals-Measures


(optional)
In the following exercise you will learn how to create a calculation view for multidimensional reporting, which uses
unions to combine plan- and actuals-data from Analytic Views.
Exercise Description
Create a Calculation View
Use the union to be able to combine Actual and plan data
Preview the data

Explanation
1. Create a new calculation View

Right-click on your package then


select New > Calculation View

2. Give it a name

Enter in the name:


S4_EX4_CV_SALESORDERS_PLAN

and make sure the option to create


a Graphical calculation view is
chosen like on the screen.

Screenshot

78

Explanation
3. Union Node

Select a union node in the


Scenario part of your newly
created calculation view
and
add it by clicking on somewhere
in the scenario area.

4. Rename your Node

Right click on your node and


select rename.

Then enter actual_and_plan as


the new name

Screenshot

79

Explanation
5. Add the objects

Drag and drop the analytical


view from your package hierarchy
named:
S4EX2_ANV_SALESORDERS
(either choose the one from the
solution package or go with the
one you have created)

And add the SalesPlan table from


the RDP160 schema where our
plan information is stored.
You can also drag and drop it from
the CATALOG structure.

Screenshot

80

Explanation
6. Mapping in union node

In your union node scroll down


and
add columns from the table
SalesPlan to the Target as we do
not want to use the auto mapping
option otherwise too many fields
will be added to the target.
Select the columns:
OrgUnitId
OrgUnitName
ProductCategory
YEARMONTH
Then drag and drop them to our
target.

7. Now we will map the columns from


the Analytic view to the target
columns

Select the Target columns and


on the side of the source columns
click on the Auto Map By
Name.

Screenshot

81

Explanation
8. We will now map the plan and
actuals net amount measures.
Start with the NetAmount from the
Analytical View and drag and
drop it manually into our targets.
Do the same thing for the
NetAmount of the Plan table. The
name will become NetAmount_1
9. Link to Aggregation node
You can now link your UNION node
with the AGGREGATION node.

10. Output for Aggregation


In the output of the Aggregation
node add to the output following
columns:
- OrgUnitId
- OrgUnitName
- ProductCategory
- YEARMONTH
Then add the 2 other columns
(NetAmount and NetAmount_1) as
Aggregated columns.

Screenshot

82

Explanation

Screenshot

11. Prepare the Semantics


Click on Sematics and make sure
your one looks like this.
Use the auto assign feature (
determine the type of your
columns.

) to

Then rename
NetAmount to ActualNetAmount
and
NetAmount_1 to PlanNetAmount
9. Save and Activate
You can now save and activate and
check your logs that everything is ok.
10. Data Preview
Finally click on data preview

Add the OrgUnitName to the Labels


axis and use ActualNetAmount and
PlanNetAmount in the values axis.

Finished!! Congratulations!!

Thank you for participating in this SAP TechEd Virtual Hands-On Workshop!
Please, take a few minutes to answer a couple of feedback questions concerning your session.
Find a shortcut to the survey on the desktop of your virtual laptop image or visit
https://www.sapsurvey.com/cgi-bin/qwebcorporate.dll?idx=FSQCZ7.

83

APPENDIX
ITeIO Enterprise Procurement Data Model Reference

Note: In order to browse a table, open the SAP HANA System View, open the catalog tree and the schema RDP160,
there right-click on a table and select > Open Content from the context menu.

2013 by SAP AG. All rights reserved.


SAP and the SAP logo are registered trademarks of SAP AG in Germany and other countries. Business Objects and the Business Objects logo are trademarks or
registered trademarks of Business Objects Software Ltd. Business Objects is an SAP company. Sybase and the Sybase logo are registered trademarks of Sybase Inc.
Sybase is an SAP company. Crossgate is a registered trademark of Crossgate AG in Germany and other countries. Crossgate is an SAP company.

Potrebbero piacerti anche