Você está na página 1de 170

PUBLIC

SAP HANA Platform SPS 08


Document Version: 1.1 - 2014-08-21
SAP HANA Modeling Guide
Table of Contents
1 Introduction to Modeling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 SAP HANA Architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1 SAP HANA In-Memory Database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1.1 Columnar Data Storage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1.2 Parallel Processing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.3 Simplifying Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 SAP HANA Database Architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3 Getting Started. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.1 Add a System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.2 Create an Information View. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.2.1 About Information Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.2.2 SAP HANA Studio. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.2.3 Attributes and Measures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.2.4 Required Permissions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4 Importing Table Definitions and Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26
4.1 Import Table Definitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.2 Load Data into Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2.1 Suspend and Resume Data Load. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.2.2 Upload Data from Flat Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.3 Copy Content Delivered by SAP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.4 Map Authoring Schema to the Physical Schema. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.4.1 Package Specific Default Schema. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.4.2 Change Authoring Schemas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.5 Generate Time Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5 Setting Up the Modeling Environment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.1 Set Modeler Preferences. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.1.1 Modeler Preferences. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.1.2 Keyboard Shortcuts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
5.2 Apply Filters to Packages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.3 Apply Filter to Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .45
6 Creating Information Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.1 Using Attribute Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6.1.1 Create Attribute Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
6.2 Using Analytic Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
6.2.1 Create Analytic Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
6.2.2 Create Temporal Joins. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
2
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Table of Contents
6.3 Using Calculation Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.3.1 Create a Script-Based Calculation View. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.3.2 Create a Graphical Calculation View. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
7 Defining Data Access Privileges. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
7.1 Create Analytic Privileges. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
7.1.1 Analytic Privileges. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
7.1.2 Structure of Analytic Privileges. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
7.1.3 Dynamic Value Filters in the Attribute Restriction of Analytic Privileges. . . . . . . . . . . . . . . 93
7.1.4 Runtime Authorization Check of Analytic Privileges. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
7.1.5 Example: Using Analytic Privileges. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
7.1.6 Example: Creating an Analytic Privilege with Dynamic Value Filter. . . . . . . . . . . . . . . . . . .99
8 Additional Functionality for Information Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
8.1 Create Level Hierarchies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
8.2 Create Parent-Child Hierarchies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
8.3 Create Input Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
8.3.1 Input Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
8.4 Assign Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
8.4.1 Supported Variable Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
8.5 Using Currency and Unit of Measure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
8.5.1 Associate Measures with Currency. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
8.5.2 Associate Measures with Unit of Measure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
8.6 Assign Default Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
8.6.1 Default Client Property. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .118
8.7 Assign Semantics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
8.7.1 Supported Semantic Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
8.8 Manage Broken Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .120
9 Working with Information Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
9.1 Search Tables, Models and Column Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
9.2 Performance Analysis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
9.3 Trace Performance Issues. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
9.4 Preview Information View Output. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
9.4.1 Data Preview Editor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
9.4.2 SQL Editor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
9.5 Manage Layout. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
9.6 Validate Models. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
9.7 View the Job Log. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
9.8 Maintain Search Attributes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
9.9 Description Mapping. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
9.10 Group Related Measures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .130
SAP HANA Modeling Guide
Table of Contents
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 3


9.11 Functions used in Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
10 Managing Objects in SAP HANA Systems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
10.1 Activate Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
10.2 Copy an Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
10.3 Manage Broken Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
10.4 Check Object References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
10.5 Enable Multilanguage Support for Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
10.6 Generate Object Documentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
10.7 Refactor Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
11 Working with SAP NetWeaver BW Models. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
11.1 Import BW Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
11.2 BW InfoProviders as SAP HANA Models. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
11.3 BW Analysis Authorizations as Analytic Privileges. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
12 Working with Decision Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
12.1 Create Decision Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
12.1.1 Add Tables, a Table Type, or Information Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .155
12.1.2 Create Joins. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
12.1.3 Add Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
12.1.4 Add Conditions and Actions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
12.1.5 Add Conditions and Action Values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
12.1.6 Optional Step: Validate Decision Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
12.1.7 Activate Decision Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
12.1.8 Execute Decision Table Procedure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
12.2 Changing the Layout of a Decision Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
12.3 Use Parameters in a Decision Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
12.3.1 Supported Parameter Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
12.4 Use Calculated Attributes in Decision Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
13 Managing Object Versions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
13.1 Switch Ownership of Inactive Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
13.2 Toggle Versions of Content Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
13.3 View Version History of Content Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
4
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Table of Contents
1 Introduction to Modeling
Modeling refers to an activity of refining or slicing data in database tables by creating views to depict a
business scenario. The views can be used for reporting and decision making.
The modeling process involves the simulation of entities, such as customer, product, and sales, and the
relationships between them. These related entities can be used in analytics applications such as SAP
BusinessObjects Explorer and Microsoft Office. In SAP HANA, these views are known as information views.
Information views use various combinations of content data (that is, nonmetadata) to model a business use
case. Content data can be classified as follows:
Attribute: Descriptive data, such as customer ID, city, and country.
Measure: Quantifiable data, such as revenue, quantity sold and counters.
You can model entities in SAP HANA using the Modeler perspective, which includes graphical data modeling
tools that allow you to create and edit data models (content models) and stored procedures. With these tools,
you can also create analytic privileges that govern the access to the models, and decision tables to model
related business rules in a tabular format for decision automation.
You can create the following types of information views:
Attribute Views
Analytic Views
Calculation Views
Who should read this guide
This guide is intended for a modeler, who is also known as a business analyst, data analyst or database expert,
concerned with the definition of the model and schemas that will be used in SAP HANA, the specification and
definition of tables, views, primary keys, indexes, partitions and other aspects of the layout and
interrelationship of the data in SAP HANA.
The data modeler is also concerned with designing and defining authorization and access control, through the
specification of privileges, roles and users.
The modeler generally uses the Administration Console and Modeler perspectives and tools of the SAP HANA
studio.
SAP HANA Modeling Guide
Introduction to Modeling
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 5


2 SAP HANA Architecture
SAP HANA is an in-memory data platform that can be deployed on premise or on demand. At its core, it is an
innovative in-memory relational database management system.
SAP HANA can make full use of the capabilities of current hardware to increase application performance,
reduce cost of ownership, and enable new scenarios and applications that were not previously possible. With
SAP HANA, you can build applications that integrate the business control logic and the database layer with
unprecedented performance. As a developer, one of the key questions is how you can minimize data
movements. The more you can do directly on the data in memory next to the CPUs, the better the application
will perform. This is the key to development on the SAP HANA data platform.
2.1 SAP HANA In-Memory Database
SAP HANA runs on multi-core CPUs with fast communication between processor cores, and containing
terabytes of main memory. With SAP HANA, all data is available in main memory, which avoids the
performance penalty of disk I/O. Either disk or solid-state drives are still required for permanent persistency in
the event of a power failure or some other catastrophe. This does not slow down performance, however,
because the required backup operations to disk can take place asynchronously as a background task.
2.1.1 Columnar Data Storage
A database table is conceptually a two-dimensional data structure organized in rows and columns. Computer
memory, in contrast, is organized as a linear structure. A table can be represented in row-order or column-
order. A row-oriented organization stores a table as a sequence of records. Conversely, in column storage the
entries of a column are stored in contiguous memory locations. SAP HANA supports both, but is particularly
optimized for column-order storage.
Columnar data storage allows highly efficient compression. If a column is sorted, often there are repeated
adjacent values. SAP HANA employs highly efficient compression methods, such as run-length encoding,
cluster coding and dictionary coding. With dictionary encoding, columns are stored as sequences of bit-coded
integers. That means that a check for equality can be executed on the integers; for example, during scans or
join operations. This is much faster than comparing, for example, string values.
6
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
SAP HANA Architecture
Columnar storage, in many cases, eliminates the need for additional index structures. Storing data in columns
is functionally similar to having a built-in index for each column. The column scanning speed of the in-memory
column store and the compression mechanisms especially dictionary compression allow read operations
with very high performance. In many cases, it is not required to have additional indexes. Eliminating additional
indexes reduces complexity and eliminates the effort of defining and maintaining metadata.
2.1.2 Parallel Processing
SAP HANA was designed to perform its basic calculations, such as analytic joins, scans and aggregations in
parallel. Often it uses hundreds of cores at the same time, fully utilizing the available computing resources of
distributed systems.
With columnar data, operations on single columns, such as searching or aggregations, can be implemented as
loops over an array stored in contiguous memory locations. Such an operation has high spatial locality and can
efficiently be executed in the CPU cache. With row-oriented storage, the same operation would be much
slower because data of the same column is distributed across memory and the CPU is slowed down by cache
misses.
Compressed data can be loaded into the CPU cache faster. This is because the limiting factor is the data
transport between memory and CPU cache, and so the performance gain exceeds the additional computing
time needed for decompression.
Column-based storage also allows execution of operations in parallel using multiple processor cores. In a
column store, data is already vertically partitioned. This means that operations on different columns can easily
be processed in parallel. If multiple columns need to be searched or aggregated, each of these operations can
be assigned to a different processor core. In addition, operations on one column can be parallelized by
partitioning the column into multiple sections that can be processed by different processor cores.
SAP HANA Modeling Guide
SAP HANA Architecture
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 7


2.1.3 Simplifying Applications
Traditional business applications often use materialized aggregates to increase performance. These
aggregates are computed and stored either after each write operation on the aggregated data, or at scheduled
times. Read operations read the materialized aggregates instead of computing them each time they are
required.
With a scanning speed of several gigabytes per millisecond, SAP HANA makes it possible to calculate
aggregates on large amounts of data on-the-fly with high performance. This eliminates the need for
materialized aggregates in many cases, simplifying data models, and correspondingly the application logic.
Furthermore, with on-the fly aggregation, the aggregate values are always up-to-date unlike materialized
aggregates that may be updated only at scheduled times.
2.2 SAP HANA Database Architecture
A running SAP HANA system consists of multiple communicating processes (services). The following shows
the main SAP HANA database services in a classical application context.
Figure 1: SAP HANA Database High-Level Architecture
Such traditional database applications use well-defined interfaces (for example, ODBC and JDBC) to
communicate with the database management system functioning as a data source, usually over a network
8
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
SAP HANA Architecture
connection. Often running in the context of an application server, these traditional applications use Structured
Query Language (SQL) to manage and query the data stored in the database.
The main SAP HANA database management component is known as the index server, which contains the
actual data stores and the engines for processing the data. The index server processes incoming SQL or MDX
statements in the context of authenticated sessions and transactions.
The SAP HANA database has its own scripting language named SQLScript. SQLScript embeds data-intensive
application logic into the database. Classical applications tend to offload only very limited functionality into the
database using SQL. This results in extensive copying of data from and to the database, and in programs that
slowly iterate over huge data loops and are hard to optimize and parallelize. SQLScript is based on side-effect
free functions that operate on tables using SQL queries for set processing, and is therefore parallelizable over
multiple processors.
In addition to SQLScript, SAP HANA supports a framework for the installation of specialized and optimized
functional libraries, which are tightly integrated with different data engines of the index server. Two of these
functional libraries are the SAP HANA Business Function Library (BFL) and the SAP HANA Predictive Analytics
Library (PAL). BFL and PAL functions can be called directly from within SQLScript.
SAP HANA also supports the development of programs written in the R language.
SQL and SQLScript are implemented using a common infrastructure of built-in data engine functions that have
access to various meta definitions, such as definitions of relational tables, columns, views, and indexes, and
definitions of SQLScript procedures. This metadata is stored in one common catalog.
The database persistence layer is responsible for durability and atomicity of transactions. It ensures that the
database can be restored to the most recent committed state after a restart and that transactions are either
completely executed or completely undone.
The index server uses the preprocessor server for analyzing text data and extracting the information on which
the text search capabilities are based. The name server owns the information about the topology of SAP HANA
system. In a distributed system, the name server knows where the components are running and which data is
located on which server.
Related Information
SAP HANA SQLScript Reference
SAP HANA Business Function Library (BFL) Reference
SAP HANA Predictive Analysis Library (PAL) Reference
SAP HANA R Integration Guide
SAP HANA Modeling Guide
SAP HANA Architecture
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 9


3 Getting Started
The below flow diagram shows the process for modeling within SAP HANA.
Before starting the modeling activities in the SAP HANA modeler:
You have installed all the SAP HANA components that are necessary to enable data replication. For
information about installing SAP HANA, see SAP HANA Installation Guide Trigger-Based Replication
(SLT).
You have installed the SAP HANA studio as described in SAP HANA Database - Studio Installation and
Update Guide.
You have a live SAP HANA system to connect.
You have a user on the SAP HANA server that has at least the following roles or their equivalent:
MODELING: This is used as a template role that can be used to create users to work on content.
CONTENT_ADMIN: This is used as a template role for users who are responsible for managing
repository content at a higher level, and for managing teams who develop and test the content. Users
with this role can:
Maintain delivery units
Import and export content
Create, update, and delete active native and imported packages and objects in these packages
Grant these privileges to other users
The below tables lists the tasks you can perform in the SAP HANA Modeler perspective
10
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Getting Started
Table 1:
Task Meaning SAP HANA Modeler per
spective
SAP HANA Development
perspective
Import metadata Create tables by import
ing the table definitions
from the source systems
using the Data Services
infrastructure.
For more information, see
Import Table Definitions.
You can also create ta
bles from scratch using
the SAP HANA
Development perspec
tive. For more informa
tion, see Setting Up the
Persistence Model in the
SAP HANA Developer
Guide.
Load data Load data into the table
definitions imported from
the source system using
the Load Controller, SAP
Sybase Replication
Server or SAP Landscape
Transformation, and from
flat files.
For more information, see
Load Data into Tables.
You can also provision
data into the table defini
tions in the SAP HANA
Development perspec
tive. For more informa
tion, see Setting Up the
Persistence Model in the
SAP HANA Developer
Guide.
Create packages Logically group objects
together in a structured
way.
Logically group objects
together in a structured
way. For more informa
tion, see Maintaining Re
pository Packages in the
SAP HANA Developer
Guide
Create information views Model various slices of
the data stored in the
SAP HANA database. In
formation views are often
used for analytical use
cases, such as opera
tional data mart scenar
ios or multidimensional
reporting on revenue,
profitability, and so on.
For more information, see
Creating Information
Views.
You can also create infor
mation views in the SAP
HANA Development per
spective. For more infor
mation, see Setting Up
the Analytic Model in the
SAP HANA Developer
Guide.
Create procedures Create procedures using
SQLScript for implement
ing a complex logic that
cannot be achieved using
other objects.
For more information, see
Developing Procedures in
the SAP HANA Developer
Guide.
Create analytic privileges Control which data that
individual users sharing
the same data foundation
or view can see.
For more information, see
Create Analytic Privileges
[page 85].
For more information on
SAP HANA database au
thorization mechanisms,
see Setting Up Roles and
SAP HANA Modeling Guide
Getting Started
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 11


Task Meaning SAP HANA Modeler per
spective
SAP HANA Development
perspective
Authorizations in the SAP
HANA Developer Guide.
Import SAP NetWeaver
BW objects
Import SAP NetWeaver
BW objects into SAP
HANA, and expose them
as information views.
For more information, see
Import BW Objects.
Create decision tables Create a tabular repre
sentation of related rules
using conditions and ac
tions.
For more information, see
Create Decision Tables.
Import and export objects Import and export the
content objects from and
to the client and server lo
cation.
For more information
about the import and ex
port mechanisms, see
Implementing Lifecycle
Management in the SAP
HANA Developer Guide.
Note
The SAP HANA Systems view of the SAP HANA Modeler perspective lists both the active and inactive
objects from the default workspace. Also, if no other inactive version exists, you can create, edit, and
save objects in the SAP HANA Modeler perspective.
The object types listed below are supported in the SAP HANA Modeler perspective:
Attribute Views
Analytic Views
Calculation Views
Procedures
Analytic Privileges
Decision Tables
Process Visibility Scenario
The object types other than the ones that are listed above are not fully supported from Modeler
perspective. In other words, you can use the SAP HANA Modeler perspective to open those objects that
are not listed above in simple text editors only. You can open them in respective editors only in other
perspectives such as SAP HANA Development or Administration and Monitoring, and so on.
12
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Getting Started
3.1 Add a System
Establish a connection between your SAP HANA studio, and your SAP HANA system to create modeling
objects.
Procedure
1. In the SAP HANA Systems view, right-click anywhere in the view and select Add System.
2. In the System window, enter the host name, instance number, and a description for the SAP HANA system
you want to add.
3. Select Next.
4. Enter a user name and password, and select Finish.
The SAP HANA Systems view includes a new top level node for the system.
If you add multiple systems, then:
You can define a specific system as the default system by choosing Window Preferences SAP
HANA Modeler Quick Launch Default Connection .
You can to switch to a different system by choosing Select System... in the Quick Launch tab page.
Results
Note
After you have completed working on an instance, it is recommended to disconnect instances of all SAP
HANA systems within your SAP HANA Studio to ensure a secure connection. You can disconnect a specific
SAP HANA instance by executing the below steps:
1. In SAP HANA Studio, choose an SAP HANA system instance.
2. In the context menu of the SAP HANA system, choose Log Off.
You can reconnect to an instance by selecting Log on from context menu.
SAP HANA Modeling Guide
Getting Started
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 13


3.2 Create an Information View
There are three types of information views: attribute view, analytic view, and calculation view. All three types of
information views are non-materialized views. This creates agility through the rapid deployment of changes as
there is no latency when the underlying data changes.
Procedure
1. Open the SAP HANA Modeler perspective.
2. To set the view parameter, execute the steps described in Creating Information Views [page 47]
The view editor opens where you can define the input elements of the view and its output structure.
3. To design a view that you can use for analytical purposes, see About Information Views [page 14]
3.2.1 About Information Views
There are three types of information views: attribute view, analytic view, and calculation view. All three types of
information views are non-materialized views. This creates agility through the rapid deployment of changes as
there is no latency when the underlying data changes.
Attribute Views
You can use attribute views to model an entity that is based on relationships between attribute data contained
in multiple source tables.
For example, customer ID is the attribute data that describes measures (that is, who purchased a product).
However, customer ID has much more depth to it when joined with other attribute data that further describes
the customer (customer address, customer relationship, customer status, customer hierarchy, and so on).
You create an attribute view to locate the attribute data, and to define the relationships between the various
tables to model how customer attribute data, for example, will be used to address business needs.
You can model the following elements within an attribute view:
Columns
Calculated Columns
Note
In the Semantics node, you can classify the columns as attributes.
Hierarchies
You can choose to further fine-tune the behavior of the attributes of an attribute view by setting the properties
as follows:
Apply filters to restrict values that are selected when using the attribute view.
Define attributes as Hidden so that they can be used in calculated attributes but are not visible to the end
users.
14
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Getting Started
Note
You can mark attributes as hidden in the Data Foundation and Semantics node. Hidden attributes of an
attribute view are not visible during data preview and in analytic and calculation views using the
attribute view.
Define attributes as key attributes. The join optimizer uses those attributes that are marked as key
attributes to identify a central (main) table. The central table is the starting point for all join paths, and
identifying the central table helps optimize the join execution process.
Set the Drill Down Enabled property to indicate if an attribute is available for further drill down when
consumed.
Attribute views can later be joined to tables that contain measures within the definition of an analytic view or a
calculation view to create virtual star schema on the SAP HANA data.
Analytic Views
Analytic views are used to model data that includes measures.
For example, an operational data mart representing sales order history would include measures for quantity,
price, and so on.
The data foundation of an analytic view can contain multiple tables. However, measures that are selected for
inclusion in an analytic view must originate from only one of these tables.
Note
For business requirements that include measures sourced from multiple source tables, see Calculation
View.
Typically, you can include attribute views in the analytic view definition. In this way, you can achieve additional
depth of attribute data. The analytic view inherits the definitions of any attribute views that are included in the
definition. For example:
<Customer_ID/Customer_Name Order_Number Product_ID/Product_Name/Product_Hierarchy
Quantity_Ordered Quantity_Shipped>
Analytic views can also be a combination of tables that contain both attribute data and measure data; for
example, a report requiring the following:
<Customer_ID Order_Number Product_ID Quantity_Ordered Quantity_Shipped>
You can model the following elements within an analytic view:
Columns
Calculated Columns
Restricted Columns
Remember
In the Semantics node, you can classify columns and calculated columns as type attributes and
measures. The attributes you define in an analytic view are local to that view. However, attributes
coming from attribute views in an analytic view are shared attributes.
Variables
SAP HANA Modeling Guide
Getting Started
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 15


Input parameters
You can choose to further fine-tune the behavior of the attributes and measures of an analytic view by setting
the properties as follows:
Apply filters to restrict values that are selected when using the analytic view.
Define attributes and measures as Hidden so that they can be used in calculated columns but are not
visible to end users.
Note
You can mark attributes/measures as hidden in the Logical Join and Semantics node. Hidden attributes
of an analytic view are not visible during data preview and in the calculation views using the analytic
view.
Set the Drill Down Enabled property to indicate if an attribute is available for further drill down when
consumed.
Set the aggregation type on measures.
Assign Semantic Type to the attributes and measures.
Associate a measure with the currency and unit of measure using the Measure Type property
Calculation Views
A calculation view is used to define more advanced slices on the data in the SAP HANA database. Calculation
views can be simple and mirror the functionality found in both attribute views and analytic views. However,
they are typically used when the business use case requires advanced logic that is not covered in the previous
types of information views.
For example, calculation views can have layers of calculation logic, can include measures sourced from
multiple source tables, can include advanced SQL logic, and so on. The data foundation of the calculation view
can include any combination of tables, column views, attribute views and analytic views. You can create joins,
unions, projections, and aggregation levels on the sources.
You can model the following elements within a calculation view:
Attributes
Measures
Calculated Columns
Counters
Hierarchies (created outside of the attribute view)
Variables
Input parameters
Calculation views can include measures and be used for multidimensional reporting or can contain no
measures and used for list-type of reporting. Calculation views can either be created using a graphical editor
or using SQLScript . These various options provide maximum flexibility for the most complex and
comprehensive business requirements.
You can choose to further fine-tune the behavior of the attributes and measures of a calculation view by
setting the properties as follows:
Apply filters to restrict values that are selected when using the calculation view.
Define attributes and measures as Hidden so that they can be used in calculated columns but are not
visible to end users.
16
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Getting Started
Note
You can mark attributes/measures as hidden in the default Aggregation or Projection node, and in the
Semantics node. Hidden attributes of a calculation view are not visible during data preview and in the
calculation views using this calculation view.
Set the Drill Down Enabled property to indicate if an attribute is available for further drill down when
consumed.
Set aggregation type on measures
Associate a measure with the currency and unit of measure using the Measure Type property
Note
You can look into the XML that is generated for the modeled view. You can view both the View XMLand the
Repository XML. The view XML comprises of the tags corresponding to the models created using existing
view editor. However, the repository XML depicts tags as in the old models. The two options are available in
the view editor toolbar menu.
Related Information
Attributes and Measures [page 23]
Attributes and measures form the content data that is used for modeling. While attributes represent the
descriptive data like city and country, measures represent quantifiable data like revenue and quantity sold.
Create Level Hierarchies [page 101]
You create hierarchies to arrange view attributes that enhances data analysis by displaying attributes
according to their defined hierarchical relationships.A level hierarchy is rigid in nature, and the root and the
child nodes can only be accessed in a defined order.
Create Parent-Child Hierarchies [page 103]
A parent-child hierarchy is defined using a parent attribute that determines the relationship among the view
attributes. A parent attribute describes a self-referencing relationship, or self-join, within the main table.
Assign Variables [page 110]
You can assign variables to a filter at design time for obtaining data based on the values you provide for the
variable. At runtime, you can provide different values to the variable to view the corresponding set of
attribute data.
3.2.2 SAP HANA Studio
The SAP HANA studio is an Eclipse-based development and administration tool for working with SAP HANA,
including creating projects, creating development objects, and deploying them to SAP HANA. As a developer,
you may want to also perform some administrative tasks, such as configuring and monitoring the system.
There are several key Eclipse perspectives that you will use while developing:
Modeler: Used for creating various types of views and analytical privileges.
SAP HANA Modeling Guide
Getting Started
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 17


SAP HANA Development: Used for programming applications, that is, creating development objects that
access or update the data models, such as server-side JavaScript or HTML files.
Debug: Used to debug code, such as server-side JavaScript or SQLScript.
Administration: Used to monitor the system and change settings.
To open a perspective, go to Window Open Perspective , or select on the toolbar.
3.2.2.1 Quick Tour: SAP HANA Modeler Perspective
The SAP HANA Modeler perspective is used to define your analytic model by creating various types of views.
The perspective contains the following main areas:
SAP HANA Systems view: A view of the database objects, that is, those objects you create from the
Modeler perspective.
Quick Launch area: A collection of shortcuts for performing the most common modeling tasks. If you close
the Quick Launch tab, you can reopen it by selecting Help Quick Launch .
Properties view: A view that consists of all the object properties.
Job Log view: A view that displays information related to requests entered for a job such as, validation,
activation, and so on.
18
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Getting Started
Where-Used view: A view that list down all the objects where the selected object has been used.
3.2.2.1.1 The SAP HANA Systems View
The Systems view is one of the basic organizational elements included with the Development perspective.
You can use the Systems view to display the contents of the SAP HANA database that is hosting your
development project artifacts. The Systems view of the SAP HANA database shows both activated objects
(objects with a runtime instance) and the design-time objects you create but have not yet activated.
The Systems view is divided into the following main sections:
Security
Contains the roles and users defined for this system.
Catalog
Contains the database objects that have been activated, for example, from design-time objects or from
SQL DDL statements. The objects are divided into schemas, which is a way to organize activated database
objects.
Provisioning
Contains administrator tools for configuring smart data access, data provisioning, and remote data
sources
Content
Contains design-time database objects, both those that have been activated and those not activated. If
you want to see other development objects, use the Repositories view.
For more information on SAP HANA Repositories View, see SAP HANA Developer Guide.
SAP HANA Modeling Guide
Getting Started
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 19


3.2.2.1.2 Information View Editor Components
In the SAP HANA Modeler perspective, you use the view editor to work with the information views. This editor
is also known as One View editor. The editor is common across the three types of views. The editor
components vary based on the view types as follows:
Attribute View
The Scenario panel of the editor consists of the following default nodes:
Data Foundation - represents the tables used for defining the view.
Semantics - represents the output structure of the view, that is, the dimension.
The Details panel consists of the following views:
Properties: displays basic view properties
Column: displays view columns that you can define as attributes and key attributes
Hierarchies: displays hierarchies that you create for arranging the view attributes hierarchically
20
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Getting Started
Analytic View
Scenario panel of the editor consists of the following default nodes:
Data Foundation - represents the tables used for defining the fact table and related tables of the view.
Logical Join - represents the relationship between the selected table fields (fact table) and attribute views
that is, used to create the star schema.
Semantics - represents the output structure of the view.
The Details panel consists of the following views:
Properties: displays basic view properties
Column: contains analytic view local columns that you can define as attributes and measures, and shared
attributes from the underlying attribute views. You can define several display folders and assign the
measures to these display folders for grouping the related measures.
Hierarchies: contains hierarchies from the underlying attribute views
Variables/Input Parameters: contains variables and input parameters used to filter attribute data and to
obtain a desired functionality when the view is executed based on the value provided at runtime.
SAP HANA Modeling Guide
Getting Started
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 21


Graphical Calculation View
The Scenario panel of the editor consists of the following default nodes:
Aggregation / Projection node - based on your setting for the property Data Category to Cube or
Dimension, these default nodes appear. If the property is set to Cube, the default node is an aggregation
node. If the property is set to Dimension, the default node is projection node.
Note
You can change the default node in the Scenario panel as required; for example, projection node to
aggregation node using the context menu option Switch to Aggregation.
Semantics - represents the output structure of the view.
The Details panel consists of the following views:
Properties: displays basic view properties
Column: contains analytic view local columns that you can define as attributes and measures. You can
define several display folders and assign the measures to these display folders for grouping the related
measures.
Hierarchies: contains hierarchies from the underlying attribute views
Variables/Input Parameters: contains variables and input parameters used to filter attribute data and to
obtain a desired functionality when the view is executed based on the value provided at runtime.
22
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Getting Started
Script-based Calculation View
The Scenario panel of the editor consists of the following default nodes:
Script Node- represents the script, that is, a series of SQL statements defining calculation view logic.
Semantics - represents the output structure of the view.
The Details panel consists of the following views:
Properties: displays basic view properties
Column: contains analytic view local columns that you can define as attributes and measures. You can
define several display folders and assign the measures to these display folders for grouping the related
measures.
Hierarchies: contains hierarchies from the underlying attribute views
Variables/Input Parameters: contains variables and input parameters used to filter attribute data and to
obtain a desired functionality when the view is executed based on the value provided at runtime.
3.2.3 Attributes and Measures
Attributes and measures form the content data that is used for modeling. While attributes represent the
descriptive data like city and country, measures represent quantifiable data like revenue and quantity sold.
Attributes
Attributes are the individual non-measurable analytical elements.
Simple Attributes
Simple attributes are individual non-measurable analytical elements that are derived from the data
foundation.
For example, PRODUCT_ID and PRODUCT_NAME are attributes of a PRODUCT subject area.
SAP HANA Modeling Guide
Getting Started
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 23


Calculated Attributes
Calculated attributes are derived from one or more existing attributes or constants.
For example, deriving the full name of a customer (first and last name), assigning a constant value to an
attribute that can be used for arithmetic calculations.
Local Attributes
Local attributes that you use in an analytic view allow you to customize the behavior of an attribute for only
that view.
For example, if an analytic view or a calculation view include an attribute view, it inherits the behavior of
the attributes from the attribute view. If you set the parameter once, it is replicated in all views that
consumes it.
Note
If you create an analytic view for one specific use case in which you want a particular attribute to behave
differently than it does in the attribute view to which it belongs, you can define it as a local attribute.
Measures
Measures are measurable analytical elements. Measures are derived from the analytic and calculation views.
Simple Measures
A simple measure is a measurable analytical element that is derived from the data foundation.
For example, PROFIT.
Calculated Measure
Calculated measures are defined based on a combination of data from OLAP cubes, arithmetic operators,
constants, and functions.
For example, you can use calculated measures to calculate the total sales of a product across five regions,
or to assign a constant value to a measure for a calculation.
Restricted Measure
Restricted measures are used to filter the value based on the user-defined rules for the attribute values.
Counters
Counters add a new measure to the calculation view definition to count the recurrence of an attribute. For
example, to count how many times product appears.
Note
You can choose to hide the attributes and measures that are not required for client consumption. For
example, for a complex calculation that is derived from a series of computations, you can hide the levels of
computations that are not required for reporting purposes.
24
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Getting Started
3.2.4 Required Permissions
You need a minimum set of permissions to perform the modeling activities such as, create, activate, and data
preview on views and analytic privileges.
SQL Privileges
1. _SYS_BI - SELECT privilege
2. _SYS_BIC - SELECT privilege
Note
If you are using front end tools such as, SAP Lumira or Advanced Analysis for Office, see SAP Note
1907696 to grant SQL privileges.
3. REPOSITORY_REST (SYS) - EXECUTE privilege
4. <<schema_where_tables_reside>> - SELECT privilege
Note
The above permissions need not be Grantable to other users and roles.
Analytic Privileges
1. _SYS_BI_CP_ALL
Package Privileges
1. Root Package - REPO.MAINTAIN_NATIVE_PACKAGES privilege
2. <<package_used_for_content_objects>> - REPO.READ, REPO.EDIT_NATIVE_OBJECTS &
REPO.ACTIVATE_NATIVE_OBJECTS
Note
The above permissions need not be Grantable to other users and roles.
Grant select on the schema <<schema_where_tables_reside>> to _SYS_REPO
For creation of delivery units, you need the REPO.MAINTAIN_DELIVERY_UNITS system privilege
For export & import of delivery units, use the REPO.IMPORT, REPO.EXPORT system privileges
For working in foreign workspaces, use the REPO.WORK_IN_FOREIGN_WORKSPACES system privileges
SAP HANA Modeling Guide
Getting Started
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 25


4 Importing Table Definitions and Data
This section discusses on various options available for importing table definitions and data from the SAP
HANA Modeler perspective.
4.1 Import Table Definitions
You need to import the table definitions as a prerequisite for creation of information views.
Prerequisites
You have configured the SAP HANA modeler for importing metadata using the Data Services infrastructure.
1. In the Quick Launch tab page, choose Configure Import Server.
2. Enter the IP address of the server from which you want to import data.
3. Enter the repository name.
4. Enter the ODBC data source, and choose OK.
Context
Based on your requirements, use one of the following approaches:
Mass Import: To import all table definitions from a source system. For example, you can use this approach
if this is a first import from the given source system.
Selective Import: To import only selected table definitions from a source system. For example, you can
use this approach if there are only few table definitions added or modified in the source system after your
last import.
Procedure
1. If you want to import all table definitions from a source system, do the following:
a) In the File menu, choose Import.
b) Expand the SAP HANA Content node.
c) Choose Mass Import of Metadata, and choose Next.
d) Select the target system where you want to import all the table definitions, and choose Next.
e) In the Connection Details dialog, enter the operating system username and password of the target
system.
26
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Importing Table Definitions and Data
f) Select the required source system, and choose Finish.
Note
If the required system is not available from the dropdown list, you need to contact your
administrator.
2. If you only want to import selective table definitions from a source system, do the following:
a) In the File menu, choose Import.
b) Expand the SAP HANA Content node.
c) Choose Selective Import of Metadata, and choose Next.
d) Select the target system where you want to import the table definitions, and choose Next.
e) Select the required source system.
Note
If the required system is not available from the dropdown list, you need to add the new source
system using Manage Connections. For more information about installing and using Manage
Connections functionality, refer to 1942414 .
f) In the Type of Objects to Import field, select the required type, and choose Next.
g) Add the required objects (tables or extractors) that you want to import.
Note
If you want to add dependent tables of a selected table, select the required table in the Target
panel, and choose Add Dependent Tables in the context menu.
h) Select the schema into which you want to import the metadata.
i) If you selected object type as extractor, select the package into which you want to place the
corresponding objects.
j) Choose Next, then review and confirm the import by choosing Finish.
4.2 Load Data into Tables
Prerequisites
If you are using the Load Controller or Sybase Replication Server infrastructure, make sure that you have
imported all table definitions into the SAP HANA database. For more information, see Import Table
Definitions [page 26].
If you are using the SLT component, the source system(s), target system and the target schema, are
configured by the administrator during the installation.
SAP HANA Modeling Guide
Importing Table Definitions and Data
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 27


Context
Use this procedure to load data into your table definitions. Depending on your requirements, you can perform
the following:
Initial Load - to load all data from a source SAP ERP system into the SAP HANA database by using Load
Controller or SAP Landscape Transformation (SLT). This is applicable when you are loading data from the
source for the first time.
Data Replication - to keep the data of selected tables in the SAP HANA database up-to-date with the
source system tables by using SAP Sybase Replication Server or SAP Landscape Transformation (SLT).
Procedure
1. In the Quick Launch tab page, choose Data Provisioning.
2. If you are using SLT-based replication, choose one of the source systems from the Select Source System
dropdown list.
Note
Select Source System dropdown list contains all the ERP and non-ERP source systems which are
connected to the SLT system.
3. If you are using the SLT-based replication, select the target schema which is configured for SAP ERP or
non-SAP systems in the Target Schema Configured dropdown list.
4. Choose Load for initial load or Replicate for data replication .
5. Select the required tables to load or replicate data in any of the following ways:
Search for the required tables.
1. Select the table from the list, and choose Add.
2. Select the Export selected tables checkbox if you want to save the selected list of tables locally for
future reference, and specify the target location.
Load the list of tables from a local file as follows:
1. Choose Load from file.
2. Select the file that contains the required list of tables.
Note
The supported file type is .csv.
6. If you are using the load controller infrastructure, choose Next and enter the operating system user name
and password.
7. Choose Finish.
28
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Importing Table Definitions and Data
Next Steps
Over a period of time the SAP HANA status tables grow very large with data load action status entries, which
do not need to be maintained. You can choose to delete these entries from the SAP HANA status tables using
the delete button in the Data Load Management view. Once you choose this option in the follow-on dialog, you
can select which entries you want to delete in the status tables:
1. Choose Operation for which you want to delete the status table entries such as load, replicate, or create.
2. In the Entry Type dropdown list, select the required option.
Note
To delete all the entries from the status tables for a particular operation, choose All, otherwise
Specific.
3. If the value for Entry Type is Specific, in the Value dropdown, select the tables for which you want to
delete the entries.
4. If you want to delete the entries for a specific time period, select it using the From and To calendar options.
5. Choose Delete.
4.2.1 Suspend and Resume Data Load
When loading data into tables using SLT- based replication, you can choose to stop data replication
temporarily for a selected list of tables, and later resume data load for these.
Procedure
1. In the Quick Launch tab page, choose Data Provisioning.
2. Select the source system for which you want to suspend or resume data load.
3. Choose Suspend or Resume .
4. Select the tables, and choose Add.
5. Choose Finish.
SAP HANA Modeling Guide
Importing Table Definitions and Data
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 29


4.2.2 Upload Data from Flat Files
You can upload data from flat files in a client file system to the SAP HANA database.
Context
If the table schema corresponding to the file to be uploaded already exists in the SAP HANA database, the
new data records are appended to the existing table.
If the required table for loading the data does not exist in the SAP HANA database, create a table structure
based on the flat file.
The application suggests the column names and data types for the new tables, and allows you to edit them.
There is a 1:1 mapping between the file and table columns in the new table. The application does not allow you
to overwrite any columns or change the data type of existing data. The supported file types are: .csv, .xls,
and .xlsx.
Note
By default, the application considers up to 2000 records in the file to determine the data types of columns
in the new table. You can modify this value by choosing Window Preferences SAP HANA Modeler
Data from Local File Decision Maker Count
Procedure
1. In the File menu, choose Import.
2. In the Select an import source section, expand the SAP HANA content node.
3. Select Data from Local File, and choose Next.
4. In the Target System section, select the target system to which you want to import the data using the flat
file, and choose Next.
5. In the Define Import Properties page, browse and select the file containing the data you want to load.
a) If you have selected a CSV file, select a delimiter.
Note
A delimiter is used to determine columns and pick the correct data from them. In a csv file, the
accepted delimiters are ',', ';' and ':'.
b) If you have selected an .xls or .xlsx file, select a worksheet.
6. Select the New option if you want to load the data into a new table.
a) Choose Next.
b) On the Manage Table Definition and Data Mapping screen, map the source and target columns.
30
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Importing Table Definitions and Data
Note
Only 1:1 column mapping is supported. You can also edit the table definition by changing the
data types, renaming columns, adding or deleting the columns, and so on.
You can choose to map the source and target columns using the Auto Map option. If you
choose the one to one option, then the first column from the source is mapped to the first
column of the target. If you choose the Map by name option, the source and target columns
with the same name are mapped.
7. Select the Existing option if you want to append the data to an existing table.
a) Choose Next.
b) On the Manage Table Definition and Data Mapping screen, map the source and target columns.
8. Perform the following steps if you want to provide a constant value for a column at the target:
a) Right-click the column. From the context menu, choose Make As Constant.
b) In the Constant dialog box, enter a value, and choose OK.
Note
You can set a column to constant if it is not mapped to a source column.
9. Enter a value in the Default Value column to provide a default value for a column at the target. Choose
Finish.
4.3 Copy Content Delivered by SAP
You can copy the standard content shipped by SAP or by an SAP partner to your local package for modeling
and reporting use cases; for example, from sap.ecc.fin to customer.ecc.fin.
Prerequisites
You have the following privileges:
REPO.READ for the source package.
REPO.MAINTAIN_NATIVE_PACKAGES and REPO.EDIT_NATIVE_OBJECTS for the target root package.
Context
Tip
We recommend you to copy the content shipped by SAP or an SAP partner to your local package to avoid
overwriting your changes during the subsequent import.
SAP HANA Modeling Guide
Importing Table Definitions and Data
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 31


Restriction
For script-based calculation views and procedures, even if you copy the dependent objects, you need to
change the script manually and adjust the dependent object references.
Procedure
1. In the Quick Launch tab page, choose Mass Copy.
2. To create a mapping between the source package and the target package, choose Add.
3. Select a source package and a target package.
Tip
You can copy the content delivered by SAP to the target root package (or to sub packages within the
root package), and maintain your package mappings accordingly. If you want to add more than one
package mapping, then on the next row, choose the source package and target package as required.
4. Store Mappings. Select the corresponding checkbox to store your mappings information in either Global
Catalog Store (M_CONTENT_MAPPING table) or in your Local Workspace respectively. If you are launching
this dialog for the first time, the system will fetch the package mapping information available in the Global
Catalog Store.
5. Choose Next
6. Select the required objects, and choose Add.
Caution
If you copy an object, but not its dependent objects, the object that you copy to the target package will
have references to the dependent objects in the source package.
7. Choose Next to view the summary.
Tip
You can deselect an object to avoid copying it to the target package.
8. Choose Finish to confirm content copy.
Next Steps
You need to activate the copied objects in the target package to consume them for reporting purposes.
32
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Importing Table Definitions and Data
4.4 Map Authoring Schema to the Physical Schema
Schema mapping is done when the physical schema in the target system is not the same as the physical
schema in the source system, usually in a transport scenario. The schema mapping is maintained via a
mapping table.
Context
You can map the authoring schemas to the physical database schemas in the target system to access and
deploy transported objects.
A physical schema is a schema in which the tables are available. It may differ in the source and target systems.
An authoring schema (logical schema) is the database schema used in the design time views. For example,
this is the database schema that is used in the content development system.
Content object definitions are stored in the repository and contain references to the physical database
schemas. When you copy the content objects to a different system, for example, from an SAP system to a
customer system or between customer systems, the object definition still refers to the physical database
schemas at the source. To resolve this, you use schema mapping.
Remember
Schema mapping only applies to references from repository objects to catalog objects. It is not intended to
be used for repository to repository references.
Restriction
You need to map the references of the script-based calculation views and procedures manually, that is, by
changing the script if the tables are qualified with the schema. If the tables are not qualified, the default
schema of the view is used, and the schema mapping is also applied to the default schema.
You can map several authoring schemas to the same physical schema. For example, content objects delivered
by SAP refer to different authoring schemas, whereas in the customer system, all these authoring schemas
are mapped to a single physical schema where the tables are replicated.
Remember
The mapping between authoring and physical schemas is stored in the configuration table
_SYS_BI.M_SCHEMA_MAPPING
Note
If a system does not have schema mapping, the authoring schema is filled 1:1 from the physical schema;
otherwise, the default schema cannot be changed.
SAP HANA Modeling Guide
Importing Table Definitions and Data
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 33


Procedure
1. In the Quick Launch tab page, choose Schema Mapping.
2. Choose Add.
3. Enter the authoring schema and physical schema that need to be mapped.Choose OK.
Example
Consider a source system, SAP, with an information object, AV1. This refers to the table MARA in the
SAP_ERP physical database schema. There is a target system, Customer, with the physical database
schema EMEA.
After you import content, the object AV1 cannot be activated in the Customer system, because it still refers
to the SAP_ERP schema.
AV1 in the Customer system currently refers to SAP_ERP. To be able to activate the object, you need to
modify the mapping of AV1 in the Customer system.
To do this, a mapping is created in the target system Customer between the authoring and physical schema
as follows:
Authoring Schema Physical Schema
SAP_ERP EMEA
4.4.1 Package Specific Default Schema
You maintain package specific default schema in order to maintain a single authoring schema.
If you have mapped multiple authoring schemas against a single physical schema, and if you try to create new
views (or if you try to change a particular view by adding more catalog objects), the view editor automatically
34
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Importing Table Definitions and Data
considers the authoring schema of the catalog objects as its physical schema. This is typically seen in
scenarios in which multiple backend systems (E.g. ERP, CRM) are connected to a single SAP HANA instance.
In such scenarios, in order to maintain a single authoring schema, you can maintain a default schema for the
objects that are defined in specific packages. You define the package specific default schema, as an authoring
schema, in your schema mapping definition, and maintain it in the table M_PACKAGE_DEFAULT_SCHEMA
(Schema: _SYS_BI). The system creates this table while you update your existing SAP HANA instance or when
you install a new SAP HANA instance. Each time you modify the content of the table, you have to restart your
SAP HANA studio instance to update the schema mapping and package specific default schema information
Note
You use SQL statements INSERT, UPDATE and DELETE to maintain this table.
Example
Consider the following schema mapping definition in M_SCHEMA_MAPPING:
AUTHORING_SCHEMA PHYSICAL_SCHEMA
SAP_ECC CUS_PHY
SAP_FND SAP_TEST
SAP_CRM CUS_PHY
SAP_RET SAP_TEST
SAP_AUTH OTHER
OTHER_AUTH OTHER
Consider the following schema mapping definition in M_PACKAGE_DEFAULT_SCHEMA:
PACKAGE_NAME M_PACKAGE_DEFAULT_SCHEMA
sap.ecc SAP_ECC
sap.ecc SAP_RET
sap.crm CUS_CRM
sap.crm.fnd SAP_ECC
OTHER_AUTH
Scenario 1:
Consider that you have defined an object in package sap.ecc.fnd, and you are trying to add a catalog table
from physical schema CUS_PHY.
In the above scenario, a lookup for schema mapping definition in M_SCHEMA_MAPPING results in
authoring schemas SAP_ECC, SAP_CRM. A look up for package specific default schema in
M_PACKAGE_DEFAULT_SCHEMA results in default schemas SAP_ECC, SAP_RET.
The view editor considers SAP_ECC as the default schema and not SAP_RET.
SAP HANA Modeling Guide
Importing Table Definitions and Data
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 35


Note
The package matching is done recursively navigating to the parent package as long as the package entry
does not match.
Scenario 2:
Consider that you have defined an object in package sap.crm.fnd, and you are trying to add a catalog table
from the physical schema, CUS_PHY.
A lookup for schema mapping definition in M_SCHEMA_MAPPING results in authoring schemas SAP_ECC,
SAP_CRM. A look up for package specific default schema in M_PACKAGE_DEFAULT_SCHEMA results in
one default schema SAP_ECC.
The view editor considers SAP_ECC as the default schema.
Scenario 3:
Consider that you have defined an object in package sap.crm, and you are trying to add a catalog table from
the physical schema, CUS_PHY.
A lookup for schema mapping definition in M_SCHEMA_MAPPING results in authoring schemas SAP_ECC,
SAP_CRM. A look up for package specific default schema in M_PACKAGE_DEFAULT_SCHEMA results in
one default schema SAP_CRM.
The view editor considers SAP_CRM as the default schema.
Scenario 4:
Consider that you have defined an object in package sap.crm, and you are trying to add a catalog table from
the physical schema, OTHER.
A lookup for schema mapping definition in M_SCHEMA_MAPPING results in one authoring schema
SAP_AUTH
A look up for package specific default schema in M_PACKAGE_DEFAULT_SCHEMA results in one default
schema SAP_CRM.
The view editor does not consider SAP_CRM as the default schema. (since it is neither the physical schema
nor is it defined in the list of authoring schemas). As a result, the view editor considers the authoring
schema SAP_AUTH.
Scenario 5:
Consider that you have defined an object in package cus.crm, and you are trying to add a catalog table from
physical schema, OTHER.
A lookup for schema mapping definition in M_SCHEMA_MAPPING results in two authoring schemas
SAP_AUTH, OTHER_AUTH.
A look up for package specific default schema in M_PACKAGE_DEFAULT_SCHEMA results in one default
schema OTHER_AUTH.
The view editor considers OTHER_AUTH as the default schema.( since a mapping for it exists in the table
M_SCHEMA_MAPPING with OTHER as its corresponding physical schema).
36
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Importing Table Definitions and Data
Scenario 6:
Consider that there are no default schemas found in M_PACKAGE_DEFAULT_SCHEMA (matching default
schemas for package / parent packages, or an entry with <empty> package name). In such scenarios, view
editor considers the authoring schemas matched to the corresponding physical schema from the table
M_SCHEMA_MAPPING.
4.4.2 Change Authoring Schemas
You can change the authoring schema of the catalog objects referenced in a model, and also change the
authoring schema of elements of the object.
Context
Each information model points to catalog objects such as, tables from various schemas. In the case of a
transport scenario, the physical schema where these catalog objects are placed may vary when the models
are transported from one system to another. To work with the transported models, the physical schema
information is separated with the information models using schema mapping. With correct schema mapping
at the target system, you can work on the transported models without modifying them.
As all the information models save authoring schema details, if required, the modeler or content administrator
can change the existing authoring schema of one or more information models to a new one.
Procedure
1. In the Quick Launch tab page, choose Change Authoring Schema.
2. In the Change Authoring Schema dialog, select the objects for which you want to change the authoring
schema.
Note
If you change the authoring schema of an analytic view where underlying objects such as tables also
point to the same authoring schema, the authoring schema for all these elements also changes. The
default schema (containing currency related tables) for the selected analytic view also changes.
3. Select or enter the authoring schema that you want to change for the objects selected above in the Source
dropdown list.
4. Select or enter the authoring schema that you want to associate with the objects selected above in the
Target dropdown list and choose OK.
Note
If you enter an authoring schema as a target that does not exist in the schema mapping defined for the
current system instance, then the specified authoring schema name is set in the information models
SAP HANA Modeling Guide
Importing Table Definitions and Data
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 37


irrespective of whether a schema mapping exists. In this case, you need to map the authoring schema
to the physical schema.
Next Steps
If the mapping of the newly associated authoring schema with the correct physical schema (where catalog
objects reside) is not available, you cannot open the objects. In such cases, you need to map the authoring
schema with the correct physical schema, for example:
Table 2: Schema Mapping
Authoring Schema Physical Schema
AS1 PS1
AS2 PS1
AS3 PS2
If you change the authoring schema of the information models from AS1 to AS2, you can work with the models
as is. But if you change the authoring schema of the information models from AS1 to AS3, due to the current
schema mapping, the tables are read from physical schema PS2. If the required tables are present in PS2, the
models will work as is, otherwise, the models cannot be opened. In this case, you should change the mapping
to a different physical schema so the models can open by reading the tables from physical schema PS1.
Table 3: Schema Mapping
Authoring Schema Physical Schema
AS1 PS1
AS2 PS1
AS3 PS1
4.5 Generate Time Data
For modeling a business scenario that requires time dimension, you can populate time data in the default time-
related tables present in _SYS_BI schema, for example while creating time attribute views. You can choose to
generate the time data for a given time span based on your requirements such as, calendar type and
granularity.
Context
38
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Importing Table Definitions and Data
If you model a time attribute view without generating time data and you use the data preview, then an empty
view is shown. The time range for which you can generate the time data for the selected granularity is
mentioned in the table below:
Granularity Range
Seconds <= 5 years
Minutes <= 15 years
Hour <= 30 years
Day <= 50 years
Week <= 50 years
Month <= 50 years
Year <= 50 years
Note
If you populate the data before modeling time attribute views, you can use the Value Help from the
respective time tables.
Procedure
1. In the Quick Launch tab page, choose Generate Time Data.
2. If your financial year is same as the calendar year,for example, January to December, choose Gregorian in
the Calendar Type dropdown .
a) Enter the period for which you want to generate time data.
b) Select the required granularity
Note
If the selected granularity is Week or Month, specify the First day of the week.
c) Choose Generate.
The system populates the generated time data in M_TIME_DIMENSION_YEAR,
M_TIME_DIMENSION_MONTH, M_TIME_DIMENSION_WEEK, M_TIME_DIMENSION tables in _SYS_BI
schema.
3. If your financial year is not the same as the calendar year, for example, March to April, select Fiscal in the
Calendar Type dropdown .
a) Enter the period for which you want to generate the time data.
b) Select the Variant Schema where the tables that contain variant data are maintained.
Note
Tables T009 and T009B contain variant information.
c) Select the required variant that specifies the number of periods, along with their start and end dates,
according to your use case.
SAP HANA Modeling Guide
Importing Table Definitions and Data
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 39


d) Choose Generate.
The system populates the generated time data in the M_FISCAL_CALENDAR table, which is located in the
_SYS_BI schema.
Note
The following restrictions must be considered for generating time dimension data in SAP HANA
Modeler:
Minimum start year: 1900
Maximum end year: 2200
Maximum years generated: 50
40
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Importing Table Definitions and Data
5 Setting Up the Modeling Environment
This section describes how you can change the default settings and define certain preferences before you
begin working with the SAP HANA modeling environment.
5.1 Set Modeler Preferences
Launch the modeler preferences screen to view and manage the default settings that the system must use
each time you logon to the SAP HANA Modeler perspective.
Procedure
1. Choose Window Preferences SAP HANA Modeler .
Note
You can also set the preferences choosing Quick Launch Manage Preferences
2. Choose the type of preference you want to specify.
3. Choose Apply and OK.
Note
Choose Restore Defaults to restore your earlier preferences.
Related Information
Modeler Preferences [page 41]
You can specify certain default values that the system must use each time you log on to the SAP HANA
Modeler perspective. Use this Modeler Preferences screen to manage the default settings.
Keyboard Shortcuts [page 44]
Keyboard shortcuts to perform your modeling activities such activate, validate, data preview, etc.
5.1.1 Modeler Preferences
You can specify certain default values that the system must use each time you log on to the SAP HANA
Modeler perspective. Use this Modeler Preferences screen to manage the default settings.
Choose your requirement from the table below, and execute the substeps mentioned for your requirement.
SAP HANA Modeling Guide
Setting Up the Modeling Environment
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 41


Requirement Preference Substeps
To specify the structure of content
packages in the SAP HANA Systems
view
Content Presentation
Under Package Presentation select one
of the following options:
Hierarchical - to view the package
structure in a hierarchical manner
such that the child folder is inside
the parent folder.
Flat - to view all the packages at
the same level, for example, sap,
sap.ecc, sap.ecc.ui.
Show Object Type Folders - to group
together similar objects in a package
such as attribute views in the Attribute
View package.
Show all objects in the SAP HANA
Systems view - to view all the
repository objects in the SAP HANA
Systems view. If this option is
unchecked, only modeler objects are
available in the SAP HANA Systems
view. Also, if the option is unchecked
and the user package has no modeler
object, but it contains other hidden
repository objects, then the user
package is marked with contains
hidden objects . If the option is
checked, all the repository objects are
shown in the SAP HANA Systems view
with their names suffixed with the
object type such as,
ABC.attributeview.
Note
Select the checkbox to make
nonmodeler object types are
visible. However, not all the
operationsare supported.
To set the preferences for loading data
using flat file
Data From Local File
1. Browse the location to save error
log files for data load using flat
files.
2. Enter the batch size for loading
data. For example, if you specify
2000 and a file has records of
10000 rows the data load will
happen in 5 batches.
42
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Setting Up the Modeling Environment
Requirement Preference Substeps
3. Enter a decision maker count that
will be used to propose data types
based on the file. For example,
enter 200 if you want the proposal
to be made based on the 200
rows of file data.
To set the default value for the client
that SAP HANA modeler must use to
preview model data
Default Model Parameters Choose the client from Default Client.
To enforce various rules on objects
Note
Enforcing validation rules with
severity Error are mandatory.
Validation Rules Select the required rules to be applied
while performing object validation.
To determine the numbers of rows to
be displayed in a page
Data Preview Select the maximum rows for data
preview as required.
To specify a location for job log files Logs Expand the Logs node and choose Job
Log.Browse the location where you
want to save the job log files.
To enable logging for repository calls
and specify a location for repository
log files
Logs
1. Expand the Logs node and select
Job Log.
2. Choose True.
3. Browse the location where you
want to save the repository log
files.
To enable search for the attributes
used in the views
Search Options Choose Enable Search Attributes.
To allow lower case alphabets for
attribute view, analytic view,
calculation view, procedure and
analytic privilege names
Case Restriction Deselect the Model name in upper case
checkbox.
To use Unicode character sets in name
fields of information views, and in
names of its elements (such as input
parameter names, variable names,
hierarchy names, and so on).
Unicode characters allow you to use
multilingual text of languages you
desire. The SAP HANA Modeler
perspective supports Unicode
characters with the exception of a
small subset. The list of Unicode
characters that are not supported in
the current release includes, slashes
Field Name Preferences Select Allow Unicode characters
SAP HANA Modeling Guide
Setting Up the Modeling Environment
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 43


Requirement Preference Substeps
( /, \ ), colon and semi-colon ( :, ; ),
asterisk ( * ), question mark ( ? ),
single and double quotes ( ", '), lesser
than and greater than (<, >), pipe ( | ),
comma ( , ) , dollar ( $ ), percentage
( % ), exclamation mark ( ! ), hash sign
( # ), plus sign ( + ), ampersand ( &),
period ( . ) and space.
5.1.2 Keyboard Shortcuts
Keyboard shortcuts to perform your modeling activities such activate, validate, data preview, etc.
The table below lists the commands and the keyboard shortcuts to execute those commands:
Command Binding When Category
Activate Ctrl+Shift+A Navigator Modeler Keys
Activate Ctrl+Shift+A In Windows Modeler Keys
Add Table/Model Ctrl+Shift+= In Windows Modeler Keys
Auto Arrange Ctrl+L In Windows Modeler Keys
Data Preview Ctlr+Shift+P Navigator Modeler Keys
Data Preview Ctlr+Shift+P In Windows Modeler Keys
Display XML Alt+D In Windows Modeler Keys
Find Ctrl+F Navigator Modeler Navigator
Fit to Window Ctrl+0 In Windows Modeler Keys
Move Element in Output
Pane (Direction: Down)
Ctrl+] In Windows Modeler Keys
Move Element in Output
Pane (Direction: Up)
Ctrl+[ In Windows Modeler Keys
Open Ctrl+O Navigator Modeler Keys
Show View (View: His
tory)
Alt+Shift+Q, R In Windows Views
Show View (View: Job
Log)
Alt+Shift+Q, G In Windows Views
Show View (View: Where-
Used List)
Alt+Shift+Q, U In Windows Views
Validate Ctrl+Shift+V In Windows Modeler Keys
44
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Setting Up the Modeling Environment
Validate Ctrl+Shift+V Navigator Modeler Keys
Zoom (Type: In) Ctrl+= In Windows Modeler Keys
Zoom (Type: Out) Ctrl+- In Windows Modeler Keys
Zoom (Type: Reset) Alt+Shift+0 In Windows Modeler Keys
5.2 Apply Filters to Packages
In SAP HANA Systems view you can choose to filter the content, and view only the packages that you want to
work with. If you apply a filter at the package level, the system displays all the packages including subpackages
that satisfies the filter criteria. You can apply a filter for packages only on the Content node in the SAP HANA
Systems view.
Procedure
1. In the SAP HANA Systems view, choose Content.
2. In the context menu, choose Filter Packages....
3. In the Filter Packages dialog, enter the filter text.
4. If you want to search for the exact word written in the filter text, select the Match whole word checkbox
and choose OK.
Note
If a filter already exists, the new filter will overwrite the existing one. You can also apply the previous
filter on the Content using the Apply Filter '<filter text>' option.
5.3 Apply Filter to Objects
In SAP HANA Systems view you can choose to filter the content and view objects that you want to work with.
You can apply a filter for objects at the package level including subpackages.
Procedure
1. In the SAP HANA Systems view, expand Content.
2. In the context menu of a package, choose Filter Objects....
SAP HANA Modeling Guide
Setting Up the Modeling Environment
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 45


3. In the Filter Objects dialog, enter the filter text.
4. If you want to search for the exact word written in the filter text, select Match whole word checkbox.
5. If you want to apply the filter on the subpackages, choose the Apply filter to sub packages checkbox.
a) If you want to apply a filter to a package that does not already have one applied to it, choose Apply only
if no filter already exists.
b) If you want to replace an existing filter with a new one, choose Apply to all and overwrite existing.
6. Choose OK.
46
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Setting Up the Modeling Environment
6 Creating Information Views
Information views are often used for analytical use cases such as operational data mart scenarios or
multidimensional reporting on revenue, profitability, and so on. There are three types of information views:
attribute view, analytic view, and calculation view.
Context
All three types of information views that you create in SAP HANA Modeler perspective are non-materialized
views. This creates agility through the rapid deployment of changes.You can create information views to
depict a business scenario using content data that is, attributes and measures. To create an information view
in the SAP HANA Modeler perspective, perform the following steps:
Procedure
1. In the SAP HANA Systems view, right-click on the relevant system and expand Content .
2. Expand the package to which you want to save your information object.
3. In the context menu of the required object, such as Attribute Views or Analytic Views, choose New .
Enter a name and description for the view. To create a view based on an existing one, choose Copy From.
4. In case of an attribute view, select subtype as follows:
Scenario Procedure
Create a view with table attributes Under Sub Type , choose Standard.
Create a view with time characteristics
1. Under Sub Type drop down list, choose Time.
2. Select the required calendar type :
a. If the calendar type is Fiscal,, select a var
iant schema, and a fiscal variant.
b. If the calendar type is Gregorian, select the
granularity for the data.
3. To use the system generated time attribute
view, select Auto Create.
Note
The system creates a time attribute view
based on the default time tables, and de
fines the appropriate columns or attributes
based on the granularity. It also creates the
required filters.
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 47


Scenario Procedure
Note
The tables used for time attribute creation with
calendar type Gregorian are, M_TIME_DIMEN
SION, M_TIME_DIMENSION_ YEAR, M_TIME_DI
MENSION_ MONTH, M_TIME_DIMEN
SION_WEEK and for calendar type Fiscal is
M_FISCAL_CALENDAR. If you want to do a data
preview for the created attribute view, you need
to generate time data into tables from the Quick
Launch.
Copy a view from an existing view in this case,
you can modify the copied view
1. Choose Copy From.
2. Select the required attribute view.
Derive a view from an existing view if you cannot
modify the derived view that acts as a reference to
the base attribute view.
1. Under Sub Type , choose Derived and select
the required attribute view.
5. In case of a calculation view, perform the following:
1. Choose SQL Script if you want to write SQL statements for a calculation view script. Set the Parameter
case sensitive to True or False as you want the calculation view output parameter naming convention.
2. Choose Graphical if you want to use to the graphical modeling features to create a calculation view.
3. Choose Data Category to indicate whether you want to make the view available for reporting purposes.
Note
If you choose the value as Cube, the view is enabled for multidimensional reporting. If you choose
the value as Dimension, the view is not enabled for multidimensional reporting. If you do not enable
multidimensional reporting, you can create a calculation view without any measure. In this case it
works similar to a SQL view or an attribute view . When this property is disabled, the input to the
Semantics node is defaulted with a Projection node. If the property is enabled, the input to the
Semantics node is defaulted with an Aggregation node. You can also change the value of this
property in the Properties panel.
4. If the Star Join checkbox is selected and the Data Category is set to Cube, then the default input node
to the Semantics node is Star Join.
Note
Star Join node enables you to join the fact data with the dimensional data. The input allowed to the
Star Join include the lower nodes and calculation views of type dimension.
6. Choose Finish. The editor opens with the new view.
Note
The SAP HANA modeling environment does not allow row stores tables in information views.
48
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
To view the definition of information views that you have created, choose an information view, and from
the context menu, choose Open. The corresponding editor of the view opens.
Note
To optimize loading efficiency of a view, resource is loaded in two phases. In the first phase, main object
is loaded and the editor opens with the main object and the references for required objects. In the
second phase, required objects are loaded in the background and references are resolved. While
loading of required objects is in process, references appear as yellow decorators indicating that the
loading is still in progress. You can view the definition of the model while the loading is in progress but
any attempt to edit an operation will be queued and processed only after the loading is complete.
6.1 Using Attribute Views
Attribute views are used to model an entity based on the relationships between attribute data contained in
multiple source tables.
In attribute views you define joins between tables and select a subset or all of the table's columns and rows.
The rows selected can also be restricted by filters. One application of attribute views is to join multiple tables
together when using star schemas, to create a single dimension view. The resultant dimension attribute view
can then be joined to a fact table via an analytic view to provide meaning to its data. In this use case, the
attribute view adds more columns and also hierarchies as further analysis criteria to the analytic view. In the
star schema of the analytic view, the attribute view is shown as a single dimension table (although it might join
multiple tables), that can be joined to a fact table. For example, attribute views can be used to join employees
to organizational units which can then be joined to a sales transaction via an analytic view
You can create hierarchies to arrange the attributes hierarchically. Hierarchies helps you to visualize and
analyze the data in a hierarchical fashion. You can create Level hierarchies and Parent Child hierarchies by
specifying the attributes that correspond to different levels, and parent child nodes respectively.
Related Information
Create Attribute Views [page 50]
You can create a view that is used to model descriptive attribute data by using attributes, that is data that
does not contain measures. Attribute views are used to define joins between tables and to select a subset or
all of the table's columns and rows.
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 49


6.1.1 Create Attribute Views
You can create a view that is used to model descriptive attribute data by using attributes, that is data that does
not contain measures. Attribute views are used to define joins between tables and to select a subset or all of
the table's columns and rows.
Prerequisites
You have imported SAP system tables T009 and T009B tables for creating an attribute view whose type is
Time.
Procedure
1. Define Output Structure
a) Add the tables that you want to use in any of the following ways:
Drag the required tables present in the Catalog to the Data Foundation node.
Select the Data Foundation node in the Scenario panel, and in the context menu of the Details
panel, choose Add... and search for the object to add.
Note
You can choose to add the same table again in Data Foundation using table aliases in the editor. For
example, consider a table containing supplier and buyer information with postal code, and another
table containing the link from postal code to region and country. Now, you want to join this
geography table two times to the buyer and the supplier.
Restriction
It is not allowed to add column views to the Data Foundation.
b) If you want to query data from more than one table, in the Details panel context menu, choose Create
Join, and enter the required details.In the New Join window, choose a left and a right table. To create a
join, choose appropriate columns from each table and set relevant properties. At a time, you can
create only a single join.
You can also join two tables by dragging and dropping the join from the column of one table to a
column in another table . After creating the join, you can edit its properties, such as join type and
cardinality, in the Properties view. You can choose to create Text Join between table fields in order to
get language-specific data
You have a product table that contains product IDs without descriptions and you have a text table for
products that contains language-specific descriptions for each product. You can create a text join
between the two tables to get the language-specific details. In a text join, the right table should be the
text table and it is mandatory to specify the Language Column.
50
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
Tip
You can set the cardinality of the join as required. By default, the cardinality of the join is empty.
The empty cardinality can be specified if you are not sure about the right cardinality. If you specify
the empty cardinality, the system will determine the cardinality during the join evaluation phase.
Caution
Selecting the incorrect cardinality can lead to erroneous data or slower execution.
c) Add the table columns to the output structure that is, the Semantics node that you want to use to
define attribute data. You can define the attribute data by doing one of the following:
Select the toggle button on the left of the table field.
Right-click the table field, and choose Add to Output.
d. If you want to specify a filter condition based on which system must display data for a table field in the
output, do the following:
1. Right-click the table field, and choose Apply Filter.
2. Select the required operator, and enter filter values. You can use the following operators for
filtering:
Filter Operator Description
Equal To filter and show data corresponding to the fil
ter value
Not Equal To filter and show data other than the filter
value
Between To filter and show data for a particular range
specified in the From Value and To Value
List of Values To filter and show data for a specific list of val
ues separated by comma
Not in list To filter data and show data for the values
other than the ones specified. You can provide
a list of values to be excluded using comma.
Is NULL To filter and show row data having NULL values
Is not NULL To filter and show data of all the rows that have
non NULL values
Less than To filter and show data with values less than
the one specified as filter value
Less than or Equal to To filter and show data with values less than or
equal to the one specified as filter value
Greater than To filter and show data with values greater than
the one specified as filter value
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 51


Filter Operator Description
Greater than or Equal to To filter and show data with values greater than
or equal to the one specified as filter value
Contains Pattern To filter and show data that matches the pat
tern specified in the filter value. You can use '?'
question mark to substitute a single character,
and '*' asterisk to substitute many. For exam
ple, to filter data for continents that start with
letter A, use Contains Pattern filter with value
A*. This would show the data for all the conti
nents that start with A like Asia and Africa.
Note
You can also provide input parameter as filter value using the sysntax $$<parameter_name>$
$. The specified parameter works as a placeholder and is required to be mapped to the same
name input parameter of the calculation view or the analytic view where this attribute view is
used. On mapping the parameter in the calculation view, you can view the filtered data during
calculation view data preview. If you do not map the attribute view parameter with the
calculation view parameter unfiltered data is shown.
All the table fields that you have added to the output are automatically mapped as attributes.
2. Define Key Attributes
a) Select the Semantics node.
b) In the Attributes tab page of the Column panel, select the required attribute and select the Type as Key
Attribute.
Remember
If there is more than one key attribute, all key attributes of the attribute view must point to the
same table in the data foundation. The central table of the attribute view is the one to which all the
key attributes point.
Note
In case of auto generated time attribute views, the attributes and key attributes are automatically
assigned.
Tip
You can choose to hide the attributes that are not required for client consumption by assigning
value true to the property Hidden in the Properties pane. The attributes marked as hidden are not
available for consumers or higher level views that are build the on top of the attribute view. For
existing models (before SPS06), if the hidden attribute is already used, you can either unhide the
element or remove the references.
3. Optional Step: Create Calculated Columns
52
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
a) In the Output of Data Foundation panel, right-click Calculated Columns.
b) In the context menu, choose New.
c) Enter a name and description (label) for the calculated column.
d) Select a data type for the calculated column.
e) Enter length and scale for the calculated column if required by the data type.
f) In the Expression Editor enter the expression. For example, you can write a formula such as,
if("PRODUCT" = 'ABC', "DISCOUNT" * 0.10, "DISCOUNT"). This means if attribute PRODUCT equals
the string ABC then DISCOUNT equals to DISCOUNT multiplied by 0.10 should be returned.
Otherwise the original value of attribute DISCOUNT should be used.
Note
The expression can also be assembled by dragging and dropping the expression elements from the
menus below the editor window.
g) Choose OK.
4. Optional Step: Assign Semantics
a) To add meaning to each attribute or calculated column value, in the Column panel toolbar of the
Semantics node, choose Assign Semantics.
b) In the Semantics dialog, select the required Semantics Type.
c) If you select Amount with Currency Code as Semantic Type, select an attribute or calculated column
that represents the currency code in the Currency dropdown.
Attributes and calculated columns having semantic type as currency code are highlighted for
Currency selection.
d) If you select Quantity with Unit of Measure as Semantic Type, select an attribute or calculated column
that represents the currency code in the Unit dropdown.
Attributes and calculated columns having semantic type as Unit of Measure are highlighted for Unit
selection.
The supported semantic types for attributes and calculated columns are:
Amount with Currency Code
Quantity with Unit of Measure
Currency Code
Unit of Measure
Date
Date - Business Date From
Date - Business Date To
Geo Location - Longitude
Geo Location - Latitude
Geo Location - Carto Id
Geo Location - Normalized Name
5. Optional Step: To filter and view the table data in the modeled view, which is relevant to a specific client as
specified in the table fields, such as, MANDT or CLIENT, at run time perform the following:
1. Select the Semantics node, in the Properties panel edit the Default Client property.
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 53


Note
The default value for the property is the one that is specified as a preference. At run time, if the property
is set to Session Client then, the value set for the Session Client property while creating a user is used to
filter table data. At run time, if the property is set to Cross Client, the table data is not filtered for any of
the systems.
6. Activate the view using one of the following options:
If you are in the SAP HANA Modeler perspective, do the following as required:
Save and Activate - to activate the current view and redeploy the affected objects if an active
version of the affected object exists. Otherwise only current view gets activated.
Save and Activate All - to activate the current view along with the required and affected objects.
Note
You can also activate the current view by selecting the view in the SAP HANA Systems view and
choosing Activate in the context menu. The activation triggers validation check for both the client
side and the server side rules. If the object does not meet any validation check, the object activation
fails.
If you are in the SAP HANA Development perspective, do the following:
1. In the Project Explorer view, select the required object.
2. In the context menu, select Team Activate .
Note
The activation triggers the validation check only for the server side rules. Hence, if there are
any errors on the client side, they are skipped and the object activation goes through if no error
found at the server side.
7. In the Change Tracking dialog, either create a new ID or select the existing change ID. For more
information about Change Tracking, see the section SAP HANA Change Management in the chapter
Implementing Lifecycle Management of the SAP HANA Developer Guide.
8. Choose Finish .
Results
Restriction
The behavior of attribute views with the new editor is as follows:
When an object (a table of an attribute view) is removed and added again in an attribute view in order to
reflect the recently modified columns with its data type, it reflects the previous state of the columns. To
overcome this issue, you can close and open the editor, and then add the modified object. For more
information, see SAP Note 1783668 .
54
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
Related Information
Create Level Hierarchies [page 101]
You create hierarchies to arrange view attributes that enhances data analysis by displaying attributes
according to their defined hierarchical relationships.A level hierarchy is rigid in nature, and the root and the
child nodes can only be accessed in a defined order.
Create Parent-Child Hierarchies [page 103]
A parent-child hierarchy is defined using a parent attribute that determines the relationship among the view
attributes. A parent attribute describes a self-referencing relationship, or self-join, within the main table.
Generate Time Data [page 38]
For modeling a business scenario that requires time dimension, you can populate time data in the default
time-related tables present in _SYS_BI schema, for example while creating time attribute views. You can
choose to generate the time data for a given time span based on your requirements such as, calendar type
and granularity.
Description Mapping [page 130]
Description mapping helps you to associate an attribute with another attribute, which describes it in detail.
For example, when reporting via a Label Column, you can associate Region_ID with Region_Text.
6.2 Using Analytic Views
Analytic views are used to model data that includes measures. For example, transactional fact table
representing sales order history would include measures for quantity, price, and so on.
Analytic views can contain two types of columns: attributes and measures. Measures are simple, calculated or
restricted. If analytic views are used in SQL statements, then the measures have to be aggregated. For
example, using the SQL functions SUM(<column name>), MIN(<column name>), or MAX(<column name>).
Normal columns can be handled as regular attributes and do not need to be aggregated.
You can also include attribute views in the analytic view definition. In this way, you can achieve additional
depth of attribute data. The analytic view inherits the definitions of any attribute views that are included in the
definition.
Tip
If more than one element have the same name among the local and shared attributes, calculated columns,
restricted columns, and measures of an analytic view, the system does not activate the view. You can
resolve such conflict using the aliases. Aliases must also have unique names. You can assign an alias to the
required element in the Column view of the Semantics node by editing its name inline. Hereinafter, the
element is referred by its alias.
If two or more shared columns have a name conflict, during save the aliases for the conflicting name
columns are proposed. You can choose to overwrite the proposed names.
In case of previously saved models, if you find any error while opening the object due to aliasing that was
caused due to swapping of column names with the alias names, use the Quick Fix. To use the Quick Fix,
select the error message that is, the problem in the Problems view, and choose Quick Fix in the context
menu. This resolves the swapping issue by assigning right names to the column and alias.
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 55


You can choose to hide the attributes and measures that are not required for client consumption by assigning
value true to the property Hidden in the Properties pane, or selecting the Hidden checkbox in the Column
view. The attributes or measures marked as hidden are not available for input parameters, variables,
consumers or higher level views that are build on top of the analytic view. For old models (before SPS06), if the
hidden attribute is already used, you can either unhide the element or remove the references.
For an analytic view, you can set the property Data Category to Cube or Dimension. If the Data Category
property of the analytic view is set to Dimension, the view will not be available for multidimensional reporting
purposes. If the value is set to Cube, an additional column Aggregation is available to specify the aggregation
type for measures.
You can enable relational optimization for your analytic view such as, Optimize stacked SQL for example,
convert
SELECT a, SUM(X) FROM ( SELECT * FROM AV) GROUP BY A
to
SELECT A, SUM(X) FROM AV GROUP BY A
by setting the property Allow Relational Optimization.
Setting this property would be effective only for analytic views having complex calculations such that
deployment of analytic view generates catalog calculation view on top of the generated catalog OLAP view.
Caution
In this case, if this flag is set counters and SELECT COUNT may deliver wrong results
Related Information
Create Analytic Views [page 56]
Map Parameters or Variables of External Views for Value Help [page 64]
You can map the parameters or variables of external views for value help (external views as value help
references in variables and input parameters) to the parameters or variables of analytic views.
Create Temporal Joins [page 65]
You create a temporal join using the temporal column that specifies the time interval with the start and the
end date. The result set is fetched based on the time interval mapped using the temporal column.
6.2.1 Create Analytic Views
Procedure
1. Define Output Structure
a) Add the tables that you want to use in any of the following ways:
56
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
Drag the required tables present in the Catalog to the Data Foundation node.
Select the Data Foundation node in the Scenario panel, and in the context menu of the Details
panel, choose Add ... and search for the required object.
Note
You can add the same table in the Data Foundation by using table aliases in the editor; for
example, consider a table containing supplier and buyer information with postal code, and
another table containing the link from postal code to region and country. Now, you want to
join this geography table two time to the buyer and the supplier.
If your analytic view has more than one table, you need to specify which table is the central
table (fact table) from which the measures will be derived. You can specify the central table
by selecting a value in the Central Entity property of the Data Foundation node.
Restriction
You cannot add column views to the Data Foundation of an analytic view. However, you can add
column views to a calculation view.
b) To query data from more than one table, go to the Details panel context menu, choose Create Join,
and enter the required details.In the New Joinwindow, choose a left and a right table. To create a join,
choose appropriate columns from each table and set relevant properties. At a time, you can create
only a single join.
You can also join two tables by dragging and dropping the join from the column of one table to a
column in another table . After creating the join, you can edit its properties, such as join type and
cardinality, in the Properties view. You can choose to create Text Join between table fields in order to
get language-specific data
You have a product table that contains product IDs without descriptions and you have a text table for
products that contains language-specific descriptions for each product. You can create a text join
between the two tables to get the language-specific details. In a text join, the right table should be the
text table and it is mandatory to specify the Language Column.
Tip
You can set the cardinality of the join as required. By default, the cardinality of the join is empty.
The empty cardinality can be specified if you are not sure about the right cardinality. If you specify
the empty cardinality, the system will determine the the cardinality during the join evaluation
phase.
Caution
Selecting the incorrect cardinality can lead to erroneous data and memory issues.
c) Perform one of the following steps to add the table columns to the output structure (Semantics node)
that you want to use to define the facts.
Select the toggle button on the left of the table field.
Right-click the table field, and choose Add to Output.
d. To specify a filter condition based on which system must display data for a table field in the output,:
Only display revenue for companies that fulfill the filter conditions you have specified.
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 57


1. Right-click the table field, and choose Apply Filter.
2. Select the required operator, and enter the filter values.You can use the following operators for
filtering.
Filter Operator Description
Equal To filter and show data corresponding to the fil
ter value
Not Equal To filter and show data other than the filter
value
Between To filter and show data for a particular range
specified in the From Value and To Value
List of Values To filter and show data for a specific list of val
ues separated by comma
Not in list To filter data and show data for the values
other than the ones specified. You can provide
a list of values to be excluded using comma.
Is NULL To filter and show row data having NULL values
Is not NULL To filter and show data of all the rows that have
non NULL values
Less than To filter and show data with values less than
the one specified as filter value
Less than or Equal to To filter and show data with values less than or
equal to the one specified as filter value
Greater than To filter and show data with values greater than
the one specified as filter value
Greater than or Equal to To filter and show data with values greater than
or equal to the one specified as filter value
Contains Pattern To filter and show data that matches the pat
tern specified in the filter value. You can use '?'
question mark to substitute a single character,
and '*' asterisk to substitute many. For exam
ple, to filter data for continents that start with
letter A, use Contains Pattern filter with value
A*. This would show the data for all the conti
nents that start with A like Asia and Africa.
Note
You can either specify a fixed value for the filter, or use an input parameter of the current
analytic view to provide the filter value at runtime during data preview. You can specify the filter
value as fixed or dynamic in the Value Help dialog by specifying the Type as Fixed or Input
Parameter.
58
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
The table fields selected above form the fact table.
e) To create a star schema, that is linking the fact table with the descriptive data (attribute views:
1. Perform one of following steps to add the required attribute views in the Logical Join node:
Drag the required attribute views present in the Content node to the Logical Join node.
Select the Logical Join node in the Scenario panel, and choose Add to add the attribute views.
2. Create joins between the views and the fact table.
Note
In the Logical Join, you can create a temporal join between the date field of the fact table to an
interval (to and from) field of the attribute view. The temporal join has to start from the fact
table such that the single column must be in the fact table and the to and from columns must
be in the table that is directly joined to the fact table. The temporal join retrieves a single record
from the table that is joined to the fact table if a record exists in the source table for the defined
interval. For each interval only one valid record is allowed and processed. The join type must be
a referential join. The supported data types are timestamp, date, and integer.
Restriction
While creating joins, you must ensure that a table does not appear twice in any join path, that is r a self
join is not supported. A join path is the set of joins that links the fact table to other tables.
While creating joins between analytic view and attribute view:
The same table cannot be used in the join path of analytic view and attribute view
The table of the attribute view which is linked to the fact table should not have an alias table
2. Optional Step: Create Calculated Column
a) In the Output of Logical Join panel, right-click on Calculated Columns and in the context menu, choose
New.
b) Enter a name and description (label) for the calculated column.Select a data type, and enter the length
and scale for the calculated column.
c) Select the Column Type to determine whether it is a calculated attribute or a calculated measure.
d) If you select Calculate Before Aggregation, select the aggregation type.
Note
If you select Calculate Before Aggregation, the calculation happens as per the expression specified
and then the results are aggregated as SUM, MIN, MAX or COUNT. If Calculate Before Aggregation
is not selected, the data is not aggregated but it gets calculated as per calculation expression
(formula), and the aggregation is shown as FORMULA. If the aggregation is not set,
then it will be considered as an attribute. You should selecting Calculate Before Aggregation only
when required as it may decrease the performance.
e) In the Expression Editor enter the expression.
if("PRODUCT" = 'ABC, "DISCOUNT" * 0.10, "DISCOUNT") which is equivalent to, if attribute PRODUCT
equals the string ABC then DISCOUNT equals to DISCOUNT multiplied by 0.10 should be returned.
Otherwise the original value of attribute DISCOUNT should be used.
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 59


Note
The expression can also be assembled by dragging and dropping the expression elements from the
menus below the editor window.
f) To associate the calculated column with the currency and unit of measuring quantity, select the
Advanced view and select the required Type. Choose OK.
Remember
Calculated Columns can be created only at the Logical Join level and not at the Data Foundation level.
Tip
You can also create a calculated column based on the existing one by copying it and making the
required changes. The copy paste option is available from the context menu of the calculated column.
You can also use the CTRL + C and CTRL + V keyboard shortcuts. The copy paste functionality works
only in the same editor, that is, if you copy a calculated column in one view editor you cannot paste it in
another view editor. Also, if you copy a calculated column in one editor and go to another view editor
and again copy another object, the paste option in the previous editor is not available. The copy paste
functionality for calculated columns only works in the Output panel.
3. Optional step: Create counters to obtain the number of distinct values of an attribute
a) Choose the Logical Join node.
b) In the Output panel, choose Calculated Columns.
c) In the context menu of the Calculated Columns, choose New Counter.
d) In the Counter window, enter a counter name and a description.
e) To hide the counter during data preview, select the Hidden checkbox.
f) To add attributes in the Counters panel, choose Add.
g) Choose OK.
4. Optional Step: Create Restricted Columns
You can create restricted columns if you want to filter the value for an output field based on the user
defined rules. For example, you can choose to restrict the value for the Revenue column only for Region =
APJ, and Year = 2012.
a) In the Output panel of the Logical Join, right-click Restricted Columns, and choose New.
b) Enter a name and description for the restricted column.
c) From the Column dropdown list, select the column for which you want to apply a restriction.
Caution
The column for which you apply a restriction must be defined as measure in the semantics node
otherwise the validation will fail.
d) Choose Add Restriction.
e) In the Parameter field, select the column that you want to create a restriction for, then select the
operator and value.
f) Choose OK.
60
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
Note
For a restricted column the aggregation type of the base column is applied.
Tip
You can also create a restricted column based on the existing one by copying it and making the
required changes. The copy paste option is available from the context menu of the calculated column.
You can also use the CTRL + C and CTRL + V keyboard shortcuts. The copy paste functionality works
only in the same editor, that is, if you copy a restricted column in one view editor you cannot paste it in
another view editor. Also, if you copy a restricted column in one editor and go to another view editor and
again copy another object, the paste option in the previous editor is not available. The copy paste
functionality for restricted columns only works in the Output panel
5. Define Attributes and Measures
a) Select the Semantics node.
b) In the Column panel, select the Local tab page, and change the type as attributes and measures.
Note
The Shared tab page shows the attributes of the used attribute views. While generating the column
views, the joined local attribute name is ignored and the shared attribute name is considered,
therefore the joined local attribute is not shown on the Semantics node.
Note
You can change the type of a measure and perform currency conversion by selecting it in the Local
tab page and changing the Measure Type property in the properties panel.
6. Optional Step: Assign Semantics to Attributes, Measures, and Calculated Columns
a) To indicate what an attribute or a calculated attribute of an analytic view represent, in the Columns
panel toolbar of the Semantics node, choose Assign Semantics.
b) In the Semantics dialog, select the required Semantics Type.
1. If you select Amount with Currency Code as Semantic Type, select an attribute or calculated
column that represents the currency code in the Currency dropdown.
Note
Attributes and calculated columns having semantic type as Currency Code are highlighted for
Currency selection.
2. If you select Quantity with Unit of Measure as Semantic Type, select an attribute or calculated
column that represents the currency code in the Unit dropdown.
Note
Attributes and calculated columns having semantic type as Unit of Measure are highlighted for
Unit selection.
3. Choose OK.
The supported semantic types for attributes and calculated attributes are:
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 61


Amount with Currency Code
Quantity with Unit of Measure
Currency Code
Unit of Measure
Date
Date - Business Date From
Date - Business Date To
Geo Location - Longitude
Geo Location - Latitude
Geo Location - Carto Id
Geo Location - Normalized Name
a) To indicate what a measure or a calculated measure of an analytic view represent, in the Columns
panel toolbar of the Semantics node, choose Assign Semantics.
1. If you select Amount with Currency Code as Semantic Type, in the Currency field, select a currency
code.
Note
You can choose the currency from the system table TCURC or from an attribute of the view
based on the currency type as Fixed or Column respectively.
2. If you select Quantity with Unit of Measure as Semantic Type, select a unit of measure in the Unit
field.
Note
You can choose the currency from the system table T006 and T006A or from an attribute of
the view based on the unit type as Fixed or Column respectively.
3. Choose OK.
7. Optional Step: You can filter and view the table data in the modeled view for a specific client as specified in
the table fields, such as MANDT or CLIENT, by doing the following:
1. Select the Semantics node, in the Properties panel, edit the Default Client property.
Note
The default value for the property is the one that is specified as a preference. If the property is set to
Dynamic, at run time the value set for the Session Client property is considered to filter table data. The
Session Client property is set while creating a user. At run time, if the property is set to Cross Client, the
table data is not filtered for any of the client systems.
8. Optional Step: Assign Variable
You assign variables to an attribute of the view at design time to filter data based on the values you provide
for the variable. The variable values are interpreted as WHERE clause of the SQL statement by the clients/
consumers like Data Preview, MDX, Advanced Analysis for Office or BO Explorer. At runtime, you can
provide different values to the variable to view the corresponding set of attribute data.
9. If you want to parameterize currency conversion, calculated columns and Data Foundation filters, create
input parameters.
10. Activate the view using one of the following options:
62
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
If you are in the SAP HANA Modeler perspective, do the following as required:
Save and Activate - to activate the current view and redeploy the affected objects if an active
version of the affected object exists. Otherwise only current view gets activated.
Save and Activate All - to activate the current view along with the required and affected objects.
Note
You can also activate the current view by selecting the view in the SAP HANA Systems view and
choosing Activate in the context menu. The activation triggers validation check for both the client
side and the server side rules. If the object does not meet any validation check, the object activation
fails.
If you are in the SAP HANA Development perspective, do the following:
1. In the Project Explorer view, select the required object.
2. In the context menu, select Team Activate .
Note
The activation triggers the validation check only for the server side rules. Hence, if there are
any errors on the client side, they are skipped and the object activation goes through if no error
found at the server side.
Note
If an active version of the affected objects exist, activating the current view redeploys the affected
objects. In the SAP HANA Modeler perspective, even if the affected object redeployment fails, the
current view activation might go through. However, in the SAP HANA Development perspective, if any
of the affected objects redeployment fails, the current view activation also fails.
Note
Restriction
Close and reopen the analytic view editor to see any changes that you make to its attribute view in a
different editor (while your analytic view editor is still open). For example, consider that you have the
following two information views open in two different editors:
An attribute view open in Editor 1
And an analytic view that uses the above attribute view open in Editor 2.
If you make any changes to the objects in an attribute view that is open in Editor 1 (say you include
and remove a table), the system reflects these changes in the analytic view only after you close and
reopen the Editor 2. This is because, when you open any information view in an editor, the system
loads the objects to the cache, and now although you delete (or any other changes) the object, the
system does not delete it from the cache until you close and reopen the editor. For more information,
see SAP Note 1783668 .
11. In the Change Tracking dialog, either create a new ID or select the existing change ID. For more
information about Change Tracking, see the section SAP HANA Change Management in the chapter
Implementing Lifecycle Management of the SAP HANA Developer Guide.
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 63


12. Choose Finish .
Related Information
Using Currency and Unit of Measure [page 112]
Input Parameters [page 107]
You use input parameters to define internal parameterization of the view. Input parameters used in the
views enables you to obtain a desired functionality when the view is executed.
Create Temporal Joins [page 65]
You create a temporal join using the temporal column that specifies the time interval with the start and the
end date. The result set is fetched based on the time interval mapped using the temporal column.
Description Mapping [page 130]
Description mapping helps you to associate an attribute with another attribute, which describes it in detail.
For example, when reporting via a Label Column, you can associate Region_ID with Region_Text.
Group Related Measures [page 130]
If your analytic view and calculation view has multiple measures and you want to organize them, for,
example, segregate the planned measures with the actual measures, you can group the related measures in
folders. These folders are called the display folders.
SAP HANA Developer Guide
6.2.1.1 Map Parameters or Variables of External Views for
Value Help
You can map the parameters or variables of external views for value help (external views as value help
references in variables and input parameters) to the parameters or variables of analytic views.
Procedure
1. To invoke the dialog from the default aggregation or projection node:
a) Select the default aggregation or projection node.
b) Right click Input Parameter in the Output view.
c) In the context menu, choose Manage Mappings.
2. To invoke the dialog from the Semantics node:
a) Select the Semantics node.
b) In the Variables/Input Parameters view, choose .
c) Choose Views for value help
3. In the Map Input Parameters dialog, map the parameters of external views for value help with the
parameters of the analytic view.
64
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
Note
You can choose the Auto Map by Name option to automatically create the input parameters
corresponding to the source, and perform a 1:1 mapping. You can also select a source input parameter
and use the following context menu options:
Copy and Map 1:1 - to create the same input parameter for the analytic view as for the source, and
create a 1:1 mapping between them.
Map By Name - to map the source input parameter with the analytic view input parameter having
the same name.
Remove Mapping - to delete the mapping between the source and analytic view input parameter.
4. Select Create Constant to create a constant at the target analytic view.
Note
You can change the constant name by double clicking it.
6.2.2 Create Temporal Joins
You create a temporal join using the temporal column that specifies the time interval with the start and the end
date. The result set is fetched based on the time interval mapped using the temporal column.
Context
Procedure
1. In the New Join window, create a referential or an inner join between the attribute of the fact table and the
attribute view.
2. In the Properties panel or from the New Join window, select:
a) The Temporal Column that indicates the single time column in the fact table.
b) The From Column and the To Column to specify the time interval from the attribute view.
c) The Temporal Condition that the system should consider while executing the join.
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 65


6.2.2.1 Temporal Joins
A temporal join indicates the time interval mapping between the master data and the transaction data for
which you want to fetch the records.
A record is only included in the results set if the time interval lies within the valid time interval. A time interval is
assigned to each record in the results set. The records are valid for the duration of the interval to which they
are assigned.
You use temporal conditions to indicate whether to include or exclude the value of the FROM and TO date
fields while executing the join condition.
In the logical join, you can create a temporal join between the date field of the fact table to an interval (to and
from) field of the attribute view. The temporal join must start from the fact table such that the single column
must be in the fact table and, the to and from columns must be in the table that is directly joined to the fact
table. The join type must be Referential. The supported data types are: timestamp, date, and integer.
Example
Consider an attribute view Product that contains master data about Products with attributes like,
ProductID, Validity_Date_From, Validity_Date_To, and so on.
Similarly, consider an analytic view Sales that contains transactional data corresponding to the products
sales with attributes, ProductID, Date, Revenue.
Now, to analyze sales data for products you can create a join between the two views using ProductID.
But to fetch data for a particular time period you need to assign temporal properties to the join. The
temporal column in our example would be Date field in the Analytic view, and the From date and To date
would come from the Validity_Date_From, and Validity_Date_To of the attribute view.
6.2.2.2 Temporal Conditions
SAP HANA Modeling environment supports the following temporal conditions while you create temporal joins.
Table 4: Temporal Conditions
Temporal Condition Meaning
Include To Exclude From This temporal condition includes the value from the
To field and excludes the value of From field while ex
ecuting the join.
Exclude To Include From This temporal condition excludes the value from the
To field and includes the value of From field while exe
cuting the join.
Exclude Both This temporal condition excludes the value from both
the To field and From field while executing the join.
Include Both This temporal condition includes the value from both
the To field and From field while executing the join.
66
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
6.3 Using Calculation Views
Create calculation views to provides composites of other views. You can classify calculation views as script-
based calculation view or graphical galculation view
Essentially, calculation views are based on the following:
A join or union of two or more data flows
An invoke of built-in or generic SQL function
Depending on how calculation views are created, they are defined as either graphical views or scripted views
using SQLScript. They can be used in the same way as analytic views; however, in contrast to analytic views, it
is possible to join several fact tables in a calculation view.
Graphical views can be modeled using the graphical modeling features of the SAP HANA Modeler. Scripted
views are created as sequences of SQLScript statements.
You can use calculation views like analytic views to derive values and key performance indicators(KPIs).
Note
The terms attribute and columns are used interchangeably the procedures. They may denote a table
column, a particular data field of a table row, or the contents of such a data field. The respective meaning
should be clear from the context.
Related Information
Create a Script-Based Calculation View [page 67]
You can create a script-based calculation view to depict a complex calculation scenario using a sequence of
SQL Script statements.
Create a Graphical Calculation View [page 70]
You can create a calculation view to depict a complex business scenario that has layers of calculation logic
and include measures sourced from multiple source tables using the graphical modeling features of the SAP
HANA Modeler.
6.3.1 Create a Script-Based Calculation View
You can create a script-based calculation view to depict a complex calculation scenario using a sequence of
SQL Script statements.
Context
You can further fine tune the behavior of the calculation view by:
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 67


Creating variables, and bind them to attributes for filtering data. The values you provide for the variables
at runtime determine which data records are selected for consumption.
Creating input parameters and use them in the SQLScript.
Creating hierarchies to arrange view attributes that helps you to visualize and analyze the data in a
hierarchical fashion.
Grouping the related measures in display folders.
For a calculation view you can set the Data Category property to Cube or Dimension as follows:
Set to Cube - if you want to define a calculation view that is visible in the multidimensional reporting tools.
Set to Dimension - if you want to define a simple SQL like calculation view, which, for example, is used to fill
simple list user interfaces where recurring attribute values are not a problem, but are desired. The view is
not available for multidimensional reporting and is only consumable via SQL.
Procedure
1. In the Details panel of the Semantics node, select the required schema from the Default Schema property,
for unqualified access in SQL Script.
Note
If you do not select a default schema while scripting, you need to provide fully qualified names of the
objects used.
2. Choose SQL Script node in the Semantics node.
3. To define the output structure, choose Create Target from the Output panel and add the output
parameters with the required data type and length.
Note
The order and data types of the output parameters should match the order and data types of the table
columns, which is used in the select query.
4. Write the script using SQL Script commands to fill the output structure.
Note
For information on providing input parameters in script-based calculation views, see SAP Note 2035113
5. Activate the view using one of the following options:
If you are in the SAP HANA Modeler perspective, choose one of the following:
Save and Activate - to activate the current view and redeploy the affected objects if an active
version of the affected object exists. Otherwise, only the current view is activated.
Save and Activate All - to activate the current view along with the required and affected objects.
Note
You can also activate the current view by selecting the view in the SAP HANA Systems view and
choosing Activate in the context menu. The activation triggers validation check for both the client
68
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
side and the server side rules. If the object does not meet any validation check, the object activation
fails.
If you are in the SAP HANA Development perspective, choose one of the following:
1. In the Project Explorer view, select the required object.
2. In the context menu, select Team Activate .
Note
The activation only triggers the validation check for the server side rules. If there are any errors
on the client side, they are skipped, and the object activation goes through if no error is found
on the server side.
You can find the details of the functions available on content assist that is, by pressing Ctrl + Space in
the SQL Console while writing procedures in the SAP HANA SQLScript Reference
6. In the Change Tracking dialog, either create a new ID or select the existing change ID. For more
information about Change Tracking, see the section SAP HANA Change Management in the chapter
Implementing Lifecycle Management of the SAP HANA Developer Guide.
7. Choose Finish.
Related Information
Input Parameters [page 107]
You use input parameters to define internal parameterization of the view. Input parameters used in the
views enables you to obtain a desired functionality when the view is executed.
Group Related Measures [page 130]
If your analytic view and calculation view has multiple measures and you want to organize them, for,
example, segregate the planned measures with the actual measures, you can group the related measures in
folders. These folders are called the display folders.
Description Mapping [page 130]
Description mapping helps you to associate an attribute with another attribute, which describes it in detail.
For example, when reporting via a Label Column, you can associate Region_ID with Region_Text.
Create Level Hierarchies [page 101]
You create hierarchies to arrange view attributes that enhances data analysis by displaying attributes
according to their defined hierarchical relationships.A level hierarchy is rigid in nature, and the root and the
child nodes can only be accessed in a defined order.
Create Parent-Child Hierarchies [page 103]
A parent-child hierarchy is defined using a parent attribute that determines the relationship among the view
attributes. A parent attribute describes a self-referencing relationship, or self-join, within the main table.
Assign Variables [page 110]
You can assign variables to a filter at design time for obtaining data based on the values you provide for the
variable. At runtime, you can provide different values to the variable to view the corresponding set of
attribute data.
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 69


6.3.2 Create a Graphical Calculation View
You can create a calculation view to depict a complex business scenario that has layers of calculation logic and
include measures sourced from multiple source tables using the graphical modeling features of the SAP HANA
Modeler.
Context
You can set the calculation view property Data Category to Cube or Dimension based on the following
requirement:
Cube - if you want to define a calculation view that is visible in the reporting tools. You must define at least
one measure and the default node is Aggregation or Star Join (based on your selection in the creation
wizard).
The Star Join node provides the platform to join the descriptive data that is, dimensions from the
calculation views of type dimension with the fact data from the lower nodes. This way you are logically
creating a star schema where, the join is created from the central entity to the other entities. You can
however, create a snowflake schema by joining views to the central entity.
In a Star Join having calculation views with data category as dimension are treated as shared dimensions.
All the attributes and hierarchies of these shared dimensions are added to the output of the calculation
view.
During deployment, the Star Join is always deployed with an aggregation node on top of it. The Star Join is
deployed first with a series of joins and then the aggregation logic is deployed.
Dimension - if you want to define a simple SQL like calculation view, which, for example, is used to fill
simple list user interfaces where recurring attribute values are not a problem, but are desired. To define
this type of view, you do not define any measure. If you to define a view like this, its behavior is as follows:
The output node does not offer any measures (or hierarchies), only attributes, which can be numerical
data types
The calculation view is not available for reporting
The calculation view is only consumable via SQL
The default node is Projection
For the Aggregation node, at runtime, the measures are automatically aggregated on the level defined by the
group, by clause. In this case, the output node is deployed as an aggregation node into the run time model that
is created during deployment. Moreover, the model information is written into the BI metadata consumption
tables that is, made available to the BI clients of SAP HANA for reporting.
Note
If the default node is Aggregation and the Always Aggregate Result property of the Semantics node is set to
True then the output of measures always appears aggregated.
You can switch the execution of the calculation view to the SQL Engine rather that the Column Engine for
better performance by selecting the SQL Engine value in the Execute In property. When this property is set to
SQL Engine, the calculation engine generates SQL code for each node at runtime and combines them into one
big SQL statement which is then passed to the SQL interface. This might be beneficial since the SQL interface
also involves standard SQL optimizer which implements a lot more optimization rules than the Calculation
Engine. For example, the most important rule is join ordering determination.
70
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
This option is only efficient if every node is translated so that one big SQL statement can be generated. To gain
optimal SQL generation, the following rules should be followed:
The calculation view should only contain tables and a calculation view as data source. If a calculation view
is added, the mentioned rules must be followed for it as well. Explicitly do not add any Analytic View,
Attribute View, or Scripted Calculation View. This might break any optimization.
Only use supported operations: projection, union, join, and aggregation.
Do not use special column store functions in filter or calculated attribute expressions because they might
not be convertible. For example, the functions date() and time() only work on the column store data types
and cannot be converted.
The NULL handling is different in the calculation and the SQL engine. In the calculation engine, the
expression 2 + null results in 2, whereas in SQL engine it results in null. So if you switch on the SQL engine
execution you might get different results than before. It is recommended to use the function sqladd
instead. This behaves as the + in SQL.
If a currency conversion or counter measure needs to be defined, it has to be defined at the output node of
the main scenario. If a currency conversion or counter measure is modeled into an included scenario, SQL
optimization would exclude that part because these measures can be handled more efficiently in the
Calculation Engine.
You can further fine tune the behavior of the calculation view by:
Creating variables, and bind them to attributes for filtering data. The values you provide for the variables
at runtime determine which data records are selected for consumption.
Creating input parameters to parameterize the view execution.
Creating hierarchies to arrange view attributes that helps you to visualize and analyze the data in a
hierarchical fashion.
Grouping the related measures in display folders.
Hiding attributes and measures that are not required for client consumption by assigning value true to
the property Hidden in the Properties pane. The attributes or measures marked as hidden are not available
for joins, input parameters, variables, consumers, and other views that are build on the top of this view.
For existing models (before SPS06), if the hidden attribute is already used, you can either unhide the
element or remove the references.
Setting the cardinality of a join as required from the join properties. By default, the cardinality of a join is
empty. The empty cardinality can be specified in cases when you are not sure about the right cardinality. If
you specify the empty cardinality, system during the join evaluation phase diagnose the best suited
cardinality and execute the join. Wrong selection of cardinality can lead to erroneous data and out of
memory issues.
Procedure
1. Choose one of the following options from the Tools Palette:
View Node Description
Union Used to combine the result set of two or more data
sources. For example, to show the names of all the
employees of a store which has different branches each
maintaining its own employee records table.
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 71


View Node Description
Join Used to query data from two or more data sources,
based on a specified condition. For example, to retrieve
the customers details with location based on the postal
code present in two tables Customer and Geography
where, Customer table has columns - Customer ID,
Customer Name,Postal Code, and Geography having
columns - Postal Code, Region, Country.
Projection Used to filter or create a subset of the required columns
of a table or view for creating the model. For example,
selecting the employee name and sales quantity from a
table consisting of many more columns.
Aggregation Used to summarize data of a group of rows by
calculating values in a column. For example, to retrieve
total sales of a product in a month. The supported
aggregation types are sum, min, and max.
Note
The input for union, join, projection, and aggregation view nodes can consist of data sources, union,
join, projection, or aggregation view nodes.
You can only have one source of input for aggregation and projection view nodes, and two inputs for
a join.
You can add the view nodes even between the two joined view nodes. If you drop a view node from
the Tools Palette to a data source (that is, tables, attribute views, analytic views, and calculation
views) of a view node, the data source is replaced by the newly added view node such that, the new
view node has the data source as its input. For example, if you drop a Projection view node on the
DS1 data source of the existing Aggregation view node, the Aggregation view node would now have
Projection view node as its data source and DS1 would be the data source of the Projection node.
For join nodes (including star join node), in the property panel, the property Optimize Join Columns
is set to False by default. This property forces a query to retrieve the join columns from the
database although it is not requested in the query. In other words, you are including those columns
in the join, into the group by clause, even if you do not select them in the query.
You can set the join property Optimize Join Columns to True to optimize the join execution (for
example, if your join node includes many join attributes). By setting the property to True, you can
avoid retrieving the join columns that are not specified in the query. However, the join optimizer
cannot remove the attributes, which are used by static filters if these filters are defined on join
columns that have the property Optimize Join Column set to True. In such cases, you can optimize
the join column by introducing a dummy projection between the join and the initial input node (with
filter).
Optimizing join columns is supported only for Left outer join or text join (with cardinality 1:1 or N:1)
and Right outer join (with cardinality 1:1 or 1:N)
2. To add the data sources to a view node like, join, select next to the join node, or drag and drop the data
source from the SAP HANA systems view to the join node.
To query data from more than one table, go to the Details panel context menu, choose Create Join, and
enter the required details. In the New Join window, choose a left and a right table. To create a join, choose
appropriate columns from each table and set relevant properties. At a time, you can create only a single
join.
72
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
3. To define the output columns of a view node, select the node in the Scenario panel, and perform the
following substeps in the Details view:
a) If you have selected a union view node, drag and drop the required columns from Source to Target.
You can also modify the attribute mapping. For more information, see Manage Column Mappings
[page 80]
Tip
To create a system generated mapping, choose Auto Map By Name.
The output of a union view node is the attributes that you added to the Target.
b) If you have selected a join view node, join the columns of the data sources.
The output of a join view node is the joined attributes. However, to add additional attributes to the
view's output, from the context menu, choose Add to Output.
c) If you have selected a projection or an aggregation view node, select the required data source
columns, and in the context menu, choose Add to Output.
You can also create Calculated Columns, and Input Parameters for all the view nodes. In addition, you can
also apply filter logic to the non- default aggregation and projection view nodes.
The output of the union, join, aggregation and projection view nodes is stored under the Column node in
the Output panel.
Note
You can choose to rename the columns and calculated columns of the view using the Rename button in
the Output panel toolbar. However, renaming a field can impact other objects that reuse the field as the
new name is not reflected in the other objects.
The Calculation view allows you to rename a node attribute and propagate the new name to all higher
nodes in a hierarchy of nodes. For propagating a name, choose Propagate Rename to Above Nodes in
the Rename window.
4. If you want to directly add the columns of a view node to the Semantics node including the other view
nodes that are in the joined path, perform the following:
a) In case of a Join, Aggregation, or Projection View node, right-click the column in the Details panel.
You can also select the columns in the Output panel of the view node.
b) In the context menu, choose Propagate to Semantics.
c) In case of a Union view node, right-click the column in the Output panel.
d) In the context menu, choose Propagate to Semantics.
The selected columns are propagated to all the view nodes including Semantics. Only those columns
which already do not exist in any of the propagation path nodes are only added. If all the columns exist in
the propagation nodes, addition will not go through.
5. If you have added the Star Joinnode in the scenario panel, perform the following:
a) Add the required Calculation View with data category as dimension in the Star Join node:
Drag the required attribute views present in the Content node to the Logical Join node.
Select the Star Join node in the Scenario panel, and choose Add to add the calculation views.
b) Create joins between the views and the fact table (formed by the lower nodes).
6. To add attributes and measures to the calculation view output, perform the following substeps:
a) In the Scenario panel, choose the Semantics node.
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 73


b) In the Column panel of the Local tab page, select the columns and change the type as Attribute and
Measure.
Note
If the Data Category property of the calculation view is set to Cube, it is mandatory to specify at
least one column as measure; otherwise, the view activation fails. Also, if the value is set to
Cube, an additional column called Aggregation is available to specify the aggregation type for
measures.
You can change the type of a measure and perform a currency conversion by selecting it in the
Local tab page and changing the Semantic Type property in the properties panel.
You can choose to rename the attributes, calculated attributes, measures, and calculated
measures of the view using the Rename button in the Output panel toolbar. However, renaming
a field can impact other objects that reuse the field as the new name is not reflected in the
other objects.
7. Optional Step: Assign Semantics to the attributes, measures and calculated column
a) To add meaning to the attributes and calculated attributes data perform the following:
1. In the Columns panel toolbar of the Semantics node, choose Assign Semantics.
2. In the Semantics dialog, select the required Semantics Type.
3. If you select Amount with Currency Code as Semantic Type, select an attribute or calculated
column that represents the currency code in the Currency dropdown.
Note
Attributes and calculated columns having semantic type as Currency Code are highlighted for
Currency selection.
4. If you select Quantity with Unit of Measure as Semantic Type, select an attribute or calculated
column that represents the currency code in the Unit dropdown.
Note
Attributes and calculated columns having semantic type as Unit of Measure are highlighted for
Unit selection.
The supported semantic types for attributes and calculated attributes are:
Amount with Currency Code
Quantity with Unit of Measure
Currency Code
Unit of Measure
Date
Date - Business Date From
Date - Business Date To
Geo Location - Longitude
Geo Location - Latitude
Geo Location - Carto Id
Geo Location - Normalized Name
b) To add meaning to the measures and calculated measures data perform the following:
74
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
1. In the Columns panel toolbar of the Semantics node, choose Assign Semantics.
2. In the Semantic Type dialog, choose the required Semantic Type.
3. If you select Amount with Currency Code as Semantic Type, in the Currency field, select a currency
code.
Note
You can choose the currency from the system table TCURC or from an attribute of the view
based on the currency type as Fixed or Column respectively.
4. If you select Quantity with Unit of Measure as Semantic Type, select a unit of measure in the Unit
field.
Note
You can choose the currency from the system table T006 and T006A or from an attribute of
the view based on the unit type as Fixed or Column respectively.
5. Choose OK.
8. Optional Step: Create counters to obtain the number of distinct values of an attribute
a) Select the default aggregation node.
b) In the Output pane, right-click Calculated Columns.
c) From the context menu, choose New Counter. Enter a name and description (label).
d) To hide the counter during data preview, select the Hidden checkbox.
e) To add attributes in the Counters panel, choose Add and choose OK.
Remember
You can only create counters on the default aggregation node.
9. Activate the view.
If you are in the SAP HANA Modeler perspective, choose one of the following:
Save and Activate - to activate the current view and redeploy the affected objects if an active
version of the affected object exists. Otherwise, only the current view is activated.
Save and Activate All - to activate the current view along with the required and affected objects.
Note
You can also activate the current view by selecting the view in the SAP HANA Systems view and
choosing Activate in the context menu. The activation triggers validation check for both the client
side and the server side rules. If the object does not meet any validation check, the object activation
fails.
If you are in the SAP HANA Development perspective, choose one of the following:
1. In the Project Explorer view, select the required object.
2. In the context menu, select Team Activate .
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 75


Note
The activation only triggers the validation check for the server side rules. If there are any errors
on the client side, they are skipped, and the object activation goes through if no error is found
on the server side.
Note
1. For an active calculation view, you can preview the data of an intermediate node in a calculation
view, which helps to debug each level of a complex calculation scenario having join, union,
aggregation, projection, and output nodes. When you preview the data of an intermediate now, SAP
HANA studio activates the intermediate calculation model with the current user instead of the user
_SYS_REPO. The data you preview for a node is for the active version of the calculation view. If no
active version for the object exists then you need to activate the object first. You can choose the
Data Preview option from the context menu of a node.
2. You can find the details of the functions available on content assist that is, by pressing Ctrl + Space
in the SQL Console while writing procedures in the SAP HANA SQLScript Reference.
10. In the Change Tracking dialog, either create a new ID or select the existing change ID. For more
information about Change Tracking, see the section SAP HANA Change Management in the chapter
Implementing Lifecycle Management of the SAP HANA Developer Guide
11. Choose Finish.
Related Information
Assign Variables [page 110]
You can assign variables to a filter at design time for obtaining data based on the values you provide for the
variable. At runtime, you can provide different values to the variable to view the corresponding set of
attribute data.
Input Parameters [page 107]
You use input parameters to define internal parameterization of the view. Input parameters used in the
views enables you to obtain a desired functionality when the view is executed.
Group Related Measures [page 130]
If your analytic view and calculation view has multiple measures and you want to organize them, for,
example, segregate the planned measures with the actual measures, you can group the related measures in
folders. These folders are called the display folders.
Description Mapping [page 130]
Description mapping helps you to associate an attribute with another attribute, which describes it in detail.
For example, when reporting via a Label Column, you can associate Region_ID with Region_Text.
Create Level Hierarchies [page 101]
You create hierarchies to arrange view attributes that enhances data analysis by displaying attributes
according to their defined hierarchical relationships.A level hierarchy is rigid in nature, and the root and the
child nodes can only be accessed in a defined order.
Create Parent-Child Hierarchies [page 103]
A parent-child hierarchy is defined using a parent attribute that determines the relationship among the view
attributes. A parent attribute describes a self-referencing relationship, or self-join, within the main table.
76
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
Apply Filter on Aggregation and Projection Node [page 80]
Create Calculated Columns [page 78]
You can create calculated columns to perform some calculation based on the existing view columns.
Map Input Parameters [page 78]
You can map the input parameters in the underlying data sources (attribute views, analytic views and
calculation views) of the calculation view to the calculation view parameters. You can also map many data
source parameters to one calculation view input parameter and perform a one-to-one mapping of the data
source parameters to the calculation view parameters.
SAP HANA Developer Guide
6.3.2.1 Create Star Joins in Calculation View
To create a Star schema, you have to create a Star join. You will need a Star schema to link the fact table with
descriptive data.
Procedure
1. In the SAP HANA Systems view, choose the required package.
2. In the package context menu, choose New Calculation View .
3. In the New Information View window, enter the following details:
Name
Description
Data Category: The default option is Cube. Verify if the Data Category is Cube. You can create a Star join
only for the Cube data category.
With Star Join: Select this checkbox.
4. Choose Finish.
5. In the Scenario panel of the editor, the Semantics and the Star Join node appears.
6. Drag descriptive data (calculation views with Data Category type as Dimensionor blank and without a Star
Join) from packages available in the SAP HANA Systems view to the Star Join node.
Note
The behavior is similar to the logical join of Analytic view.
7. In the Scenario panel, add a new node.
8. Continue modeling as in the creating a graphical calculation view procedure with a cube structure (having
attributes and measures).
9. Activate the Star join.
If the descriptive data has hierarchies then those hierarchies will be available in Star join. You can create
joins only between the central entity and any other calculation views added to the Star join.
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 77


6.3.2.2 Create Calculated Columns
You can create calculated columns to perform some calculation based on the existing view columns.
Procedure
1. Right-click Calculated Columns node and choose New.
2. Enter a name and description (label). Select a data type, and enter length and scale for the calculated
column.
3. Select the Column Type to determine whether it is a calculated attribute or a calculated measure.
4. In the Expression Editor enter the expression.
You can write a formula:
if("PRODUCT" = 'ABC, "DISCOUNT" * 0.10, "DISCOUNT") which is equivalent to, if attribute PRODUCT
equals the string ABC then DISCOUNT equals to DISCOUNT multiplied by 0.10 should be returned.
Otherwise the original value of attribute DISCOUNT should be used.
Note
The expression can also be assembled by dragging and dropping the expression elements from the
menus below the editor window.
5. Go to the Advanced tab page and select the required Type if you want to associate the calculated measure
with currency and unit of measuring quantity.
6. Choose OK.
6.3.2.3 Map Input Parameters
You can map the input parameters in the underlying data sources (attribute views, analytic views and
calculation views) of the calculation view to the calculation view parameters. You can also map many data
source parameters to one calculation view input parameter and perform a one-to-one mapping of the data
source parameters to the calculation view parameters.
Context
Note
You can map attribute view input parameters to calculation view input parameters with the same name
only. The calculation view input parameter provides runtime value selection to filter attribute data based on
the filter defined in the attribute view. For example, you can define an attribute view GEO with filter set on
Country column such that, the filter value is an input parameter having syntax $$IP$$. When you use this
attribute view in a calculation view, you need to define a same name input parameter IP and map it with the
78
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
attribute view parameter. When you perform data preview on the calculation view, the runtime help for the
calculation view input parameter is shown. The value selected for calculation view parameter serves as
input for the attribute view parameter to filter the data.
Procedure
1. To invoke the dialog from the default aggregation or projection node:
a) Select the default aggregation or projection node.
b) Right-click Input Parameter in the Output view.
c) In the context menu, choose Manage Mappings.
2. To invoke the dialog from the Semantics node:
a) Select the Semantics node.
b) In the Variables/Input Parameters view, choose .
c) Choose Data sources or Views for value help
Note
The system displays the option Views for value help only if your calculation view consists of external
views as value help references in variables and input parameters. If you choose Views for value help, you
can map the parameters/ variable of external views for value help with the parameters/ variables of a
calculation view of any name.
3. In the Map Input Parameters dialog, map the data source input parameters (or parameters of external
views for value help) with the calculation view parameters.
Note
You can choose the Auto Map by Name option to automatically create the input parameters
corresponding to the source and perform a 1:1 mapping. You can also select a source input parameter
and use the following context menu options:
Copy and Map 1:1 - to create the same input parameter for the calculation view as for the source,
and create a 1:1 mapping between them.
Map By Name - to map the source input parameter with the calculation view input parameter
having the same name.
Remove Mapping - to delete the mapping between the source and calculation view input parameter.
4. Select Create Constant to create a constant at the target calculation view.
Note
You can change the constant name by double clicking it.
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 79


6.3.2.4 Manage Column Mappings
You can map the source columns to the target columns if there are a large number of attributes, or to assign a
constant value to the target column in a union view.
Context
If there is no source column mapped to a target column, a data type needs to be specified for that target
column.
Note
In a union view, a constant column is created if there are any target columns or output attributes for which
there are no mappings to the source columns. The default value for the constant column is NULL.
Procedure
1. Right-click the target column in the target list.
2. From the context menu, choose Manage Mappings.
3. Select the required column from the Source Column dropdown list that you want to map to the selected
target column.
4. To assign a default value to the target column, enter the value in the Constant Value field.
5. Select the required data type. Enter the length and scale as required and choose OK.
Related Information
Constant Column [page 82]
6.3.2.5 Apply Filter on Aggregation and Projection Node
Context
You can apply filter on the aggregation and projection node attributes except the default aggregation and
projection nodes. The filters applied on the columns are executed after the performing all the operations
80
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
defined in a Projection or an Aggregation View. In particular after the aggregation. So a filter on an aggregated
column has the same semantic as HAVING clause in SQL.
You can use the Expression editor to define pattern-based filters in calculation views. Double click on the
expression icon under the filter node of the Output panel. If you type
match("ABC",'*abc*')
the equivalent SQL is
where ABC like %abc%
.
You can use the following opertators for filtering data:
Filter Operator Description
Equal To filter and show data corresponding to the filter
value
Not Equal To filter and show data other than the filter value
Between To filter and show data for a particular range speci
fied in the From Value and To Value
List of Values To filter and show data for a specific list of values
separated by comma
Not in list To filter data and show data for the values other than
the ones specified. You can provide a list of values to
be excluded using comma.
Is NULL To filter and show row data having NULL values
Is not NULL To filter and show data of all the rows that have non
NULL values
Less than To filter and show data with values less than the one
specified as filter value
Less than or Equal to To filter and show data with values less than or equal
to the one specified as filter value
Greater than To filter and show data with values greater than the
one specified as filter value
Greater than or Equal to To filter and show data with values greater than or
equal to the one specified as filter value
Contains Pattern To filter and show data that matches the pattern
specified in the filter value. You can use '?' question
mark to substitute a single character, and '*' asterik
to substitute many. For example, to filter data for
continents that start with letter A, use Contains Pat
tern filter with value A*. This would show the data for
all the continents that start with A like Asia and Af
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 81


Filter Operator Description
rica. The filter Contains Pattern in expression edi
tor is converted as match. Hence, for the given exam
ple the corresponding filter expression is
(match("CONTINENT",'A*')).
You can either specify a fixed value for the filter, or use an input parameter of the current view to provide the
filter value at runtime during data preview. You can specify the filter value as fixed or dynamic in the Value Help
dialog by specifying the Type as Fixed or Input Parameter.
Procedure
1. Right-click the required attribute.
2. From the context menu, choose Apply Filter.
3. Select the required operator.
4. Enter a value and choose OK.
Note
You can edit a filter using filter expressions from the Output pane which provides more conditions that
can be used in the filter including AND, OR, and NOT. For example, to retrieve the sales of a product
where (revenue >= 100 AND region = India) OR (revenue >=50 AND region = Germany).
6.3.2.6 Constant Column
In a union view, a Constant Column is created if there are any target or output attributes for which there are no
mappings to the source attributes. The default value for the constant column is NULL.
Note
The target attribute is mapped to all the sources.
For example, you have two tables with similar structures, Actual Sales and Planned Sales, corresponding to
the sales of products. You want to see the combined data in a single view, but differentiate between the data
from the two tables for comparison. To do so, you can create a union view between the two tables and have a
constant column indicating constant values like A & P, as shown below:
Actual Sales
Sales Product
5000 A1
2000 B1
Planned Sales
82
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
Sales Product
3000 A1
6000 B1
The result of this query can be as follows:
Actual Planned Indicator Sales Product
A 5000 A1
P 3000 A1
A 2000 B1
P 6000 B1
6.3.2.7 Define Dynamic Joins
In a dynamic join, the elements of a join condition between two data sources are defined dynamically based on
the fields requested by the client query. It is used to improve the performance by reducing the less number of
records to be processed by the join node.
For example, consider two tables: Table1 and Table 2. Each table has joins between two fields: Field 1 and Field
2. If a client requests only one of the two fields, then the tables are joined only on the requested field . In a
dynamic join, at lteast one of the join elements must be requested by the client query; otherwise, it results in a
query run-time error.
This behavior of dynamic join is different from the standard (non-dynamic) join. In the standard join, the join
condition is static, which means that the join-condition does not change depending on the client query.
Whereas in the case of a dynamic join, the join-condition changes based on the query.
The dynamic join is only applicable for multi-column join scenarios. Therefore, it is disabled for single column
joins.
The dynamic join enforces the aggregation before executing the join as opposed to a standard join where the
aggregation happens after the join. This means, if a join field is not requested by the client query, its value is
first aggregated and then the join condition is executed based on the requested fields.
Example
You want to evaluate the sales data to calculate the sales share for a product.
The table shown below contains the product sales data at the region and country level.
Region Country Product Sales
APJ IND Prod1 10
APJ IND Prod2 10
APJ CHN Prod1 20
APJ CHN Prod2 50
SAP HANA Modeling Guide
Creating Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 83


Region Country Product Sales
EUR DE Prod1 50
EUR DE Prod2 100
EUR UK Prod1 20
EUR UK Prod2 30
In the calculation view, the above table is joined via two aggregation nodes such that the aggregation node
on the right does not contain the field Product as one of its column. Therefore, this node always delivers the
total sales of a given region or country. The two aggregation nodes are joined dynamically on the fields
REGION and COUNTRY. The output of the join node are REGION, COUNTRY, PRODUCT, SALES,
TOT_SALES, and SALES_SHARE.
When a client query on the view to evaluate the sales share at region level is submitted, the result from the
dynamic join and standard join is as follows:
Table 5: Dynamic Join Result
REGION PRODUCT SUM(SALES) SUM(TOT_SALES) SUM(SALES_SHA
RE)
APJ PROD1 30 90 .33
APJ PROD2 60 90 .66
EUR PROD1 70 200 .35
EUR PROD2 130 200 .65
Table 6: Standard Join Result
REGION PRODUCT SUM(SALES) SUM(TOT_SALES) SUM(SALES_SHA
RE)
APJ PROD1 30 90 .78
APJ PROD2 60 90 1.21
EUR PROD1 70 200 .73
EUR PROD2 130 200 1.26
The dynamic join delivers the sales share at the region level by aggregating the sales values before joining
the data sets. The standard join model first calculates the sales share at the region level plus the country
level (because the join condition contains both region and country), and then aggregates the resulting sales
share after the join has been executed.
Note
You can specify if a join is dynamic by setting Dynamic Join to true or false.
84
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Creating Information Views
7 Defining Data Access Privileges
This section describes how you can create, and use analytic privleges to allow selective access control for
information views when you activate the models.
7.1 Create Analytic Privileges
You apply analytic privileges when business users access values with certain combinations of dimension
attributes. You can use them to partition data among various users sharing the same data foundation. You can
define restrictions for a selected group of models or apply them to all content models across packages.
Prerequisites
You have system privileges CREATE STRUCTURED PRIVILEGE and STRUCTUREDPRIVILEGE ADMIN to
create, activate and drop the privilege.
CREATE STRUCTURED PRIVILEGE and STRUCTUREDPRIVILEGE ADMIN are correctly owned by the
SYS_REPO user.
, The database user has corresponding repository privileges, namely REPO.EDIT_NATIVE_OBJECTS and
REPO.ACTIVATE_NATIVE_OBJECTS to activate and redeploy analytic privileges in the Modeler.
Procedure
1. Set Parameters for the Analytic Privilege
a) If you are in the SAP HANA Modeler perspective, do the following:
1. Expand the system node from the SAP HANA Systems view.
2. Expand the Content node.
3. Select the required package.
4. From the context menu, choose New Analytic Privilege .
5. Enter a name and description for the analytic privilege, and choose Next.
6. Select the information models that you want to use for applying restrictions and choose Finish
Tip
You can choose to add more models in the editor pane.
b) If you are in the SAP HANA Development perspective, perform the following:
1. Select a project and in the context menu, choose New Other... .
2. In the pop-up wizard, select SAP HANA Modeler.
3. Select Analytic Privilege.
SAP HANA Modeling Guide
Defining Data Access Privileges
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 85


4. Enter a name and description for the analytic privilege, and choose Finish.
2. Select Applicable to all Information Models option If you want to add restrictions for all models.
Note
If you do not select this option, the restrictions you create apply only to the secured list of models
available in the Reference Models panel that you selected above.
3. In the Associated Attributes Restrictions panel, choose Add to select the attributes for defining
restrictions, and choose OK
Note
If you do not add any attributes for restrictions there will be unrestricted access to the selected models
or to all the models (if Applicable to all the Information Models option is selected).
4. In the Assign Restrictions pane, choose Add to add value restriction for the selected attributes. Select the
required Type:
Table 7:
Type Description Example
Fixed If you want to create an analytic
privilege with static filter condi
tions such that, once granted to a
user, will be automatically applied
to all the queries of a user to re
strict the query results only to the
authorized data.
For example, DEPARTMENT IN
("Finance", "Development") on
the DEPARTMENT attribute of
the view. A granted user can then
only access records of the view
qualifying the filter condition, as
the results of all queries of the
user on the view are automati
cally filtered using the filter condi
tion
Catalog Procedure or Repository
Procedure
For example, DEPARTMENT IN
("Finance", "Development") on
the DEPARTMENT attribute of
the view. A granted user can then
only access records of the view
qualifying the filter condition, as
the results of all queries of the
user on the view are automati
cally filtered using the filter condi
tion
For example, the same filter con
dition in the example above can
be defined as DEPARTMENT IN
(GET_DEPART
MENT_FOR_USER())
Here, GET_DEPART
MENT_FOR_USER is a database
procedure, which can contain any
arbitrarily complex logic to deter
mine the relevant DEPARTMENT
value for a given user. At runtime,
the procedure is executed and
the obtained result is employed
as operand in the actual filter
condition DEPARTMENT IN <...>.
86
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Defining Data Access Privileges
Note
Only views for which the property Enable Analytic Privilege is set to true, are checked for the applied
restrictions while querying the views otherwise, no restriction is checked against the view. This is
required in some of the scenarios like, the suite virtual data model in which only the query views (top
level views) needs to be protected by analytic privileges. The underlying views should only be protected
by SQL privileges.
The operators supported are: IN <list of scalar value> CONTAINSPATTERN <pattern with *>
EQUAL (=), LESSEQUAL (<=), LESSTHAN (<), GREATERTHAN (>), GREATEREQUAL (>=) <scalar
value> BETWEEN <scalar value as lower limit> <scalar value as upper limit>. NULL and IS NULL is
not supported.
5. Select the required operator and enter a value (manually or via Value Help dialog).
Note
If you are not using the value help for adding value for dynamic privilege, the syntax for repository
procedure is <package name>::<procedure name>. In case of catalog procedure, the syntax is
"<schema name>".<procedure name>.
6. Activate the analytic privilege using the Save and Activate option in the editor.
Remember
To activate the analytic privilege, you must assign a minimum of one restriction to each attribute.
Note
Select the Save and Activate All option to activate the privilege along with all the required objects.
7. Assign the privilege to a user
a) In the SAP HANA Systems view, go to Security Authorizations Users . Select a user.
b) In the context menu, choose Open.
c) Choose the Analytic Privileges tab page, and add the privilege.
d) From the editor toolbar, choose Deploy.
Related Information
Analytic Privileges [page 88]
Analytic privileges are intended to control read-only access to SAP HANA information models (attribute
views, analytic views, calculation views
Structure of Analytic Privileges [page 88]
An analytic privilege consists of a set of restrictions against which user access to a particular attribute view,
analytic view, or calculation view is verified. Each restriction controls the authorization check on the
restricted view using a set of value filters. A value filter defines a check condition that verifies whether or not
the values of the view (or view columns) qualify for user access.
SAP HANA Modeling Guide
Defining Data Access Privileges
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 87


7.1.1 Analytic Privileges
Analytic privileges are intended to control read-only access to SAP HANA information models (attribute views,
analytic views, calculation views
The attribute restriction of an analytic privilege specifies the value range that the user is permitted to access
using value filters. In addition to static scalar values, stored procedures can be used to define filters. This
allows user-specific filter conditions to be determined dynamically in runtime, for example, by querying
specified tables or views. As a result, the same analytic privilege can be applied to many users, while the filter
values for authorization can be updated and changed independently in the relevant database tables.
After activation, an analytic privilege needs to be assigned to a user before taking any effect. The user views
the filtered data based on the restrictions defined in the analytic privilege. If no analytic privilege applicable for
models is assigned to a user, he or she cannot access the model. If a user is assigned to multiple analytic
privileges, the privileges are combined with OR conditions.
Remember
In addition to the analytic privileges, a user needs SQL Select privileges on the generated column views.
The generated column views adhere to the following naming conventions:
For a view MyView in package p1.p2 (that is, subpackage p2 of package p1), the generated column view lies
in the deployment schema. Ensure that the users who are allowed to see the view have select privileges on the
view (or the entire deployment schema).
Note
Multiple restrictions applied on the same column are combined by OR. However, restrictions across several
columns are always combined by AND.
7.1.2 Structure of Analytic Privileges
An analytic privilege consists of a set of restrictions against which user access to a particular attribute view,
analytic view, or calculation view is verified. Each restriction controls the authorization check on the restricted
view using a set of value filters. A value filter defines a check condition that verifies whether or not the values of
the view (or view columns) qualify for user access.
The specification of these restrictions is contained in an XML document that conforms to a defined XML
schema definition (XSD).
The following restriction types can be used to restrict data access:
View
Activity
Validity
Attribute
The following operators can be used to define value filters in the restrictions.
88
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Defining Data Access Privileges
Note
The activity and validity restrictions support only a subset of these operators.
IN <list of scalar values>
CP <pattern with *>
EQ (=), LE (<=), LT (<), GT (>), GE (>=) <scalar value>
BT <scalar value as lower limit><scalar value as upper limit>
IS_NULL
NOT_NULL
All of the above operators, except IS_NULL and NOT_NULL, accept empty strings (" ") as filter operands.
IS_NULL and NOT_NULL do not allow any input value.
The following are examples of how empty strings can be used with the filter operators:
For the IN operator: IN ("", "A", "B") to filter on these exact values
As a lower limit in comparison operators, such as:
BT ("", XYZ), which is equivalent to NOT_NULL AND LE "XYZ"GT "", which is equivalent to
NOT_NULL
LE "", which is equivalent to EQ ""
LT "", which will always return false
CP "", which is equivalent to EQ ""
The filter conditions CP "*" will also return rows with empty-string as values in the corresponding attribute.
View Restriction
This restriction specifies to which column view(s) the analytic privilege applies. It can be a single view, a list of
views, or all views. An analytic privilege must have exactly one cube restriction.
Example
IN ("Cube1", "Cube2")
Note
When an analytic view is created in the SAP HANA modeler, automatically-generated views are included
automatically in the cube restriction.
Note
The SAP HANA modeler uses a special syntax to specify the cube names in the view restriction:
_SYS_BIC:<package_hierarchy>/<view_name>
For example:
<cubes>
<cube name="_SYS_BIC:test.sales/AN_SALES" />
SAP HANA Modeling Guide
Defining Data Access Privileges
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 89


<cube name="_SYS_BIC:test.sales/AN_SALES/olap" />
</cubes>
Activity Restriction
This restriction specifies the activities that the user is allowed to perform on the restricted view(s), for
example, read data. An analytic privilege must have exactly one activity restriction.
Example
EQ "read", or EQ "edit"
Note
Currently, all analytic privileges created in the SAP HANA modeler are automatically configured to restrict
access to READ activity only. This corresponds to SQL SELECT queries. This is due to the fact that the
attribute, analytic, and calculation views are read-only views. This restriction is therefore not configurable.
Validity Restriction
This restriction specifies the validity period of the analytic privilege. An analytic privilege must have exactly one
validity restriction.
Example
GT 2010/10/01 01:01:00.000
Note
All analytic privileges automatically become immediately valid and have unlimited validity when activated in
the SAP HANA modeler. This restriction is therefore not configurable.
Attribute Restriction
This restriction specifies the value range that the user is permitted to access. Attribute restrictions are applied
to the actual attributes of a view. Each attribute restriction is relevant for one attribute, which can contain
multiple value filters. Each value filter represents a logical filter condition.
Note
The HANA modeler uses different ways to specify attribute names in the attribute restriction depending on
the type of view providing the attribute. In particular, attributes from attribute views are specified using the
90
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Defining Data Access Privileges
syntax "<package_hierarchy>/<view_name>$<attribute_name>", while local attributes of analytical
views and calculation views are specified using their attribute name only. For example:
<dimensionAttribute name="test.sales/AT_PRODUCT$PRODUCT_NAME">
<restrictions>
<valueFilter operator="IN">
<value value="Car" />
<value value="Bike" />
</valueFilter>
</restrictions>
</dimensionAttribute>
Value filters for attribute restrictions can be static or dynamic.
A static value filter consists of an operator and either a list of values as the filter operands or a single value
as the filter operand. All data types are supported except those for LOB data types (CLOB, BLOB, and
NCLOB).
For example, a value filter (EQ 2006) can be defined for an attribute YEAR in a dimension restriction to
filter accessible data using the condition YEAR=2006 for potential users.
Note
Only attributes, not aggregatable facts (for example, measures or key figures) can be used in dimension
restrictions for analytic views.
A dynamic value filter consists of an operator and a stored procedure call that determines the operand
value at runtime.
For example, a value filter (IN (GET_MATERIAL_NUMBER_FOR_CURRENT_USER())) is defined for the
attribute MATERIAL_NUMBER. This filter indicates that a user with this analytic privilege is only allowed to
access material data with the numbers returned by the procedure
GET_MATERIAL_NUMBER_FOR_CURRENT_USER.
It is possible to combine static and dynamic value filters as shown in the following example.
Example
<dimensionAttribute name=" test.sales/AT_PRODUCT$PRODUCT_NAME ">
<restrictions>
<valueFilter operator="CP"> <value value="ELECTRO*"/> </valueFilter>
<valueFilter operator="IN"> <procedureCall schema="PROCEDURE_OWNER"
procedure="DETERMINE_AUTHORIZED_PRODUCT_FOR_USER" /> </valueFilter >
</restrictions>
</dimensionAttribute>
<dimensionAttribute name=" test.sales/AT_TIME$YEAR ">
<restrictions>
<valueFilter operator="EQ"> <value value="2012"/> </valueFilter>
<valueFilter operator="IN"> <procedureCall schema="PROCEDURE_OWNER"
procedure="DETERMINE_AUTHORIZED_YEAR_FOR_USER" /> </valueFilter >
</restrictions>
An analytic privilege can have multiple attribute restrictions, but it must have at least one attribute restriction.
An attribute restriction must have at least one value filter. Therefore, if you want to permit access to the whole
content of a restricted view, then the attribute restriction must specify all attributes.
Similarly, if you want to permit access to the whole content of the view with the corresponding attribute, then
the value filter must specify all values.
SAP HANA Modeling Guide
Defining Data Access Privileges
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 91


The SAP HANA modeler automatically implements these two cases if you do not select either an attribute
restriction or a value filter.
Example
Specification of all attributes:
<dimensionAttributes>
<allDimensionAttributes/ >
</dimensionAttributes>
Example
Specification of all values of an attribute:
<dimensionAttributes>
<dimensionAttribute name="PRODUCT">
<all />
</dimensionAttribute>
</dimensionAttributes>
Logical Combination of Restrictions and Filter Conditions
The result of user queries on restricted views is filtered according to the conditions specified by the analytic
privileges granted to the user as follows:
Multiple analytic privileges are combined with the logical operator OR.
Within one analytic privilege, all attribute restrictions are combined with the logical operator AND.
Within one attribute restriction, all value filters on the attribute are combined with the logical operator OR.
Example
You create two analytic privileges AP1 and AP2. AP1 has the following attribute restrictions:
Restriction R11 restricting the attribute Year with the value filters (EQ 2006) and (BT 2008, 2010)
Restriction R12 restricting the attribute Country with the value filter (IN ("USA", "Germany"))
Given that multiple value filters are combined with the logical operator OR and multiple attribute restrictions
are combined with the logical operator AND, AP1 generates the condition:
((Year = 2006) OR (Year BT 2008 and 2010)) AND (Country IN ("USA", "Germany"))
AP2 has the following restriction:
Restriction R21 restricting the attribute Country with the value filter (EQ "France")
AP2 generates the condition:
(Country = "France")
92
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Defining Data Access Privileges
Any query of a user who has been granted both AP1 and AP2 will therefore be appended with the following
WHERE clause:
((Year = 2006) OR (Year BT 2008 and 2010)) AND (Country IN ("USA", "Germany")))
OR (Country = "France")
7.1.3 Dynamic Value Filters in the Attribute Restriction of
Analytic Privileges
The attribute restriction of an analytic privilege specifies the value range that the user is permitted to access
using value filters. In addition to static scalar values, stored procedures can be used to define filters. This
allows user-specific filter conditions to be determined dynamically in runtime, for example, by querying
specified tables or views. As a result, the same analytic privilege can be applied to many users, while the filter
values for authorization can be updated and changed independently in the relevant database tables. In
addition, application developers have full control not only to design and manage such filter conditions, but also
to design the logic for obtaining the relevant filter values for the individual user at runtime.
Procedures used to define filter conditions must have the following properties:
They must have the security mode DEFINER.
They must be read-only procedures.
A procedure with a predefined signature must be used. The following conditions apply:
No input parameter
Only 1 output parameter as table type with one single column for the IN operator
Only 1 output parameter of a scalar type for all unary operators, such as EQUAL
Only 2 output parameters of a scalar type for the binary operator BETWEEN
Only the following data types are supported as the scalar types and the data type of the column in the
table type:
Date/Time types DATE, TIME, SECONDDATE, and TIMESTAMP
Numeric types TINYINT, SMALLINT, INTEGER, BIGINT, DECIMAL, REAL, and DOUBLE
Character string types VARCHAR and NVARCHAR
Binary type VARBINARY
NULL as Operand for Filter Operators
In static value filters, it is not possible to specify NULL as the operand of the operator. The operators IS_NULL
or NOT_NULL must be used instead. In dynamic value filters where a procedure is used to determine a filter
condition, NULL or valid values may be returned. The following behavior applies in the evaluation of such cases
during the authorization check of a user query:
Filter conditions of operators with NULL as the operand are disregarded, in particular the following:
EQ NULL, GT NULL, LT NULL, LE NULL, and CP NULL
BT NULL and NULL
SAP HANA Modeling Guide
Defining Data Access Privileges
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 93


If no valid filter conditions remain (that is, they have all been disregarded because they contain the NULL
operand), the user query is rejected with a Not authorized error.
Example
Dynamic analytic privilege 1 generates the filter condition (Year >= NULL) and dynamic analytic privilege 2
generates the condition (Country EQ NULL). The query of a user assigned these analytic privileges
(combined with the logical operator OR) will return a Not authorized error.
Example
Dynamic analytic privilege 1 generates the filter condition (Year >= NULL) and dynamic analytic privilege 2
generates the condition (Country EQ NULL AND Currency = USD). The query of a user assigned these
analytic privileges (combined with the logical operator OR) will be filtered with the filter Currency = USD.
In addition, a user query is not authorized in the following cases even if further applicable analytic privileges
have been granted to the user.
The BT operator has as input operands a valid scalar value and NULL, for example, BT 2002 and NULL or
BT NULL and 2002
The IN operator has as input operand NULL among the value list, for example, IN (12, 13, NULL)
Permitting Access to All Values
If you want to allow the user to see all the values of a particular attribute, instead of filtering for certain values,
the procedure must return "*" and '' '' (empty string) as the operand for the CP and GT operators respectively.
These are the only operators that support the specification of all values.
Implementation Considerations
When the procedure is executed as part of the authorization check in runtime, note the following:
The user who must be authorized is the database user who executes the query accessing a secured view.
This is the session user. The database table or view used in the procedure must therefore contain a
column to store the user name of the session user. The procedure can then filter by this column using the
SQL function SESSION_USER. This table or view should only be accessible to the procedure owner.
The user executing the procedure is the _SYS_REPO user. In the case of procedures activated in the SAP
HANA modeler, _SYS_REPO is the owner of the procedures. For procedures created in SQL, the EXECUTE
privilege on the procedure must be granted to the _SYS_REPO user.
If the procedure fails to execute, the users query stops processing and a Not authorized error is
returned. The root cause can be investigated in the error trace file of the indexserver,
indexserver_alert_<host>.trc.
When designing and implementing procedures as filter for dynamic analytic privileges, bear the following in
mind:
To avoid a recursive analytic privilege check, the procedures should only select from database tables or
views that are not subject to an authorization check based on analytic privileges. In particular, views
94
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Defining Data Access Privileges
activated in the SAP HANA modeler are to be avoided completely as they are automatically registered for
the analytic privilege check.
The execution of procedures in analytic privileges slows down query processing compared to analytic
privileges containing only static filters. Therefore, procedures used in analytic privileges must be designed
carefully.
7.1.4 Runtime Authorization Check of Analytic Privileges
When a user requests access to data stored in an attribute, analytic, or calculation view, an authorization
check based on analytic privileges is performed and the data returned to the user is filtered accordingly.
Access to a view and the way in which results are filtered depend on whether the view is independent or
associated with other modeling views (dependent views).
Independent Views
The authorization check for a view that is not defined on another modeling view is as follows:
1. The user requests access to an individual view, for example with a SELECT query.
This is possible if both of the following prerequisites are met:
The user has been granted the SQL privilege SELECT on the view or the schema in which it is located.
The user has been granted an analytic privilege that is applicable to the view. An analytic privilege is
applicable to a view if it contains the view in the view restriction and at least one filter on one attribute
of the view.
Note
The user does not require the SELECT privilege on the underlying base tables or views of the modeling
view.
2. The authorization check determines the analytic privileges that are relevant for the current user and view.
Relevant analytic privileges are those that met all of the following criteria:
Analytic privileges previously granted to the user, either directly or indirectly through a role
Analytic privileges with a view restriction that includes the accessed view
Analytic privileges with a currently valid validity restriction
Note
This check is always positive for analytic privileges created and activated in the SAP HANA
modeler.
Analytic privileges with an activity restriction covering the activity requested by the query are
considered
Note
This check is always positive for analytic privileges created and activated in the SAP HANA
modeler.
SAP HANA Modeling Guide
Defining Data Access Privileges
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 95


Analytic privileges with dimension restrictions covering some of the views attributes
3. If no relevant analytic privileges are found, the users queries are rejected with a Not authorized error.
This means that even though the user has the SELECT privilege on the view, access is not possible.
If the user does have a relevant analytic privilege but does not have the SELECT privilege on the view,
access is also not possible. If relevant analytic privileges are found, the authorization check evaluates the
value filters specified in the dimension restrictions and presents the appropriate data to the user.
Note
Multiple dimension restrictions and/or multiple value filters are combined as described in the section
on the structure of analytic privileges.
Dependent Views
Calculation views can be defined by selecting data from other column views, in particular, attribute views,
analytic views, and other calculation views. This can lead to a complex view hierarchy that requires careful
design of row-level authorization.
If a user requests access to such a calculation view that is dependent on another view, the behavior of the
authorization check and result filtering is performed as follows:
A user can access a calculation view based on other view(s) if both of the following prerequisites are met:
The user has been granted the SELECT privilege on the calculation view or the schema that contains the
calculation view.
The user has been granted analytic privileges that cover the calculation view itself and all the other column
views in the hierarchy.
Result filtering on the calculation view is performed as follows:
Individual views in the hierarchy are filtered according to their respective analytic privileges, which use the
logical OR combination.
The filtered result of the calculation view is derived from the filtered result of its underlying views. This
corresponds to a logic AND combination of the filters generated by the analytic privileges for the individual
views.
Note
If an analytic view designed in the SAP HANA modeler contains one of the elements listed below, the
analytic view will be activated automatically with an calculation view (with the name of the analytic view
appended by the suffix /olap) on top of it.
Currency or unit conversions
Calculated attributes
Calculated measures that use attributes, calculated attributes, or input parameters in their formulas
This represents a view hierarchy for which the prerequisites described above apply.
Note
An analytic view can be defined on attribute views. However, this in no way represents a view dependency or
hierarchy with respect to authorization check and result filtering. Analytic privileges are checked and
96
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Defining Data Access Privileges
combined independently for the analytic view and their related attribute views. However, as the analytic
view inherits and exposes the same attributes from the attribute views, the same filters on the same
attribute can be used in analytic privileges to filter an analytic view and its related attribute views. This is
convenient to define in a single analytic privilege with the view restriction including both the analytic view
and the related attribute views to control access to the views together.
7.1.5 Example: Using Analytic Privileges
Examples to explain how you can use analytic prvileges to control access to data in HANA information models.
Example
Consider an analytic view (without fields coming from attribute views) or a calculation view SALES,
which is added as part of an analytic privileges secured models having the following data.
CUST_ID CUST_GROUP SALES
1 GRP1 1000
2 GRP2 1500
3 GRP3 1200
1 GRP4 1300
If you create a restriction on column CUST_ID to filter data for CUST_ID 1 and 2, the conditions are
combined with OR and the data available for a user is:
CUST_ID CUST_GROUP SALES
1 GRP1 1000
2 GRP2 1500
1 GRP4 1300
If you create restrictions on columns CUST_ID and CUST_GROUP such as CUST_ID = 1 and
CUST_GROUP = 1, the conditions are combined with AND, and the data available for a user is:
CUST_ID CUST_GROUP SALES
1 GRP1 1000
Note
The technical name used for attributes of calculation views and local attributes of analytic views,
is the same as that of the attribute name. Hence any restriction applied to a local attribute of an
analytic or calculation view attribute is also applied to any other local attribute of an analytic view
and calculation view attribute having the same name.
In the above example, if there is any other analytic view or calculation view, which is part of a
privileges secured list of models, and has a field called CUST_ID (not coming from any
attribute view), the data for these privileges also gets restricted.
SAP HANA Modeling Guide
Defining Data Access Privileges
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 97


If Applicable to all information models is selected, any analytic view/calculation view (even if not
part of the secured models) which has a (private) attribute called CUST_ID, the data for these
privileges also get restricted.
The behavior for the calculation view is the same as that of the analytic view described above.
Consider an attribute view CUSTOMER which is part of an analytic privileges secured list of models
having the following data.
CUST_ID COUNTRY MANDT
1 IN 1
2 IN 1
3 US 1
1 DE 2
If you create a restriction on column CUST_ID to filter data for CUST_ID 1 and 2, the conditions are
combined with OR and the data is shown as follows:
CUST_ID COUNTRY MANDT
1 IN 1
2 IN 1
1 DE 2
If you create restrictions on columns CUST_ID and COUNTRY such as CUST_ID = 1 and COUNTRY = IN,
the conditions are combined with AND, and the data available for a user is:
CUST_ID COUNTRY MANDT
1 IN 1000
Note
The technical name used for an attribute view attribute is <package name>/<attribute view
name>$<attribute name>. In the above example, the technical name for CUST_ID is
mypackage/CUSTOMER$CUST_ID. This implies that if there is any other attribute view
STORE which is a part of the analytic privilege and has CUST_ID as its attribute, it is restricted.
Any analytic view that is part of the privileges secured list of models and has this attribute view
as its required object, is also restricted. In the example above, if an analytic view contains the
attribute views CUSTOMER and STORE, both CUST_ID attributes are handled independently,
because their internal technical name used for the privilege check are mypackage/CUSTOMER
$CUST_ID and myotherpackage/STORE$UST_ID.
If Applicable to all information models is selected, any analytic view (even if it is not part of the
secured models) having this attribute view as its required object, is also restricted.
98
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Defining Data Access Privileges
7.1.6 Example: Creating an Analytic Privilege with Dynamic
Value Filter
This example shows you how to create using SQL an analytic privilege that contains a dynamic procedure-
based value filter and a fixed value filter in the attribute restriction.
Context
Note
The analytic privilege in this example is created using SQL. Under normal circumstances, it is
recommended that you create analytic privileges using the SAP HANA modeler. Analytic privileges created
using SQL are not owned by the user _SYS_REPO. They can be granted and revoked only by the actual
database user who creates them.
Assume you want to restrict access to product data in secured views as follows:
Users should only see products beginning with ELECTRO, or
Users should only see products for which they are specifically authorized. This information is contained in
the database table PRODUCT_AUTHORIZATION_TABLE in the schema AUTHORIZATION.
To be able to implement the second filter condition, you need to create a procedure that will determine which
products a user is authorized to see by querying the table PRODUCT_AUTHORIZATION_TABLE.
Procedure
1. Create the table type for the output parameter of the procedure:
CREATE TYPE "AUTHORIZATION"."PRODUCT_OUTPUT" AS TABLE("PRODUCT" int);
2. Create the table that the procedure will use to check authorization:
CREATE TABLE "AUTHORIZATION"."PRODUCT_AUTHORIZATION_TABLE" ("USER_NAME"
NVARCHAR(128), "PRODUCT" int);
3. Create the procedure that will determine which products the database user executing the query is
authorized to see based on information contained in the product authorization table:
CREATE PROCEDURE "AUTHORIZATION"."DETERMINE_AUTHORIZED_PRODUCT_FOR_USER" (OUT
VAL "AUTHORIZATION"."PRODUCT_OUTPUT")
LANGUAGE SQLSCRIPT SQL SECURITY DEFINER READS SQL DATA AS
BEGIN
VAL = SELECT PRODUCT FROM "AUTHORIZATION"."PRODUCT_AUTHORIZATION_TABLE
WHERE USER_NAME = SESSION_USER;
END;
Note
The session user is the database user who is executing the query to access a secured view. This is
therefore the user whose privileges must be checked. For this reason, the table or view used in the
SAP HANA Modeling Guide
Defining Data Access Privileges
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 99


procedure should contain a column to store the user name so that the procedure can filter on this
column using the SQL function SESSION_USER.
4. Create the analytic privilege:
CREATE STRUCTURED PRIVILEGE '<?xml version="1.0" encoding="utf-8"?>
<analyticPrivilegeSchema version="1">
<analyticPrivilege name="AP2">
<cubes>
<allCubes />
</cubes>
<validity>
<anyTime/>
</validity>
<activities>
<activity activity="read" />
</activities>
<dimensionAttributes>
<dimensionAttribute name="PRODUCT">
<restrictions>
<valueFilter operator="CP"> <value value="ELECTRO*"/> </
valueFilter>
<valueFilter operator="IN"> <procedureCall schema="AUTHORIZATION"
procedure="DETERMINE_AUTHORIZED_PRODUCT_FOR_USER"/> </valueFilter>
</restrictions>
</dimensionAttribute>
</dimensionAttributes>
</analyticPrivilege>
</analyticPrivilegeSchema>';
Results
Now when a database user requests access to a secured view containing product information, the data
returned will be filtered according to the following condition:
(product LIKE "ELECTRO*" OR product IN
(AUTHORIZATION.DETERMINE_AUTHORIZED_PRODUCT_FOR_USER())
100
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Defining Data Access Privileges
8 Additional Functionality for Information
Views
After you create an information view, you can perform certain additional functions to enrich your views, and to
obtain a desired output . This sections covers the additional functions that you can perform on your
information views.
8.1 Create Level Hierarchies
You create hierarchies to arrange view attributes that enhances data analysis by displaying attributes
according to their defined hierarchical relationships.A level hierarchy is rigid in nature, and the root and the
child nodes can only be accessed in a defined order.
Context
Level hierarchies consist of one or more levels of aggregation. Attributes roll up to the next higher level in a
many-to-one relationship, and members at this higher level roll up into the next higher level, and so on, until
they reach the highest level.
An example of a level hierarchy is an address hierarchy comprised of region, country, state, and so on.
Note
The hierarchies belonging to an attribute view are available in an analytic view that reuses the attribute view
in read only mode. However, the hierarchies belonging to an attribute view are not available in a calculation
view that reuses the attribute view.
Procedure
1. Select the Semantics node.
2. In the Hierarchies panel, choose Create option. Enter a name and description for the hierarchy.
3. In the Hierarchy Type dropdown, select Level Hierarchy.
4. In the Node tab page, do the following:
a) Select the required value from the Node Style dropdown list.
Note
Node style determines the composition of a unique node ID. The different values for the node styles
are:
SAP HANA Modeling Guide
Additional Functionality for Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 101


Level Name - the unique node ID is composed of the level name and node name; for example,
"[Level 2].[B2]".
Name Only - the unique node ID is composed of level name; for example, "B2".
Name Path - the unique node ID is composed of the result node name and the names of all
ancestors apart from the (single physical) root node; for example, "[A1].[B2].[C3]".
b) Add the required columns as levels from the dropdown list. You can select columns from the required
table fields in the dropdown list to add to the view.
c) Select the required Level Type.
The level type is used to specify the semantics for the level attributes.
A level of the type LEVEL_TYPE_TIME_MONTHS indicates that the attributes of the level contain
month such as "January", and LEVEL_TYPE_REGULAR indicates that a level does not require any
special formatting.
d) To control how the members of the hierarchy are ordered, select the required column in the OrderBy
dropdown list.
Note
In the MDX client tools, the members will be sorted on by attribute.
e) To sort the display of the hierarchy members in the ascending or descending order, select the
required option from the Sort Direction dropdown list.
5. In the Advanced tab page, do the following:
a) Select the required value in the Aggregate All Nodes.
This option indicates that data is posted on aggregate nodes and should be shown in the user
interface.
If you have the members A with value 100, A1 with value 10, and A2 with value 20 where A1 and A2 are
children of A. By default the value is set to false, and you will see a value of 30 for A.
With the value set to true, you will count the posted value 100 for A as well and see a result of 130. If
you are sure that there is no data posted on aggregate nodes you should set the option to false. The
engine will then calculate the hierarchy faster as when the option is set.
Note
Note that this flag is only interpreted by the SAP HANA MDX engine. In the BW OLAP engine the
node values are always counted.
b) Enter a value for the default member.
c. To specify how to handle the orphan nodes in the hierarchy, select the required option from the
dropdown list.
In a parent-child hierarchy, if you have a row with parent = V1, child = V2, and there is no other row
with child = V1, then V1 is treated as an orphan node.
Option Description
Root Node Treat them as root nodes
Error Stop processing and show an error
102
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Additional Functionality for Information Views
Option Description
Ignore Ignore them
Step Parent Put them under a step-parent node
Note
The stepparent node must already exist in the
hierarchy and it must be at the root level. En
ter the node ID for the stepparent node. This
enables you to assign all the orphaned nodes
under this node. The node ID should be en
tered according to the node style selected. For
example if the node style selected is level
name, the stepparent node ID can be [Level2].
[B2].
Note
If you have selected Step Parent in the Orphan Nodes dropdown, enter a value to create the step-
parent node.
d) Select Add a Root Node checkbox if a hierarchy does not have a root node, but needs one for reporting
purposes.
This will create a root node with the technical name ALL .
e) Select the Mulitple Parent checkbox if a hierarchy needs to support multiple parents for its elements.
for example, ,
The country, Turkey needs be assigned to two regions, Europe and Asia.
Restriction
Multiple parents and compound parent-child definition is currently not supported by MDX.
6. Choose OK.
8.2 Create Parent-Child Hierarchies
A parent-child hierarchy is defined using a parent attribute that determines the relationship among the view
attributes. A parent attribute describes a self-referencing relationship, or self-join, within the main table.
Context
Parent-child hierarchies are constructed from a single parent attribute. You can define multiple parent child
pairs to support the compound node IDs. For example, two parent child pairs, CostCenter-ParentCostCenter
SAP HANA Modeling Guide
Additional Functionality for Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 103


and ControllingArea-ParentControllingArea, constitutes a compound parent child definition to uniquely
identify cost centers .
An example of a parent-child hierarchy is a bill of materials hierarchy (parent and child) or an employee master
(employee and manager) hierarchy.
Note
The hierarchies belonging to an attribute view are available in an analytic view that reuses the attribute
viewin read only mode. However, the hierarchies belonging to an attribute view are not available in a
calculation view that re-uses the attribute view.
Procedure
1. Select the Semantics node.
2. In the Hierarchies panel, choose the Create option . Enter a name and description for the hierarchy.
3. In the Hierarchy Type dropdown, choose Parent-Child Hierarchy.
4. In the Node tab page, add the parent and child nodes by selecting Parent Node and Child Node from the
dropdown list.
Note
If you decide to place the orphaned parent-child pair under a node called Step Parent from the
Advanced tab page, you can specify its value in the Step Parent column. You can specify different
stepparent values for all the parent-child pairs. These values appear as a comma separated list in the
Advance tab page Stepparent field.
In case of a single parent-child node, you can also specify the value for the stepparent node in the
Advanced tab page. The same value appears in the Node tab page.
You can set a Root Node for each parent-child definition. For an Attribute view, you can only have a
Fixed value for a Root Node whereas for a Calculation view you can have both Input Parameter and Fixed
value.
5. In the Advanced tab page, do the following:
a) Select the required value in the Aggregate All Nodes and enter a value for the default member.
This option indicates that data is posted on aggregate nodes and should be shown in the user
interface.
If you have the members A with value 100, A1 with value 10, and A2 with value 20, where A1 and A2 are
children of A, then, by default, the value is set to false, and you will see a value of 30 for A.
With the value set to true, you will count the posted value 100 for A as well and see a result of 130. If
you are sure that there is no data posted on the aggregate nodes, then you should set the option to
false. The engine will then calculate the hierarchy faster as when the option is set.
104
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Additional Functionality for Information Views
Note
This flag is only interpreted by the SAP HANA MDX engine. In the BW OLAP engine, the node values
are always counted.
b. To specify how to handle the orphan nodes in the hierarchy, select the required option from the
dropdown list.
In a parent-child hierarchy, if you have a row with parent = V1; child = V2, and there is no other row
with child = V1, then V1 is treated as an orphan node.
Option Description
Root Node Treat them as root nodes
Error Stop processing and show an error
Ignore Ignore them
Step Parent Put them under a stepparent node
Note
The stepparent node must already exist in the
hierarchy and it must be at the root level. En
ter the node ID for the stepparent node. This
enables you to assign all the orphaned nodes
under this node. For example, if the cost cen
ter 001 does not have parent cost center, then
you can assign it to some other cost center
010 as a child.
Note
If you have selected Step Parent in the Orphan Nodes dropdown, enter a value to create the
stepparent node.
c) Select Add Root Node checkbox if a hierarchy does not have a root node, but needs one for reporting
purposes. Set the option to True and it will create a root node.
Note
If a hierarchy does not have a root node but needs one for reporting use case,
d) Select the Mulitple Parent checkbox if a hierarchy needs to support multiple parents for its elements.
for example,
The country, Turkey needs be assigned to two regions, Europe and Asia.
Restriction
Multiple parents and compound parent-child definition is currently not supported by MDX.
SAP HANA Modeling Guide
Additional Functionality for Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 105


e) You can sort members of parent child hierarchy based on a column value. In the Order By Column,
select a column that you want to use to sort the hierarchy. Choose a Sort Direction for the column you
select.
6. Choose OK.
8.3 Create Input Parameters
You create input parameters for information views to obtain a more desired output at run time (when you
execute the infromation view).
Procedure
1. In the Scenario panel, select a node.
2. In the Output panel right-click Input Parameters node.
Note
You can also create input parameters at the Semantics node level, using the Create Input Parameter
option in the Variables/Input Parameters panel.
3. From the context menu, choose New.
a) Enter a name and description (Label)
b) Select the type of input parameter from the Parameter Type dropdown list.
Note
For the Column type of input parameter, you need to select an attribute from the Reference
Column dropdown list. At runtime the value for the input parameter is fetched from the
selected attribute data selected in the Reference Column dropdown list.
For an input parameter of type Derived from Table, you need to select a table and one of its
columns as Return Column whose value is then used as input for the formula calculation. You
can also define conditions to filter the values of Return Column in the Filters panel. For example,
to calculate a discount for specific clients, you can create an input parameter based on the
Sales table and return column Revenue with filter set on the Client_ID.
For a Direct Type input parameter, specify the Semantic Type that describes the use of
parameter as a currency, unit of measure or date, for example, to specify the target currency
during currency conversion.
For a Static List input parameter, specify a list of values along with the data types, length and
scale that you would use for the input parameter.
c) To provide the default value for the input parameter that is considered in case a value at runtime is not
provided, choose the option Constant or Expression as required.
106
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Additional Functionality for Information Views
Note
You can use expressions for default value when you want to calculate the default value based on
some formula like, date(Now()) to perform calculation based on the current date.
d) If required, select a data type.
e) Enter length and scale for the input parameter.
f) Choose OK
Note
You can also copy an input parameter and modify it as required to make a new one. The copy-paste
option is available from the context menu of the calculated column. You can also use the CTRL + C and
CTRL + V keyboard shortcuts. The copy-paste functionality only works in the same editor, that is, if
you copy an input parameter in one view editor, you cannot paste it in another view editor. The copy-
paste functionality for input parameters only works in the Output panel and the Data Foundation .
8.3.1 Input Parameters
You use input parameters to define internal parameterization of the view. Input parameters used in the views
enables you to obtain a desired functionality when the view is executed.
This means the engine needs to know and use the parameter value during the view execution for example, to
calculate a formula for a calculated measure. The parameter value is passed to the engine via the
PLACEHOLDER clause of the SQL statement. Normally a parameter can only have a single value, for example,
for currency conversion. However, when working with the in() function in filter expressions of the calculation
views you can pass several values as an IN List. The quoting must be followed as shown below:
For numerical type parameters
The filter expression of a calculation view CV1 is defined as:
in("attr", $$param$$)
Then you need to pass several values as:
select ... from CV1( 'PLACEHOLDER' = ('$$var$$' = 'VAL1,VAL2,VAL3')
For string type parameters
The filter expression of a calculation view CV1 is defined as:
in("attr", $$param$$)
Then you need to pass several values (with double quotes) as:
select ... from CV1( 'PLACEHOLDER' = ('$$var$$' = '''VAL1'',''VAL2'',''VAL3''')
You use input parameters as placeholders during currency conversion, unit of measure conversion and
formulas like calculated columns in an analytic view and a calculation view. When used in formulas, the
calculation of the formula is based on the input that you provide at runtime during data preview. In calculation
view, you can additionally use these input parameters in the script node.
SAP HANA Modeling Guide
Additional Functionality for Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 107


You can apply input parameters in analytic and calculation views. If a calculation view is created using an
analytic view with input parameters, those input parameters are also available in the calculation view.
The following types of input parameters are supported:
Type Description
Column Use this when the value of a parameter comes from an
attribute or table column.
Static List Use this when the value of a parameter comes from a user-
defined list of values.
Derived From Table Use this when the value of a parameter comes from a table
column based on some filter conditions and you do not
need to provide any input at runtime.
Direct Use this to specify an input parameter as currency and date
during currency conversion, and target unit during unit of
measure conversion.

Each type of input parameter is either mandatory or non-mandatory. Mandatory in the view model means
semantically mandatory that is, the data might be inconsistent if the parameter value is not provided because
for instance data is then aggregated across clients. From the engine point of view the parameter is technically
mandatory that is, if no default value is provided (which means a value has to be provided by the caller).
Therefore, irrespective of the parameter being set as mandatory or not, if a default value is not set for the
parameter, and it is mandatory to provide a value at runtime.
The expected behavior of the input parameter when a value at runtime is not provided is as follows:
Default Value Expected Behavior
Yes Calculates the formula based on the default value
No Results in error
Note
The table above implies that it is mandatory to provide a value for the input parameter either at runtime or
assign a default value while creation, otherwise, it leads to errors.
Note
You can also check whether an input parameter is mandatory or not from the properties of the input
parameter in the Properties pane.
Example
If you want to preview a sales report with data for various countries in their respective currency for a
particular date for correct currency conversion, you can use Currency and Date as input parameters.
108
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Additional Functionality for Information Views
Procedure
1. In the Scenario panel, select a node.
2. In the Output panel right-click Input Parameters node.
Note
You can also create input parameters at the Semantics node level, using the Create Input Parameter
option in the Variables/Input Parameters panel.
3. From the context menu, choose New.
a. Enter a name and description (Label).
b. Select the type of input parameter from the Parameter Type dropdown list.
Note
For the Column type of input parameter, you need to select an attribute from the Reference
Column dropdown list. At runtime the value for the input parameter is fetched from the
selected attribute data selected in the Reference Column dropdown list.
For an input parameter of type Derived from Table, you need to select a table and one of its
columns as Return Column whose value is then used as input for the formula calculation. You
can also define conditions to filter the values of Return Column in the Filters panel. For example,
to calculate a discount for specific clients, you can create an input parameter based on the
Sales table and return column Revenue with filter set on the Client_ID.
For a Direct Type input parameter, specify the Semantic Type that describes the use of
parameter as a currency, unit of measure or date, for example, to specify the target currency
during currency conversion.
For a Static List input parameter, specify a list of values along with the data types, length and
scale that you would use for the input parameter.
c. To provide the default value for the input parameter that is considered in case a value at runtime is not
provided, choose the option Constant or Expression as required.
Note
You can use expressions for default value when you want to calculate the default value based on
some formula like, date(Now()) to perform calculation based on the current date.
d. If required, select a data type.
e. Enter length and scale for the input parameter.
f. Choose OK.
Note
You can also copy an input parameter and modify it as required to make a new one. The copy-paste option
is available from the context menu of the calculated column. You can also use the CTRL + C and CTRL + V
keyboard shortcuts. The copy-paste functionality only works in the same editor, that is, if you copy an input
parameter in one view editor, you cannot paste it in another view editor. The copy-paste functionality for
input parameters only works in the Output panel and the Data Foundation .
SAP HANA Modeling Guide
Additional Functionality for Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 109


8.4 Assign Variables
You can assign variables to a filter at design time for obtaining data based on the values you provide for the
variable. At runtime, you can provide different values to the variable to view the corresponding set of attribute
data.
Context
You provide values to the variables either by entering the values manually, or by selecting them from the Value
Help dialog.
Note
You can apply variables to attributes of analytic and calculation views.
Procedure
1. In the Semantics node Variables/Input Parameter panel, choose the Create Variable option.
Note
Alternatively, you can invoke the variable dialog by selecting the attribute from the Column panel, and
choosing . If you create variable using this option, the Attribute and Assign variable filter to fields
are auto filled with the selected attribute.
2. Enter a name and description for the variable.
3. Select the required attribute from the dropdown list.
Note
At runtime, the value for the variable is fetched from the selected attribute's data. Also, the attribute
you select for the first time from the dropdown list is automatically added to the Apply variable filter to
panel. If you make change to the Attribute dropdown selection this value still prevails in the Apply
variable filter to, and the newly selected attribute is not added to the list of Apply variable filter to.
4. Choose the required Selection Type from the dropdown list
5. Select Multiple Entries if you want to provide different values at runtime to filter data. For example, to view
the revenue from a period of 2000 to 2005 and 2012.
6. To specify the variable as mandatory, select the Is Mandatory checkbox.
110
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Additional Functionality for Information Views
Note
Each type of variable can be either mandatory or non-mandatory. For a mandatory variable, it is
necessary to provide a value at runtime. However, for a non-mandatory variable, if you do not specify a
value at runtime, you see the unfiltered data.
7. To provide the default value for the variable that is considered in case a value at runtime is not provided,
choose the option Constant or Expression as required.
Note
You can use expressions for default value when you want to calculate the default value based on some
formula like, date(Now()) to perform calculation based on the current date.
8. To assign the variable to attribute(s), in the Apply variable filter to panel, choose Add.
9. Select the attribute(s) from the dropdown list to which you want to assign this variable.
Note
You can also assign a variable to an attribute later in the Column panel of the Semantics node Details
panel. To assign a variable to an attribute, select a variable from the variable dropdown list in the
Variable column.
Remember
Once you assign a attribute to the variable, you can delete that variable only after removing the
attribute from the Apply variable filter to in the Variable dialog.
10. Choose OK
Related Information
Supported Variable Types [page 111]
SAP HANA modeling environment supports the following variable types:
8.4.1 Supported Variable Types
SAP HANA modeling environment supports the following variable types:
Type Description
Single Value Use this to filter and view data based on a single attribute
value. For example, to view the sales of a product where the
month is equal to January.
SAP HANA Modeling Guide
Additional Functionality for Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 111


Type Description
Interval Use this to filter and view a specific set of data. For
example, to view the expenditure of a company from March
to April.
Range Use this to filter and view data based on the conditions that
involve operators such as "="(equal to), ">" (greater than),
"<" (less than), ">=" (greater than or equal to), and "<="
(less than or equal to). For example, to view the sales of all
products in a month where the quantity sold is >= 100..
In addition, each type of variable can be either mandatory or non-mandatory. For a mandatory variable, you
need to provide a value at runtime. For a non-mandatory variable, if you have not specified a value at runtime,
you view unfiltered data.
Note
You can check if a variable is mandatory from the properties of the variable in the Properties pane.
8.5 Using Currency and Unit of Measure
You can define a measure as an amount or quantity in the analytical space, and perform currency conversion.
Measures used in analytic views and calculation views can be defined as amount or weight in the analytical
space using currency and unit of measure. You can also perform currency conversion and unit of measure
conversion.
For example, you need to generate a sales report for a region in a particular currency, and you have sales data
in database tables in a different currency. You can create an analytic view by selecting the table column
containing the sales data in this other currency as a measure, and perform currency conversion. Once you
activate the view, you can use it to generate reports.
Similarly, if you need to convert the unit of a measure from cubic meters to barrels to perform some volume
calculation and generate reports, you can convert quantity with unit of measure.
To simplify the process of currency conversion, the system provides a list of currencies, and exchange rates
based on the tables imported for currency. Currency conversion is performed based on source currency,
target currency, exchange rate, and date of conversion. You can also select currency from the attribute data
used in the view.
To simplify the process of conversion, system provides the following:
For currency conversion - a list of currencies, and exchange rates based on the tables imported for
currency.
For quantity unit conversion - a list of quantity units based on the tables imported for units.
Currency conversion is performed based on the source currency, target currency, exchange rate, and date of
conversion. You can also select currency from the attribute data used in the view. Similarly, quantity unit
conversion is performed based on the source unit and target unit.
112
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Additional Functionality for Information Views
You can also select the target currency or unit of measure at query runtime using input parameters. If you use
this approach then, you have to first create an input parameter with the desired currency/unit specified, and
use the same input parameter as target in the conversion dialog.
Note
Currency conversion is enabled for analytic views and base measures of calculation views.
Related Information
Input Parameters [page 107]
You use input parameters to define internal parameterization of the view. Input parameters used in the
views enables you to obtain a desired functionality when the view is executed.
Associate Measures with Currency [page 113]
You can associate measures in analytic views and calculation views with a particular currency or to perform
currency conversions.
Associate Measures with Unit of Measure [page 116]
You can associate measures in analytic views and calculation views with unit of measure.
8.5.1 Associate Measures with Currency
You can associate measures in analytic views and calculation views with a particular currency or to perform
currency conversions.
Prerequisites
You have imported tables T006, T006D, and T006A for Unit of Measure.
You have imported TCURC, TCURF, TCURN, TCURR, TCURT, TCURV, TCURW, and TCURX for currency.
Procedure
1. Select a measure.
2. In the Properties pane, select Semantic Type.
3. If you want to associate the measure with a currency, perform the following substeps:
a. In the Semantic Type dropdown list, select the value Amount with Currency Code.
b. In the Currency Dialog, select the required Type as follows:
SAP HANA Modeling Guide
Additional Functionality for Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 113


Type Purpose
Fixed To select currency from the currency table TCURC.
Column To select currency from one of the attributes used in
the view.
c. Select the required value, and choose OK.
d. If you want to convert the value to another currency, choose Enable for Conversion.
a. In the Source Currency dropdown, select the required Type as follows:
Type Purpose
Fixed To select currency from the currency table TCURC.
Column To select currency from one of the attributes used in
the view.
b. Select the required value, and choose OK.
c. Select the target currency.
Note
For currency conversion, in addition to the types Fixed and Column, you can select Input
Parameter to provide target currency at runtime. If you select an input parameter for specifying
target currency and deselect Enable for Conversion checkbox, the target currency field gets
clear because input parameters can be used only for currency conversion.
d. To specify exchange rate type, in the Exchange Rate Types dialog, select the Type as follows:
Type Purpose
Fixed To select exchange rate from the currency table
TCURW.
Attribute To select conversion date from one of the attributes
used in the view.
Input Parameter To provide exchange rate input at runtime as input
parameter.
e. To specify the date for currency conversion, in the Conversion Date dialog, select the Type as
follows:
Type Purpose
Fixed To select conversion date from the calendar.
Attribute To select conversion date from one of the attributes
used in the view.
Input Parameter To provide conversion date input at runtime as input
parameter.
f. To specify the schema where currency tables are located for conversion, in the Schema for
currency conversion, select the required schema.
114
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Additional Functionality for Information Views
g. To specify the client for which the conversion rates to be looked for, in the Client for currency
conversion, select the Type as follows. .
Type Purpose
Fixed/Dynamic To enter a fixed client or to select a session clientr.
Attribute To select a client from one of the attributes used in
the view.
Input Parameter To provide client input at runtime as input
parameter.
e. From the dropdown list, select the required value that is used to populate data if the conversion fails:
Option Result
Fail In data preview, the system displays an error for
conversion failure.
Set to NULL In data preview, the value for the corresponding
records is set to NULL.
Ignore In data preview, you view the unconverted value for the
corresponding records.
4. Select the Data Type of the measure.
Note
You can specify the data type for base measures only. Changing the data type of the base measure
here, overrides the data type of the measure in the underlying table.
Tip
You can use data type DECIMAL to preserve the exact precision of currency conversion. For data type
DECIMAL, the length specifies the total number of digits (the sum of whole digits and fractional digits),
and scale specifies the number of fractional digits.
If you do not specify the length and scale, DECIMAL becomes a floating-point decimal number (FLOAT).
5. Choose a result currency column name. By default the system generates the result currency column. If
you do not want to generate a result currency column, unselect the checkbox Generate Result Currency
Column.
6. Choose OK.
Note
You can associate Currency or Unit of Measure with a calculated measure, and perform currency
conversion for a calculated measure by editing it.
Related Information
Input Parameters [page 107]
SAP HANA Modeling Guide
Additional Functionality for Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 115


You use input parameters to define internal parameterization of the view. Input parameters used in the
views enables you to obtain a desired functionality when the view is executed.
8.5.2 Associate Measures with Unit of Measure
You can associate measures in analytic views and calculation views with unit of measure.
Prerequisites
You have imported tables T006, T006D, and T006A for Unit of Measure.
You have imported TCURC, TCURF, TCURN, TCURR, TCURT, TCURV, TCURW, and TCURX for currency.
Procedure
1. Select a measure.
2. In the Properties pane, select Semantic Type.
3. If you want to associate a measure with a unit of measure other than currency, perform the following
substeps:
a. Select the value Quantity with Unit of Measure in the Semantic Type drop-down list.
b. In the Quantity Units dialog , select the required Type as follows:
Type Purpose
Fixed To select a unit of measure from the unit tables T006,
T006A and T006D.
Column To select a unit of measure from one of the attributes
used in the view.
c. Select the required value, and choose OK.
d. If you want to convert the value to another unit, choose Enable for Conversion.
a. To select the source currency, choose Unit.
b. Select the target currency.
Note
For unit conversion, in addition to the types Fixed and Column, you can select Input Parameter
to provide target unit at runtime. If you select an input parameter for specifying target unit and
deselect Enable for Conversion checkbox, the target unit field gets clear because input
parameters can be used only for unit conversion.
c. To specify the schema where unit tables are located for conversion, in the Schema for unit
conversion, select the required schema.
116
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Additional Functionality for Information Views
d. To specify the client for which the unit conversion factors to be looked for, in the Client for unit
conversion, select the required Type as follows:
Type Purpose
Fixed/Dynamic To enter a fixed client or to select a session clientr.
Attribute To select a client from one of the attributes used in
the view.
Input Parameter To provide client input at runtime as input
parameter.
e. From the dropdown list, select the required value that is used populate data if the conversion fails:
Option Result
Fail In data preview, the system displays an error for
conversion failure.
Set to NULL In data preview, the value for the corresponding
records is set to NULL.
Ignore In data preview, you view the unconverted value for
the corresponding records.
4. Choose OK.
Note
You can associate Currency or Unit of Measure with a calculated measure, and perform currency
conversion for a calculated measure by editing it.
Related Information
Input Parameters [page 107]
You use input parameters to define internal parameterization of the view. Input parameters used in the
views enables you to obtain a desired functionality when the view is executed.
8.6 Assign Default Client
You can specify a value for the Default Client property in the SAP HANA modeler preferences screen.
Procedure
1. Navigate to Window Preferences SAP HANA Modeler Default Model Parameters .
SAP HANA Modeling Guide
Additional Functionality for Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 117


2. Select the value as Session Client or edit the Default Client text to specify a client for filtering data at
runtime.
Note
You can also edit the Default Client property in the view editor by selecting the Semantics node and
changing the value in the Properties panel.
Related Information
Default Client Property [page 118]
8.6.1 Default Client Property
You can set a value for the Default Client property of an information view to filter and see the data that is
relevant to a specific client as specified in the table columns like, MANDT or CLIENT. In addition, you can apply
filters to the table (data source) only if the table column is according to the following conditions:
Field name is MANDT or CLIENT
Data type is navchar (3)
It is the first field in the table
It is part of primary key for the table
The default value for the property is the one that is specified as a preference. At run time, if the property is set
to Session Client then, the value set for the Session Client property while creating a user is used to filter table
data. If the value for the property is set as Cross Client then, data is not filtered against any client and you see
the values for all the clients. The default client property is editable so that you can also enter any value to
specify a client like, 001.
Note
In case of calculation views, the behavior is as follows:
For old calculation views with SPS06 server, if you set the Default Client property as Session Client
(earlier known as Dynamic), it was interpreted as Cross Client and the data for all clients is shown.
For old calculation views with SPS07 server, if the property is set to Session Client, and you redeploy
the view, it is still interpreted as Cross Client and unfiltered data is shown.
For old calculation view with SPS07 server, if you edit the model with the Default Client property set to
Session Client and save and activate it, it is interpreted as Session Client with data visible for a specific
client.
For new calculation view with SPS07 server, the filtering takes place based on the value for the Default
Client property that is, if the value is specified as Session Client or a fixed value for example 001, you will
see the filtered data for the particular client.
Default Client Property handling in Calculation View Post SPS07
Before SPS07, the Default client property of calculation views was not considered by execution engine. This
means, although the default client property is set as Session Client, when executing the calculation views, the
118
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Additional Functionality for Information Views
users session client property value is not considered. Hence the execution of calculation always behaves as if
the default client is set as Cross Client. Since SPS07, this capability is enabled for Calculation views. But in
order to ensure compatibility of calculation views execution, to prevent different results due to the default
client interpretation feature, the following approach has been taken by Modeler (SAP HANA Studio). When the
calculation views are activated without changing them and saving them through editor, they continue to
behave as before. This means, the default client property is not considered. The execution behaves as if the
default client is set as cross client. But when the calculation views are opened in the editor, the default client
property will be automatically corrected as Cross Client if it was previously set as Session client or with a
fixed client value. This ensures the editor shows correct semantic as the execution. If it was already set as
Cross client, no changes are made. This is applicable only for calculation views since SPS07.
Impact on Client property in Currency conversion definitions
Before SPS07, it was possible to leave Client property empty in currency conversion definition of a measure.
In this case, the activation considered default client property value of the calculation view. Imagine the default
client property of the calculation views were set as Session Client and client property value was omitted for
currency conversion definition. In this case, although the calculation view did not honor the default client,
currency conversion honored the default client property, hence applied the session client property value of
the corresponding user who executes the calculation view. In order to keep the behavior intact, while opening
the calculation views in editor, if the default client property had to be changed (because it was set other than
Cross Client), all currency conversion definition (where the client property was not set) are collected and set
with previously defined default client value. For example, imagine a calculation view defined with default client
property as Session Client and there exists a measure M1 with currency conversion defined without client
property set. In SPS07, when this calculation view is opened in editor, although the default client property of
the view will be set as Cross Client to represent correct execution semantic, the currency conversion
definition of M1 will be set as Session Client (as the previous value of default client property value), in order to
keep the execution results same.
8.7 Assign Semantics
You can assign semantic types to attributes or calculated attributes either from properties or from the Assign
Semantics action in the Semantic node editor.
Procedure
1. In the Semantic Node editor, choose the required attribute or calculated attribute.
2. Choose the Assign Semantics action.
3. In the Semantics window, choose the required semantics type.
4. Choose OK.
Related Information
Supported Semantic Types [page 120]
SAP HANA Modeling Guide
Additional Functionality for Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 119


Client tools use semantic types to represent data in an appropriate format.
8.7.1 Supported Semantic Types
Client tools use semantic types to represent data in an appropriate format.
The SAP HANA modeling environment currently supports the following semantic types:
Amount with Currency Code
Quantity with Unit of Measures
Currency Code
Unit of Measure
Date
Date Business Date From
Date Business Date To
Geo Location - Longitude
Geo Location Latitude
Geo Location - Carto ID
Geo Location Normalized Name
Example
If you have an attribute Price which contains price data of product and another attribute Code which
contains currency format, then you assign the semantic type Currency Code to the attribute Code and
assign the semantic type Amount with Currency Code to the attribute Price.
Note
For semantic types Amount with Currency Code and Quantity with Unit of Measure, you have to
provide additional semantic details for Currency Code and Unit of Measures respectively.
8.8 Manage Broken Objects
You use this functionality to work with the broken models caused due to missing objects. Earlier opening of
broken models was not possible and the model was corrected either by editing its XML file, or by adding the
missing objects. In both the cases you had to remember the details of the missing objects to fix the problems.
Now, you can work with the broken objects using proxies.
With proxies, you can open the broken objects and fix the inconsistencies. After fixing the inconsistencies, you
can activate and use the object like before.
At present the proxies are supported for attribute view, analytic view and calculation view.
The missing required objects are shown with red decorator. The inconsistencies in the objects due to missing
required objects are shown with the red error markers. You can resolve inconsistencies by performing one of
the following:
120
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Additional Functionality for Information Views
Deleting the missing required objects which clears off all the references for the same
Adjusting the mappings of the inconsistent objects
Deleting the inconsistent objects
Note
The inconsistencies found in the model will be logged in the problems view (only in SAP HANA Development
perspective).
Note
If the connection to the SAP HANA system is not available, proxies for all the required objects are injected
and thus it is still possible to view the model. But since the model is not broken actually, the red decorators
and the error markers are not shown. The editor opens in read-only mode.
Example
An attribute view ATV1 is defined on table T1 (C1, C2, C3). Attributes A1, A2, A3 are defined on columns C1,
C2, C3 respectively. If the column C3 is removed from the table T1 then the attribute A3 becomes
inconsistent. In such cases a proxy is injected for C3. When you open the editor, a red LED decorator will be
shown for C3 and an error marker for A3 to indicate that it is inconsistent. The inconsistency can be
resolved by any of the three methods mentioned above.
SAP HANA Modeling Guide
Additional Functionality for Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 121


9 Working with Information Views
9.1 Search Tables, Models and Column Views
You can search for tables, models and column views in any system from the list of systems added in the SAP
HANA Systems view that has all services started, and is up and running.
Context
In the search results, for a matching object you can perform the following actions:
Tables - you can open the table definition and add the table in the analytic view, attribute view, and
calculation view editors.
Note
You can add a table only if the editor is open otherwise it results in error.
Models - you can open the models in the editor and in case of an attribute view, you can add it in the view
editor of analytic and calculation view.
Note
You can add a model only if the editor is open otherwise it results in error.
Column Views - you can open view the definition and add it to the calculation view editor.
Note
You can add a column view only if the editor is open otherwise it results in error.
Note
You can add tables, models, or column views only in case of new view editor also know as, one view editor.
Procedure
1. Enter the object that you want to search in the Modeler toolbar search field.
2. Choose the system in which you want to search the object from the dropdown option next to the Search
button.
122
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Working with Information Views
3. To execute the search, choose Search.
The matching objects are listed in the expanded results pane with three tab pages, Tables, Models, and
Column Views. You can select each to view the matching objects and corresponding actions that you can
perform on them, for example, Open and Add.
9.2 Performance Analysis
Performance analysis panel in the SAP HANA Modeler perspective provides you the information on number of
rows in table, and the information on table partitions. At design time, you can use this information to analyze
the performance of your information views.
Context
The number of rows in a data source, and partitioning a table impacts the performance of your queries. The
Performance Analysis panel in the SAP HANA Modeler perspective provides you with the following information:
Number of rows in a table
You can identify those data sources that have number of rows above a certain threshold. You can
configure the threshold value by choosing Windows Preferences SAP HANA Modeler
Performance Analysis
Table Partitions
1. You can identify the tables that you have partitioned, along with its partition type (Hash, Range, Round
Robin, Multilevel).
2. The columns in a table that you have used for partitioning.
Note
Performance analysis is not supported for script-based calculation views.
Procedure
1. Open an information view in the view editor.
2. Choose the icon to Switch to Performance Analysis Mode. You can switch back to the view editor by
choosing the same icon.
3. Select a node that has data sources from the Scenario panel of your information view.
The Scenario panel displays a warning icon across those tables that have number of rows more than the
threshold value. You can configure the threshold value by choosing Windows Preferences SAP
HANA Modeler Performance Analysis
The Details panel displays the columns in a table and its partition type. For example, the figure below
shows a table with three columns, A, B, C. The column A has a Hash Partitioning at the first level, and is
SAP HANA Modeling Guide
Working with Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 123


also used for Range Partitioning at the second level. Column B has a Hash Partitioning at the first level.
Column C is not partitioned.
4. Choose Performance from the Details panel.
The Data Source Details section in this panel, displays the tables in a data source, the partition type, and
number of rows in the table along with a warning icon across those tables that have number of rows more
than the threshold.
Select a row to view its first level partition details. If you have further partitioned the table, select a row in
the Partition Details section for more information on its second level partitions.
Note
You can switch back to the view editor by choosing the Details button in the Performance Analysis
panel.
9.3 Trace Performance Issues
You use performance tracing to look into the reasons that cause different Modeler operations a longer time to
complete. For example, you may have problems in mass activation of objects and you want to troubleshoot
this problem.
Context
The performance trace contains the information about the total time spent in performing a specific operation
which includes various function calls and their execution. The performance trace log file supports two formats:
CSV- in this format the log file contains entries in the comma separated format. Developers can use
external tools like Microsoft Excel to read the trace in order to troubleshoot the problem.
Simple - in this format the log file contains information in the simple user readable text format.
It is recommended to keep the log file as small as possible by recording the activity or action you want to
troubleshoot. Also, the recommended format for log file is CSV.
124
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Working with Information Views
To start recording a particular action, perform the following:
Procedure
1. Navigate to Window Preference Modeler Logs Performance Trace
2. In Enable Performance Trace dropdown, choose True.
3. Select the format for the log file.
4. Browse the location where you want to save the log file.
By default it is the log file is saved in the eclipse workspace.
5. Choose OK.
6. Perform the activity that you want to troubleshoot.
7. To stop the performance tracer after performing the required activity, in the Enable Performance Trace,
choose False.
9.4 Preview Information View Output
You can view and analyze the data of the information views after they are deployed. You can also view the SQL
query that is generated by the system which results the depicted data, and can even change the query to view
a different result.
Procedure
1. To preview the modeled data of an information view, select one of the following option in the Data Preview
dropdown of the view editor toolbar:
a) If you want to view the content in the Data Preview editor, select
b) If you want to view the content in the SQL editor, select
2. To preview the content of the view that is not open in the editor, perform the following substeps:
a) In the SAP HANA Systems view, expand the Content node of the required system.
b) Select the object from a package for which you want to view the content.
3. From the context menu, choose Data Preview.
Note
The Data Preview editor opens with the modeled content. Form the SAP HANA Systems view you can
only preview data in the Data Preview editor.
SAP HANA Modeling Guide
Working with Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 125


4. Navigate to the required tab page and view the content
9.4.1 Data Preview Editor
You can preview and analyze the output of information views using the Data Preview Editor.
Data Preview Editor - shows the data based on the logic designed in the information view. This editor contains
the following tab pages:
Tab Page Displays Options
Raw Data All attributes along with
data in a table format.
You can filter the data for example to filter data based on
company name.
You can also save the resultant raw data in three file
formats which would be useful if you want to export the
data to another system to analyze.
Show log displays the time elapsed in executing the query
with the resultant query.
Distinct values All attributes along with
data in a graphical
format.
Can be used for basic profiling of data.
Analysis All attributes and
measures in a
graphical format.
Can be used for advanced analysis using the labels and
value axis. For example, to analyze the sales on a country
basis, add Country to the labels axis and Sales to the
value axis.
Can be used for advanced analysis using the labels and
value axis. For example, to analyze the sales on a country
basis, add Country to the labels axis and Sales to the
value axis.
The analysis tab has different types of charts to support
analysis. You can view the data in the Chart, Table, Grid
and HTML formats and add the analysis as favorites.
You can also filter the data for example for a specific
country.
Note
If you refresh the Analysis view, the behavior is as follows:
The data in the Raw Data view gets cleared and you need to perform refresh in the Raw Data view to
fetch the latest data.
Tip
If there are inconsistencies in runtime information (that is, calculation views in catalog or in tables related to
runtime) of a view, you might get invalidated view error. In such cases, you need to redeploy the view in
order to correct the inconsistencies with runtime information.
126
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Working with Information Views
9.4.2 SQL Editor
You can preview and analyze the output of information views along with its SQL query using the SQL Editor.
SQL Editor - shows the data along with the SQL query that resulted the data shown. This editor contains the
following tab pages:
Tab Page Displays...
SQL The auto-generated SQL query.
Note
You can edit and execute the query to view the de
sired output in the Results tab page.
Result The SQL query and the resultant data.
Tip
If there are inconsistencies in runtime information (that is, calculation views in catalog or in tables related to
runtime) of a view, you might get invalidated view error. In such cases, you need to redeploy the view in
order to correct the inconsistencies with runtime information.
9.5 Manage Layout
You use this procedure to adjust the data foundation and logical view layout comprising user interface controls
like, tables and attribute views in a more readable manner. This functionality is supported for attribute views
and analytic views.
The options available are as follows:
Option Purpose Substeps
Auto Arrange Use this option to arrange the user
interface elements automatically.
In the editor tool bar, choose .
Show outline Use this option to view an outline of the
elements arranged so that , you do not
have to navigate in the editor using
horizontal and vertical scrollbars.
In the editor tool bar, choose .
Highlight related tables in Data
Foundation
Use this option if you want to view only
those tables that are related to a table
selected in the editor.
1. In the editor, right-click the
selected table.
2. From the context menu, choose
Highlight related tables.
Display Use this option if you have a table with
a large number of columns in the
1. In the editor, right-click the
relevant table.
SAP HANA Modeling Guide
Working with Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 127


Option Purpose Substeps
editor, and you want to view them in a
way that meets your needs: for
example, only the table name, or only
joined columns, or the expanded form
with all the columns.
2. From the context menu, choose
Display.
3. If you want to view only the table
name, choose Collapsed.
4. If you want to view all the columns
of the table, choose Expanded.
5. If you want to view only the joined
columns of the table, choose Joins
only.
Show Complete Name Use this option to view the complete
name of a truncated column.
1. In the Scenario panel, choose a
view node.
2. In the Details panel, choose the
required input.
3. In the context menu, choose Show
Complete Name.
Show Description Use this option to view the column
description.
1. In the Scenario panel, choose a
view node.
2. In the Details panel, choose the
required input.
3. In the context menu, choose Show
Description.
9.6 Validate Models
You can check if there are any errors in an information object and if the object is based on the rules that you
specified as part of preferences.
For example, the "Check join: SQL" rule checks that the join is correctly formed.
Procedure
1. On the Quick Launch page, choose Validate.
2. From the Available list, select the required models that system must validate, and choose Add.
3. Choose Validate.
9.7 View the Job Log
The job log displays information related to requests entered for a job. A job log consists of two tab pages as
follows:
128
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Working with Information Views
Current: Lists all waiting, running, and last five jobs.
History: Lists all the jobs.
Note
You can terminate the job only if it is in the waiting state.
You can perform the following operations using the job log:
Open Job Details: Use this to view the job summary in the current tab page.
Open Job Log File: Use this to view the information pertaining to a job in detail using the internal
browser.
Clear Log Viewer: Use this to delete all the job from the current tab page.
Export Log File: Use this to export the log file to a target location other than the default location for
further reference.
Delete Job: Use this to delete single job from the current tab page.
9.8 Maintain Search Attributes
You use this procedure to enable an attribute search for an attribute used in a view. Various properties related
to attribute search are as follows:
Freestyle Search: Set to True if you want to enable the freestyle search for an attribute. You can exclude
attributes from freestyle search by setting the property to False.
Weights for Ranking: To influence the relevancy of items in the search results list, you can vary the
weighting of the attribute. You can assign a higher or lower weighting (range 0.0 to 1.0). The higher the
weighting of the attribute, the more influence it has in the calculation of the relevance of an item. Items
with a higher relevance are located higher up the search results list. Default value: 0.5.
Note
To use this setting the property Freestyle Search must be set to True.
Fuzzy Search: This parameter enables the fault-tolerant search. Default: False.
Fuzziness Threshold: If you have set the parameter Fuzzy Search to True you can fine-tune the threshold
for the fault-tolerant search between 0 and 1. Default: 0.8
Note
We recommend using the default values for Weights for Ranking and Fuzziness Threshold to start with.
Later on, you can fine-tune the search settings based on your experiences with the search. You can also
fine-tune the search using feedback collected from your users.
SAP HANA Modeling Guide
Working with Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 129


9.9 Description Mapping
Description mapping helps you to associate an attribute with another attribute, which describes it in detail. For
example, when reporting via a Label Column, you can associate Region_ID with Region_Text.
For an attribute you can now maintain description mapping by selecting another attribute from the same
model as Label Column in the Semantics node. The result is attribute description displaying as the label
column in the data preview. The related columns appear side by side during data preview.
You can rename a label column attribute as <attribute>.description but not as <label column attribute.
description>. For example, if product_text is the Label Column for product then, you can rename product_text
to product.description but not as product_text.description.
Note
On renaming a column as <attribute.description>, it is marked as Hidden and cannot be used in other
places such as calculated columns, input parameters and so on.
If you have created an object using the old editor (which supported the old style of description
mapping) and try to open it using the new editor you will see a new column <attribute>.description (as
an attribute) which is hidden and disabled. You can rename it maintain its properties and use it like
other attributes.
9.10 Group Related Measures
If your analytic view and calculation view has multiple measures and you want to organize them, for, example,
segregate the planned measures with the actual measures, you can group the related measures in folders.
These folders are called the display folders.
You can organize display folders in a hierarchical manner that is, by creating one display folder under the
other.
To create display folders, select the Display Folder toolbar option in the Column panel of the Semantics node.
In the Display Folder dialog create a new folder using the context menu option or using the toolbar option. Drag
the required measures to the relevant folder. Note that one measure can be part of multiple display folders.
Alternatively, you can associate a measure with a new or existing display folder by entering the value in the
Display Folder property of the measure. If you enter a new value for this property a new display folder with the
specified name is created.
Each measure is associated with the Display Folder property. The value for this property contains the fully
qualified name of the display folder in which it appears. The fully qualified name of a display folder consists of
the names of the display folders that represent the path to a given object. If the property contains the name of
more than one display folder, indicating a hierarchy, each name is separated by a backslash character (\). If
this property contains an empty string (""), the object is not associated with a display folder. The same
measure can be part of multiple display folders. In such cases each folders should be separated by a semi
colon (;). For example, if for the measure Invoiced_amount the value for Display Folder property is Reported
\Amount, it means, Reported\Amount is a hierarchical display folder of Invoiced_amount.
130
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Working with Information Views
9.11 Functions used in Expressions
This topic covers the functions that you can use while creating expressions like, calculated attributes and
calculated measures.
Conversion Functions
Function Syntax Purpose Example
int int int(arg) convert arg to int type int(2)
float
float float(arg)
convert arg to float type float(3.0)
double
double double (arg) convert arg to double type double(3)
sdfloat
sdfloat sdfloat (arg)
convert arg to sdfloat type
decfloat
decfloat decfloat (arg)
convert arg to decfloat type
fixed fixed fixed (arg, int, int) arg2 and arg3 are the
intDigits and fractdigits
parameters, respectively.
Convert arg to a fixed type of
either 8, 12, or 16 byte
length, depending on
intDigits and fractDigits
fixed(3.2, 8, 2) + fixed(2.3, 8,
3)
string
string string (arg) convert arg to string type
raw
raw raw (arg) convert arg to raw type
date
date date(stringarg)
date date(fixedarg)
date date(int, int)
date date(int, int, int)
date date(int, int, int, int)
date date(int, int, int, int, int)
date date(int, int, int, int, int,
int)
convert arg to date type. The
first version parses a string
in the format "yyyy-mm-dd
hh:mi:ss" where trailing
components except for the
year may be omitted. The
version with one fixed
number arg strips digits
behind the comma and tries
to make a date from the
rest. The other versions
accept the individual
components to be set.
date(2009) -> date('2009')
date(2009, 1, 2) ->
date('2009-01-02')
date(fixed(2000020313502
6.1234567, 10, 4)) ->
date('2000-02-03
13:50:26')
longdate
longdate
longdate(stringarg)
longdate longdate(fixedarg)
longdate longdate(int, int,
int)
longdate longdate(int, int,
int, int, int)
convert arg to longdate type,
similar to date function
above.
longdate(fixed(2000020313
5026.1234567, 10, 5)) ->
longdate('2000-02-03
13:50:26.1234500')
longdate(2011, 3, 16, 9, 48,
12, 1234567) ->
longdate('2011-03-16
09:48:12.1234567')
SAP HANA Modeling Guide
Working with Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 131


Function Syntax Purpose Example
longdate longdate(int, int,
int, int, int, int)
longdate longdate(int, int,
int, int, int, int, int)
time
time time(stringarg)
time time(fixedarg)
time time(int, int)
time time(int, int, int)
convert arg to time type,
similar to date function
above
String Functions
Function Syntax Purpose
strlen
int strlen(string) returns the length of a string in bytes,
as an integer number.
midstr
string midstr(string, int, int)
returns a part of the string starting at
arg2, arg3 bytes long.
arg2 is counted from 1 (not 0)
leftstr
string leftstr(string, int)
returns arg2 bytes from the left of the
arg1. If arg1 is shorter
than the value of arg2, the complete
string will be returned.
rightstr
string rightstr(string, int)
returns arg2 bytes from the right of the
arg1. If arg1 is shorter
than the value of arg2, the complete
string will be returned.
instr
int instr(string, string)
returns the position of the first
occurrence of the second string
within the first string (>= 1) or 0, if the
second string is not
contained in the first.
hextoraw
string hextoraw(string)
convert a hexadecimal representation
of bytes to a string of
bytes. The hexadecimal string may
contain 0-9, upper or lowercase a-f
and no spaces between the two digits
of a byte; spaces between bytes are
allowed.
132
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Working with Information Views
Function Syntax Purpose
rawtohex
string rawtohex(string)
convert a string of bytes to its
hexadecimal representation.
The output will contain only 0-9 and
(upper case) A-F, no spaces and is
twice as many bytes as the original
string.
ltrim string ltrim(string)
string ltrim(string, string)
removes a whitespace prefix from a
string. The Whitespace characters
may be specified in an optional
argument. This functions operates on
raw bytes of the UTF8-string and has
no knowledge of multi byte codes (you
may not specify multi byte whitespace
characters).
rtrim string rtrim(string)
string rtrim(string, string)
removes trailing whitespace from a
string. The Whitespace characters
may be specified in an optional
argument. This functions operates on
raw bytes of the UTF8-string and has
no knowledge of multi byte codes (you
may not specify multi byte whitespace
characters).
trim string trim(string)
string trim(string, string)
removes whitespace from the
beginning and end of a string.
lpad string lpad(string, int)
string lpad(string, int, string)
add whitespace to the left of a string. A
second string argument specifies the
whitespace which will be added
repeatedly until the string has reached
the intended length. If no second string
argument is specified, chr(32) (' ') will
be added. This function operated on
UTF-8 bytes and has no knowledge of
unicode characters (neither for the
whitespace string nor for length
computation).
rpad string rpad(string, int)
string rpad(string, int, string)
add whitespace to the end of a string.
A second string argument specifies the
whitespace which will be added
repeatedly until the string has reached
the intended length. If no second string
argument is specified, chr(32) (' ') will
be added. This function operated on
UTF-8 bytes and has no knowledge of
unicode characters (neither for the
whitespace string nor for length
computation).
SAP HANA Modeling Guide
Working with Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 133


Function Syntax Purpose
replace
string replace(string, string, string) replace every occurrence of arg2 in
arg1 with arg3 and return the resulting
string
Mathematical Functions
Function Syntax Purpose Example
sign int sign(double)
int sign(time)
int sign(date)
Sign returns -1, 0 or 1
depending on the sign of its
argument. Sign is
implemented for all numeric
types, date and time.
abs double abs(double)
decfloat abs(decfloat)
decfloat abs(decfloat)
time abs(time)
Abs returns arg, if arg is
positive or zero, -arg else.
Abs is implemented for all
numeric types and time.
round
.
double round(double, int) round does rounding of
absolute values toward zer
while the sign is retained
round(123.456, 0) = 123
round(123.456, 1) = 123.5
round(-123.456, 1) = -123.5
round(123.456, -1) = 120
rounddown
double rounddown(double,
int)
rounddown rounds toward
negative infinity making
rounddown(-1.1, 0) = -2
rounddown(123.456, -1) =
120
rounddown(-123.456, -1) =
-130
Date Functions
Function Syntax Purpose
utctolocal
utctolocal(datearg, timezonearg)
interprets datearg (a date, without
timezone) as utc and convert it to the
timezone named by timezonearg (a
string)
localtoutc
localtoutc(datearg, timezonearg) converts the local datetime datearg to
the timezone specified by the string
timezonearg, return as a date
weekday
weekday(date) returns the weekday as an integer in
the range 0..6, 0 is monday.
now
now() returns the current date and time
(localtime of the server timezone) as
date
134
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Working with Information Views
Function Syntax Purpose
daysbetween daysbetween(date1, date2)
daysbetween(daydate1, daydate2)
daysbetween(seconddate1,
seconddate2)
daysbetween(longdate1, longdate2)
returns the number of days (integer)
between date1 and date2. The first
version is an alternative to date2 -
date1.
Instead of rounding or checking for
exactly 24 hours distance, this will
truncate both date values today
precision and subtract the resulting
day numbers, meaning that if arg2 is
not the calendar day following arg1,
daysbetween will return 1 regardless of
the time components of arg1 and arg2.
secondsbetween secondsbetween(seconddate1,
seconddate2)
secondsbetween(longdate1,
longdate2)
returns the number of seconds the
first to the second arg, as a fixed point
number. The returned value is positive
if the first argument is less than the
second. The return values are
fixed18.0 in both cases (note that it
may prove more useful to use fixed11.7
in case of longdate arguments).
component
component(date, int) the int argument may be int the range
1..6, the values mean year, day, month,
hour, minute, second, respectively. If a
component is not set in the date, the
component function will return a
default value, 1 for the month or the
day, 0 for other components. The
component function may also be
applied to longdate and time types.
addseconds addseconds(date, int)
addseconds(seconddate, decfloat)
addseconds(longdate, decfloat)
Return a date plus a number of
seconds. Fractional seconds will also
be used in case of longdate. Null
handling is (in opposition to the default
done with adds) to return null if any
argument is null.
adddays adddays(date, int)
adddays(daydate, int)
adddays(seconddate, int)
adddays(longdate, int)
Return a date plus a number of days.
Null handling is (in opposition to the
default done with adds) to return null if
any argument is null.
Misc Functions
SAP HANA Modeling Guide
Working with Information Views
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 135


Function Syntax Purpose Example
if
if(intarg, arg2, arg3) return arg2 if intarg is
considered true (not equal
to zero), else return arg3.
Currently, no shortcut
evaluation is implemented,
meaning that both arg2 and
arg3 are evaluated in any
case. This means you
cannot use if to avoid a
divide by zero error which
has the side effect of
terminating expression
evaluation when it occurs.
if("NETWR"<=500000,'A',
if("NETWR"<=1000000,'B','
C') )
in
in(arg1, ...) return 1 (= true) if arg1 is
equal to any of the
remaining args, return 0 else
case
case(arg1, default)
case(arg1, cmp1, value1,
cmp2, value2, ..., default)
return value1 if arg1 ==
cmp1, value2 if arg1 ==
cmp2 etc, default if there no
match
case("CATEGORY", 'A', 'LV',
'B', 'MV', 'HV')
isnull
isnull(arg1) return 1 (= true), if arg1 is set
to null and null checking is
on during Evaluator run
(EVALUATOR_MAY_RETUR
N_NULL)
136
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Working with Information Views
10 Managing Objects in SAP HANA Systems
This section describes how you can manage objects within the SAP HANA systems. In addition, it also
describes a few important functions that you can perform on these objects.
10.1 Activate Objects
You activate objects available in your workspace to expose the objects for reporting and analysis.
Based on your requirements, you can do the following:
Activate - Deploys the inactive objects.
Redeploy - Deploys the active objects in one of the following scenarios:
If your runtime object gets corrupted or deleted, and you want to create it again.
In case of runtime problems during object activation, and the object status is still active.
The following activation modes are supported:
Activate and ignore the inconsistencies in affected objects - To activate the selected objects even if it
results in inconsistent affected objects. For example, if you choose to activate an object A that is used by B
and C, and it causes inconsistencies in B and C but you can choose to go ahead with the activation of A.
This is the default activation mode.
Stop activation in case of inconsistencies in affected objects - To activate the selected objects only if there
are no inconsistent affected objects.
Note
If even one of the selected objects fails (either during validation or during activation), the complete
activation job fails and none of the selected objects is activated.
Depending on where you invoke the activation, redeployment or cascade activation, the behavior is as follows:
Context Activate Redeploy
Quick Launch tab page A dialog box appears with a
preselected list of all your inactive
objects.
A dialog box appears with a list of
active objects in your workspace.
Package context menu A dialog box appears with a
preselected list of all your inactive
objects.
A dialog box appears with a list of
active objects in your workspace.
Content context menu A dialog box appears with a
preselected list of all your inactive
objects.
Not applicable
Editor
If you select Save and Activate,
current object is activated and the
affected objects are redeployed if
Not applicable
SAP HANA Modeling Guide
Managing Objects in SAP HANA Systems
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 137


Context Activate Redeploy
an active version for the affected
objects exist.
If you select Save and Activate All,
a dialog box appears with a
preselected list of the selected
object along with all the required
and affected objects.
Object context menu A dialog box appears with a
preselected list of the selected object
along with all the required objects.
A redeployment job is submitted for
the selected object.
Note
If an object is the only inactive object in the workspace, the activation dialog box is skipped and the
activation job is submitted.
If an object is inactive and you want to revert back to the active version, from the editor or object
context menu, choose Revert To Active.
In the Activate dialog, you can select the Bypass validation checkbox in order to skip validation before
activation to improve the activation time. For example, if you have imported many objects and want to
activate them without spending time on validation.
Note
During delivery unit import, full server side activation is enabled, activation of objects after import is done.
In this case all the imported objects are activated (moved to active table), even if there are errors in
activated or affected objects. But the objects for which activation results in error are considered as broken
or inconsistent objects which means that the current runtime representation of these objects is not in sync
with the active design time version. The broken objects are shown in the Navigator view with an x along
side.
Note
The behavior of the activation job is as follows:
The status (completed, completed with warnings, and completed with errors) of the activation job
indicates whether the activation of the objects is successful or failed.
In case of failure that is when the status is completed with errors, the process is rolled back. This
means, even if there are individual objects successfully activated, since the activation job is rolled back,
none of the objects are activated.
If you redeploy a repository view, all privileges that you granted for it are dropped. For the main view,
the system remembers the users and roles that had these privileges, and grants them again at the end
of the activation phase. However, the system does not support this for the hierarchy views. So after
activating each view, you have to again grant the privileges for its hierarchy views. For more
information, see SAP Note 1907697 .
When you open the job log, the summary list shows only those objects that are submitted for
activation. It does not list all the affected objects. They are listed only in detail section.
138
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Managing Objects in SAP HANA Systems
Activation behavior in the view editor
The following table describes the availability and behavior of take over and activate options for an object from
the view editor in the SAP HANA Modeler perspective.
Sce
nario
Ob
ject
in Team Provider in SAP
HANA Sys
tems view
SAP HANA
Systems view
Description
User:
U1,Work
space: WS1
User:
U2,Work
space: WS2
User: U,
Workspace:

(default/
other work
space)
Take
Over
Acti
vate
1 OBJ1 Inactive Inactive Inactive Not
Appli
cable
Al
lowed
If an object has multiple inactive
versions, and the object version in
Modeler is also inactive, for exam
ple, through delivery unit import
or another workspace in Project
Explorer, user can activate his
own inactive object. After activa
tion, the object is the scenario 2
as in the next row.
Note
If the logged-in user and the
user to whom the object be
longs are different, the activa
tion is not allowed. For exam
ple, if the object is inactive in
SYSTEM users workspace and
MB user opens the object, the
object opens in read-only
mode, and the activation is not
allowed.
2 OBJ1 Inactive Inactive Active Not
Al
lowed
Not
Al
lowed
If an object has multiple inactive
versions in the Project Explorer
and the object version in Modeler
is active, neither activation nor
take over option is enabled.
3 OBJ1 Inactive Active Active Al
lowed
Not
Al
lowed
If an object has single inactive ver
sion in the Project Explorer, and
the object version in Modeler is
active, only take over option is en
abled.
SAP HANA Modeling Guide
Managing Objects in SAP HANA Systems
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 139


Sce
nario
Ob
ject
in Team Provider in SAP
HANA Sys
tems view
SAP HANA
Systems view
Description
4 OBJ1 Inactive Active Inactive Not
Appli
cable
Al
lowed
If an object has inactive versions
in the Project Explorer and Mod
eler, only activation option is ena
bled.
5 OBJ1 Active Inactive Active Al
lowed
Not
Al
lowed
If an object has multiple active
versions such as, one in the
Project Explorer and one in the
Modeler, only take over option is
enabled.
6 OBJ1 Active Active Inactive Not
Appli
cable
Al
lowed
If an object has single inactive ver
sion, and the object version in
Modeler is inactive, only activa
tion option is enabled.
7 OBJ1 Active Inactive Inactive Not
Al
lowed
Al
lowed
If an object has single active ver
sion, and the object version in
Modeler is inactive, only activa
tion option is enabled.
8 OBJ1 Active Active Active Not
Appli
cable
(Rede
ploy)
If an object has multiple active
versions, and the object version in
Modeler is active, only take over
activation (redeploy) option is en
abled.
10.2 Copy an Object
You can copy an object in the SAP HANA Systems view and paste it to a required package.
Context
You must have write permissions on the target package where you are pasting the object. The copy-paste
feature is supported for all Modeler objects that is, attribute view, analytic view, calculation view, procedure
and analytic privilege. The object that is copied to the target package is always inactive, even if in the source
package it is in active state.
By default, the keyboard shortcut for copy and paste is CTRL + C and CTRL + V respectively. To enable
keyboard shortcut for copy and paste you must apply the Modeler keyboard shortcuts from the Window
Preferences General Keys and select Modeler as scheme.
140
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Managing Objects in SAP HANA Systems
Note
Copy-paste is supported only for a single object.
Procedure
1. In the SAP HANA Systems view, select an object and in the contect menu, choose Copy.
Note
If you have applied the keyboard shortcuts then you can also press CTRL + C to copy an object.
2. Navigate to the package where you want to paste the object, and choose Paste.
Note
If you have applied the keyboard shortcuts then you can also press CTRL + V to paste an object.
10.3 Manage Broken Objects
You use this functionality to work with the broken models caused due to missing objects. Earlier opening of
broken models was not possible and the model was corrected either by editing its XML file, or by adding the
missing objects. In both the cases you had to remember the details of the missing objects to fix the problems.
Now, you can work with the broken objects using proxies.
With proxies, you can open the broken objects and fix the inconsistencies. After fixing the inconsistencies, you
can activate and use the object like before.
At present the proxies are supported for attribute view, analytic view and calculation view.
The missing required objects are shown with red decorator. The inconsistencies in the objects due to missing
required objects are shown with the red error markers. You can resolve inconsistencies by performing one of
the following:
Deleting the missing required objects which clears off all the references for the same
Adjusting the mappings of the inconsistent objects
Deleting the inconsistent objects
Note
The inconsistencies found in the model will be logged in the problems view (only in SAP HANA Development
perspective).
SAP HANA Modeling Guide
Managing Objects in SAP HANA Systems
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 141


Note
If the connection to the SAP HANA system is not available, proxies for all the required objects are injected
and thus it is still possible to view the model. But since the model is not broken actually, the red decorators
and the error markers are not shown. The editor opens in read-only mode.
Example
An attribute view ATV1 is defined on table T1 (C1, C2, C3). Attributes A1, A2, A3 are defined on columns C1,
C2, C3 respectively. If the column C3 is removed from the table T1 then the attribute A3 becomes
inconsistent. In such cases a proxy is injected for C3. When you open the editor, a red LED decorator will be
shown for C3 and an error marker for A3 to indicate that it is inconsistent. The inconsistency can be
resolved by any of the three methods mentioned above.
10.4 Check Object References
You can view a list of all the objects where an information view is used. You can also determine the view
element references within a view. This is helpful before editing or deleting a view in a distributed development
environment. For example, to check where an input parameter has been used in the current analytic view
before editing it.
142
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Managing Objects in SAP HANA Systems
Procedure
1. To check the references of an information view perform the following:
a. In the Modeler perspective, expand the system node in the SAP HANA Systems view.
b. Expand the Content node.
c. Expand the required package node.
d. Select the required object.
e. From the context menu, choose Where Used.
2. To check the references of view elements like, input parameters, columns, perform the following:
a. Select the element and in the context menu, choose References.
Note
You can also use the <icon> in the Output, Variables/Input Parameters and Columns panel to view
the element references.
10.5 Enable Multilanguage Support for Objects
You use this procedure to enable translation of text pertaining to objects and their elements that did not have
multi-language support.
For example, you can enable multi-language support for models along with their elements like attributes and
measures in different languages.
Procedure
1. From the Quick Launch tab page, choose Migrate.
2. Select the required objects.
3. Choose Add.
4. Choose OK.
Result
Object texts along with the corresponding elements are flagged for translation. These objects can be viewed in
multiple languages provided that the object texts are translated.
SAP HANA Modeling Guide
Managing Objects in SAP HANA Systems
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 143


10.6 Generate Object Documentation
Use this procedure to capture the details of an information model or a package in a single document. This
helps you view the necessary details from the document, instead of referring to multiple tables. The following
table specifies the details that you can view from the document.
Type Description
Attribute View General object properties, attributes, calculated attributes
(that is, calculated columns of type attribute), data
foundation joins, cross references, and where-used
Analytic View General object properties, private attributes, calculated
attributes (that is, calculated columns of type attribute),
attribute views, measures, calculated measures (that is,
calculated columns of type measure), restricted measures
(that is, restricted columns), variables, input parameters,
data foundation joins, logical view joins, cross references,
and where-used
Calculation View General object properties, attributes, calculated attributes,
measures, calculated measures, counters, variables, input
parameters, calculation view SQL script, cross references,
and where-used
Package Sub-packages, general package properties, and list of
content objects
Procedure
1. From the Quick Launch page, choose Auto Documentation.
2. In the Select Content Type field, select one of the following options as required:
Option Description
Model Details To generate documentation for models such as attribute,
analytic, and calculation views.
Model List To generate documentation for packages.
3. Add the required objects to the Target list.
4. Browse the location where you want to save the file.
5. Choose Finish.
144
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Managing Objects in SAP HANA Systems
10.7 Refactor Objects
Context
You use this procedure to restructure your content objects in the SAP HANA Systems view without changing
their behavior. As you move the objects, their references are automatically adjusted. Objects available for
refactoring are, packages, attribute views, analytic views, graphical calculation views, and analytic privileges.
The activation state of the objects from source package to target package is maintained as follows:
At Source At Target
Base Object- active
Impacted Object- active
Base Object- active
Impacted Object- active
Base Object- inactive
Impacted Object- inactive
Base Object- inactive
Impacted Object- inactive
Base Object- active
Impacted Object- inactive
Base Object- active
Impacted Object- active
Base Object- inactive
Impacted Object- active
Base Object- inactive
Impacted Object- inactive
Note
An impacted object (also known as affected object) is the one that uses the base object. For example, an
analytic view using an attribute view is called impacted object for that attribute view.
Procedure
1. Open the Modeler perspective.
2. In the SAP HANA Systems view, expand the Content node.
3. Select the required objects, in the context menu, choose Refactor Move .
4. In the Move dialog, select the target package where you want to move the package/objects, and choose
Next.
5. If you want to skip the movement of objects/packages, in the Changes to be performed panel, deselect
them.
6. Choose Finish.
7. In the Change Tracking dialog, either create a new ID or select the existing change ID. For more
information about Change Tracking, see the section SAP HANA Change Management in the chapter
Implementing Lifecycle Management of the SAP HANA Developer Guide.
SAP HANA Modeling Guide
Managing Objects in SAP HANA Systems
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 145


8. Choose Finish.
146
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Managing Objects in SAP HANA Systems
11 Working with SAP NetWeaver BW Models
This sections describes how you can import and use SAP NetWeaver BW objects, within the modeling
environment, for reporting purposes.
11.1 Import BW Objects
You can import SAP NetWeaver Business Warehouse (SAP NetWeaver BW) models that are SAP HANA-
optimized InfoCubes, Standard DataStore Objects, Query Snapshot InfoProviders, and InfoObjects of type
Characteristics to the SAP HANA modeling environment.
Prerequisites
You have implemented SAP Notes 1703061 , 1759172 , 1752384 , 1733519 , 1769374 , 1790333
, 1870119 , 1994754 , and 1994755 .
You have installed SAP HANA 1.0 SPS 05 Revision 50 or above.
You have added BW schema in the SQL privileges for the Modeler user to import BW models.
_SYS_REPO user has SELECT with GRANT privileges on the schema that contains the BW tables.
Context
You need to import SAP NetWeaver BW objects to expose it as SAP HANA models to the reporting tools.
Note
You can only import those Standard DataStore objects that have SID Generation set to During
Activation.
For an InfoObject you can import Characteristics having key figures as attributes.
Procedure
1. Open the SAP HANA Modeler perspective.
2. In the main menu, choose File Import .
3. Expand the SAP HANA Content node.
4. Choose SAP NetWeaver BW Models, and choose Next.
SAP HANA Modeling Guide
Working with SAP NetWeaver BW Models
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 147


5. Establish connection with your SAP NetWeaver BW system (underlying BW Application Server). Iin the
Provide Source System Detailspage, enter the SAP NetWeaver BW system credentials and choose Next.
Note
To add new connection details, select New Connection option from the Connection dropdown list. The
connection details are saved and are available as dropdown options on subsequent logons.
6. Optional Step: Provide SAProuter String
You can use SAProuter string to connect to the SAP NetWeaver BW System over the internet. You can
obtain the SAProuter string information of your SAP NetWeaver BW system from your SAP Logon. In your
SAP Logon screen, choose your SAP NetWeaver BW system Edit Connection
7. Optional Step: Activate Secure Network Connections (SNC)
Select Activate Secure Network Connections and provide the SNC Name of your communication partner.
You can use SNC to encrypt the data communication paths that exist between a SAP HANA Studio and
your SAP NetWeaver BW system. You can obtain the SNC name of your SAP NetWeaver BW system from
SAP Logon. In your SAP Logon screen, choose your SAP NetWeaver BW system Edit Network
8. Select the target system (an SAP NetWeaver BW on SAP HANA) to, which you want to import the models,
and choose Next.
9. Select the BW InfoProviders that you want to import and expose as SAP HANA information models.
Remember
In order to import the QuerySnapshot InfoProvider, make sure that the BW Query is unlocked in
transaction RSDDB, and an index is created via the same transaction before it can be used as
InfoProviders.
10. Select the target package where you want to place the generated models, and analytic privileges.
Note
Your package selection is saved during the subsequent import. Hence, the next time you visit the same
wizard you get to view the package that was selected previous time. You can though change the
package where you want to import objects.
11. If you want import the selected models along with the display attributes for IMO Cube and Standard DSO,
select Include display attributes.
For InfoObjects all the attributes are added to the output and joined to their text tables if exists.
12. If you want to replace previously imported models in the target system with a new version, select
Overwrite existing objects.
13. If you do not want to import the analysis authorizations associated with the selected InfoProviders,
deselect Generate InfoProvider based analytic privileges.
14. If you want to import the role based analysis authorizations as analytic privileges, select Generate Role
based analytic privileges, and choose Next.
If you have selected both the InfoProviders and InfoObjects, only authorizations set on InfoProviders can
be imported after selecting the checkbox.
15. Select the roles to import the related analysis authorizations.
16. Choose Finish.
148
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Working with SAP NetWeaver BW Models
Results
The generated information models and analytic privileges are placed in the package selected above. In order to
view the data of generated models, you need to assign the associated analytic privileges that are generated as
part of the model import to the user. If these privileges are not assigned, user is not authorized to view the
data.
Related Information
Secure Network Communications (SNC)
11.2 BW InfoProviders as SAP HANA Models
The SAP HANA modeling environment has the capability to expose BW objects as SAP HANA information
models to the reporting tools via SQL and client tools such as, SAP BusinessObjects Explorer, SAP
BusinessObjects BI 4.0 Suite (Web Intelligence via Universes, Dashboards, Crystal Reports), Microsoft Office,
etc.. The metadata of SAP NetWeaver BW models forms the basis for the model properties.
If you select a DataStore object, the resultant SAP HANA model is an analytic view with the same name as that
of the DataStore object. If you select an InfoCube, two objects are created: analytic view and calculation view.
In this case, the name of the calculation view and the analytic view is same as that of the InfoCube, and the
name of the analytic view is suffixed with _INTERNAL. The analytic view generated in the case of an InfoCube is
used internally for the generation of the respective calculation view and is not available for client consumption.
If you select a QuerySnapshot InfoProvider, the SAP HANA model is an analytic view.
If you select an InfoObject Characteristic, the resultant SAP HANA model is an attribute view with the same
name as that of the InfoObject. Both Display and Navigational attributes are included in the generated
attribute view. If the selected characteristic contains time dependent attributes or time dependent text, then
two additional fields DATETO and DATEFROM have the following filters:
Field Filter Operator Filter Value
DATETO Greater Than Equal to $$keydate$$
DATEFROM Less Than Equal to $$keydate$$
The filter value $$keydate$$ is a placeholder for the input parameter. When this attribute view is used in any
analytic view or calculation view, this parameter can be mapped with the input parameter of the same name of
the analytic or calculation view to filter data based on the keydate. The name of the input parameter in the
analytic view or calculation view must be named as keydate.
SAP HANA Modeling Guide
Working with SAP NetWeaver BW Models
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 149


11.3 BW Analysis Authorizations as Analytic Privileges
The SAP HANA Modeler imports BW analysis authorizations as analytic privileges. You can associate these
privileges with the InfoProviders or roles.
You can import the analysis authorizations in the following way:
Only import InfoProvider-specific analysis authorizations. In this case, for all the authorization objects
specific to the InfoProvider having 0CTAIPROV = <InfoProvider name>, the corresponding analytic
privileges are generated. The name of the analytic privilege is the same as that of the BW analysis
authorization object.
You can choose to import analysis authorizations associated with the BW roles for the InfoProviders.
In this case, all the analysis authorizations assigned to the selected roles are merged as one or more
analytic privileges. The name of the generated analytic privilege is <InfoProvider
name>_BWROLE_<number>, such as, MyCube_BWROLE_1.
These analysis authorizations set on the InfoProviders are applicable at runtime for reporting. For example,
consider that a user has the following authorizations in BW:
Table 8: AO1
0CUSTOMER 1000 - 2000
0PRODUCT ABC*
Table 9: AO2
0CTAIPROV CUBE1, CUBE2
0CUSTOMER 3000 - 4000
0CTAACTVT 03 (display)
If only import InfoProvider specific authorizations,on the SAP HANA side, the user will only see
0CUSTOMER from 3000 to 4000.
If import role based authorizations, on the SAP HANA side, the user will see 0CUSTOMER from 1000 to
4000, and 0PRODUCT = ABC*.
Note
In the case of Query Snapshot, all the BW Analysis Authorization objects that are applicable for the
underlying InfoProvider of the query, will also be applicable for the Query Snapshot.
These BW analysis authorization objects will be imported as analytic privileges when importing the
query snapshot.
You can choose to place the generated models and analytic privileges in any of the user-defined packages in
the import wizard any you can enhance the generated models. However, with the subsequent import of the
same objects, the changes are overridden. Also, changes made to the models on the BW side are not
automatically reflected in the generated models. This may lead to inconsistent generated models based on the
changes made to the physical tables. To avoid this, you need to reimport the models.
150
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Working with SAP NetWeaver BW Models
Caution
The calculated key figures (CKFs) and restricted key figures (RKFs) defined on the SAP BW models are
not created for the generated SAP HANA models. In this case, you can create an RKF as restricted
measure in the generated analytic view. For CKF you can create calculated measures in the generated
calculation view or analytic view. These CKFs and RKFs are retained during subsequent import.
Additionally, the calculated attributes created on the generated analytic views (in case of InfoCubes and
DSOs) are also retained during subsequent import. If a change is made to the characteristics or key
figures based on which these restricted measures and calculated measures are created, this may lead
to inconsistency in the generated models. In this case, you need to manually adjust these restricted
measures and calculated measures.
The restricted measures and calculated measures that you define for the analytic view that correspond
to a query snapshot, is overwritten with the subsequent import.
The hierarchies defined on the selected InfoObejcts are not created for the generated SAP HANA
Models. However, you can create calculated attributes and hierarchies on the generated attribute view.
These calculated attributes and hierarchies are not retained during the subsequent import.
The BW analysis authorization objects are not always mapped 1:1 with the generated analytic privileges
on the SAP HANA Modeler side. If the BW Analysis Authorization object does not include 0TCAIPROV,
the authorization is not moved to SAP HANA. Also, restrictions created in the BW analysis authorization
are skipped if they do not match with the restrictions supported by the SAP HANA Modeler. In such
cases, the data available for reporting for a SAP HANA Modeler user differs from the SAP NetWeaver
BW user with the assigned restrictions.
For reporting purposes, data that is visible to a user is:
For a DSO generated analytic view, all the data in the active table is available for reporting.
For an InfoCube generated calculation view, only successfully loaded requests are available for reporting
(these are the green requests in Manage InfoCube section).
Restriction
The following features are not supported on the generated SAP HANA models:
DSO without any key figure
Currency and unit of measure conversion
Note
Only currency mapping is supported and not the conversion.
Time dependent text and attributes
Non-cumulative key figures
Conversion routines in the BW system
Hierarchies
The following features are not supported on generated analytic privileges:
Exclude operator
Undefined operator #
Aggregated value operator :
Variables, User exits
Authorization on Key Figures
SAP HANA Modeling Guide
Working with SAP NetWeaver BW Models
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 151


Authorization on hierarchy node
Exception aggregation such as, average, counter, first value, last value, no aggregation, standard
deviation is not supported for generated measures.
The query name for the Query Snapshot should not be the same as the BW InfoProvider name (this
results in conflict on the SAP HANA side).
Query Snapshot InfoProvider for BOE supports only key figures with aggregation types MIN, MAX,
SUM, and COUNT.
The following features are not supported for InfoObjects:
Info Objects of type Key figures
InfoObjects having Master Data Access as - Own Implementation, Data Access, or SAP HANA
Attribute View
InfoObjects with no master data at all (that is, no P, Q and T tables)
InfoObjects with Time and 0FISC* (Fiscal) characteristics
Hierarchies
Authorizations on InfoObjects
152
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Working with SAP NetWeaver BW Models
12 Working with Decision Tables
This section describes how you can create and manage decision tables.
12.1 Create Decision Tables
You use this procedure to create a decision table to model related business rules in a tabular format for
decision automation. You can use decision tables to manage business rules, data validation, and data quality
rules.
You use this procedure to create a decision table to model related business rules in a tabular format for
decision automation. You can use decision tables to manage business rules, data validation, and data quality
rules, without needing any knowledge of technical languages such as SQL Script or MDX. A data architect or a
developer creates the decision table and activates it. The active version of the decision table can be used in
applications.
Prerequisites
This task describes how to create a decision table. Before you start this task, note the following prerequisites:
You must have access to an SAP HANA system.
To activate and validate the decision table, the _SYS_REPO user requires the SELECT, EXECUTE, and
UPDATE privileges on your schema.
If you are using the SAP HANA Development perspective, you must ensure the following prerequisites are
also met:
You must have already created a development workspace.
You must have checked out a package.
You must have created and shared a project so that the newly created files can be committed to (and
synchronized with) the repository.
Note
For more information about projects, repository workspaces, and sharing of projects, see Using
SAP HANA Projects in SAP HANA Developer Guide.
Create a Decision Table
You can create a decision table by using one of the following options:
If you are in the SAP HANA Modeler perspective, perform the following steps:
SAP HANA Modeling Guide
Working with Decision Tables
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 153


1. In the SAP HANA Modeler perspective, expand <System Name> Content <Package Name> .
2. In the context menu of the package, choose New Decision Table .
3. In the New Decision Table dialog box, enter a name and description for the decision table.
4. To create a decision table from scratch or from an existing decision table, perform the following
substeps:
Scenario Substeps
Create a decision table from scratch
1. Choose Create New.
Note
If you launch the New Decision Table dia
log from the Quick Launch tab page, spec
ify the package where you want to save
the decision table.
2. Choose Finish.
Create a decision table from an existing decision
table
1. Choose Copy From.
Note
If you launch the New Decision Table dia
log from the Quick Launch page, specify
the package where you want to save the
decision table.
2. Browse the required decision table.
3. Choose Finish.
If you are in the SAP HANA Development perspective, perform the following steps:
1. Go to the Project Explorer view in the SAP HANA Development perspective, and select the project.
2. In the context menu of the selected project, choose New Other...
Note
You can also create a decision table from the File menu. Choose New Other...
3. In the popup wizard, open SAP HANA and expand Database Development Modeler .
a. Select Decision Table.
Note
You can also search for the decision table directly by using the search box in the wizard.
b. Choose Next.
a. In the New Decision Table dialog, choose Browse to choose the project under which you want
to create your decision table. Enter a name and description.
154
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Working with Decision Tables
Note
If the project is shared, the Package field specifies the package that is associated with the
project.
b. Choose Finish.
The decision table editor opens. It consists of three panels: Scenario, Details, and Output.
The Scenario panel of the editor consists of the Decision Table and Data Foundation nodes. Selecting any
of these nodes shows the specific node information in the Details panel.
The Details panel of the Data Foundation node displays the tables or information models used for defining
the decision table. The Details panel of the Decision Table node displays the modeled rules in tabular
format.
The Output panel displays the vocabulary, conditions, and actions, and allows you to perform edit
operations. Expand the vocabulary node to display the Parameters, Attributes, and Calculated Attributes
subnodes. In the Output panel, you can also view properties of the selected objects within the editor.
12.1.1 Add Tables, a Table Type, or Information Views
You can add tables, a table type, or an information view to the decision table in any of the following ways
Procedure
1. In the Scenario panel, drag the required table or table type to the Data Foundation node.
Note
In the SAP HANA Development perspective, you can view the physical tables and table types under
Catalog in the SAP HANA System Library. The information views are displayed under Package, and
you need to check out views to use them in decision tables.
In the SAP HANA Modeler perspective, you can view tables and table types under Catalog, while
information views are under Content in Package.
2. Hover over the Data Foundation node and choose the + icon next to the node to search for the object you
want to add.
3. In the context menu of the Scenario panel, choose Add Objects and search for the object you want to add.
4. In the Scenario panel, select the Data Foundation node. In the context menu of the Details panel, choose
Add... and search for the object you want to add.
Note
You can create a decision table by using an analytic view only if it has a calculated attribute.
You can model a decision table on one table type or information view only, or on multiple physical
tables.
SAP HANA Modeling Guide
Working with Decision Tables
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 155


You can mark table type columns and information view columns only as conditions and not as
actions. You can use only parameters as actions.
Remember
You can set the decision table property Mutually Exclusive to True or False. The value of this property is
set to True by default.
If the value is set to True, then the search stops when any condition row is partially matched in the
decision table, even though there might be other rows that could have been fully matched.
If the value is set to False, then all the condition rows are checked from top to bottom and the
action value is updated based on the first match.
For example, consider a scenario where you would like to give a 10% discount on all cold drinks in the
summer season for the country India. The decision table has been modeled as follows:
Country Season Discount
India Summer 10
Winter 9
Any Any 8
If the Mutually Exclusive property is set to True, then the discounts on cold drinks will be calculated as
follows:
Country Season Discount
India Winter 9
India Autumn 0
If the Mutually Exclusive property is set to False, then the discounts on cold drinks will be calculated as
follows:
Country Season Discount
India Winter 9
India Autumn 8
12.1.2 Create Joins
You can join the Decision Tables to each other.
Procedure
1. If you want to model a decision table based on multiple tables, go to the Data Foundation node. In the
context menu of the Details panel, choose Create Join.
156
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Working with Decision Tables
Note
You can also join two tables by linking a column of one table to a column in another table.
2. Enter the required details.
12.1.3 Add Attributes
Procedure
1. In the Details panel of the Data Foundation node, select the required table column.
2. From the context menu of the table column, choose Add as Attribute.
Note
Attributes contain a subset of columns that can be used as conditions, actions, and in calculated
attributes.
To delete attributes from the Attributes node, choose Remove from the context menu of the Output
panel. However, you cannot delete the attributes that are already used as actions or conditions.
12.1.4 Add Conditions and Actions
You can add different conditions and actions on the attributes present in the table.
Procedure
1. In the Output panel, expand the Attributes node and perform the following substeps:
Scenario Substeps
Add conditions from the attributes Select the required attributes and choose Add as
Conditions from the context menu.
Add actions for the selected conditions Select the required attributes and choose Add as Actions
from the context menu.
Note
To delete conditions and actions, choose Remove from the context menu of the Conditions/Actions
node in the Output panel.
You can provide an alias name for a condition or an action by editing the value of the Alias name
property.
SAP HANA Modeling Guide
Working with Decision Tables
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 157


You can choose to create parameters and use them as conditions or actions. If you are using
parameters as conditions, the values you provide for the parameters at runtime determine which
rules are followed when updating the action values. For more information on how to use
parameters, see Use Parameters in a Decision .
You can arrange the condition and action columns of the decision table depending on how you want
them to appear. For more information, see Change Layout of a Decision Table.
12.1.5 Add Conditions and Action Values
Procedure
1. Add Condition Values
a) In the Details panel of the Decision Table node, double-click to edit the cell and enter a value or in the
context menu of the condition cell, choose Add Conditions Values or Set Dynamic Value .
b. Enter a value and choose OK.
Note
The supported data types for an operator are:
Operator Supported Data Types Syntax
Not Equal To Number & CHAR-based != ABC
In Number & Char-based
In 'ABC';'CDA'
In 1;2
Note
The syntax of "In" operator
contains different formats
for enumeration or string
etc.
Not In Number & Char-based Not In A;B;C
Like CHAR-based Like Abc*
Not Like CHAR-based Not Like Abc*
Greater Than
Greater Than or Equals
Number & CHAR-based
>20
>=20
Less Than
Less Than or Equals
Number & CHAR-based
<10
<=10
Between Number Between 20 and 30
158
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Working with Decision Tables
Operator Supported Data Types Syntax
Note
The values include 20 and
30.
Before Date Dates
Before 2012-12-12
Or
< 2012-12-12
After Date Dates
After 2012-12-12
Or
> 2012-12-12
Between Date Dates Between 2012-12-12 and
2012-12-25
Note
And & Or operator are supported for all data types except string data type.
If the supported data type of the condition column is CHAR-based, you must put IN and the
associated value in quotation marks. This ensures that IN is not considered as an operator. For
example, IN PROCESS is a value, whereas IN PROCESS without quotation marks reflects IN
as an operator and PROCESS as a value
.
Note
If a database table column is used as a condition, you can use the value help dialog to select the
condition values. You can select multiple values at one time. You can edit a condition value by
selecting the condition and entering a value.
You can enter a pattern for the condition values that have the data type VARCHAR. The pattern
must be prefixed with the LIKE and NOT LIKE operators, for example, LIKE a*b or NOT LIKE a?
b. If the LIKE or NOT LIKE operator is not present, the pattern is treated as a string.
2. Add Action Values
a) In the Details panel of the Decision Table node, double-click to edit the cell and enter a value or in the
context menu of the action cell, select Set Dynamic Value and enter a value.
3. Add a Complex Expression
a) If you want to write a complex expression as an action or condition value, Right-click the action field.
b) From the context menu, choose Set Dynamic Value.
c) Write the expression in the pop-up. for example, PRICE-(PRICE*0.1).
SAP HANA Modeling Guide
Working with Decision Tables
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 159


Note
The expression can contain a combination of:
Even number of open and close braces
Arithmetic operators (+, -, *, /)
Dynamic Value consists of Attributes, Parameters and Calculated Attributes of same type
d) To edit a value, you need to select that value.
Note
You can use parameters and attributes of the same data type as that of the action or condition in
expressions. For example, if the data type of the condition is integer, then all parameters and
attributes of the integer data type can be used in the condition expression.
4. Use Table Data through Value Help
a) To assign a value to a condition or an action based on the table data, choose Open Value Help Dialog.
b) In the Value Help for Column dialog, enter the search string, and choose Find.
Note
If you do not provide a value for the search and choose Find, all the data corresponding to the
selected column is shown.
c) Select a value, and choose OK.
Note
You can export decision table data to an Excel sheet by using the context menu option Export Data
to Excel in the Details panel of the Decision Table node. You can also import decision table data
from the Excel by using the context menu option Import Data from Excel in the Details panel of the
Decision Table node.
12.1.6 Optional Step: Validate Decision Table
Procedure
1. To set the rules that you want to use for validation, do the following:
a) Choose Window Preferences .
b) In the Preferences dialog box, expand SAP HANA Modeler Validation Rules .
c) In the Validation Rules view, select the Decision Table checkbox to check for all the rules during
validation
d) If you want to check for individual rules, select the required rules.
e) Choose OK
2. In the decision table editor, choose Validate in the editor toolbar
160
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Working with Decision Tables
Note
In the Job Log section, you can see the validation status and detailed report of the decision table.
Note
In the SAP HANA Development perspective, only client-side validation will occur. However, in the SAP
HANA Modeler perspective, both client- and server-side validation occurs.
12.1.7 Activate Decision Table
Activate the decision table by using one of the following options:
If you are in the SAP HANA Modeler perspective, do the following as required:
Save and Activate - Activates the current decision table.
Save and Activate All - Activates the current decision table along with the required objects.
If you are in the SAP HANA Development perspective, do the following:
1. In the Project Explorer view, select the required object.
2. From the context menu, select Team Commit .
3. From the context menu, select Team Activate .
Note
You can choose to save and activate the view from the editor by using .
The activation always triggers the validation check for the server-side rules. However, if you have
selected validation rules in the Preferences dialog box, then the client-side validation is also triggered.
Result: Upon successful activation, a procedure corresponding to the decision table is created in the _SYS_BIC
schema. The name of the procedure is in the format <package name>/<decision table name>. In addition, if a
parameter is used as an action in the decision table, the corresponding table type is created in the _SYS_BIC
schema. The name of the table type is in the format <package name>/<decision table name>/TT.
Remember
If parameters are used as conditions in a decision table, corresponding IN parameters are generated. Also,
if the parameters are used as actions, an OUT parameter is generated.
12.1.8 Execute Decision Table Procedure
To execute the decision table procedure, perform the following steps as required:
SAP HANA Modeling Guide
Working with Decision Tables
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 161


Data Source Condition Action Script
Physical tables Physical table
column
Physical table col
umn
call "<schema name>"."<procedure
name>";
Physical tables Parameters Physical table col
umn
call "<schema name>"."<procedure
name>"(<IN parameter>,,<IN
parameter>);
Physical tables Physical table
column
Parameters call "<schema name>"."<procedure
name>"(?);
Physical tables Parameters Parameters call "<schema name>"."<procedure
name>"(<IN parameter>,,<IN
parameter>,?);
Information
View
View attributes Parameters call "<schema name>"."<procedure
name>"(?);
Information
View
Parameters Parameters call "<schema name>"."<procedure
name>"(<IN parameter>,,<IN
parameter>,?);
Table Type Table type col
umn
Parameters call "<schema name>"."<procedure
name>"(<IN table type>,?);
Table Type Parameters Parameters call "<schema name>"."<procedure
name>"(<IN parameter>,,<IN
parameter>,?);
Remember
The order of the parameters while executing the procedure must be the same as in the Output panel, and
not as used in the decision table.
Tip
You can view the procedure name by using the Open Definition context menu option for the selected
procedure.
Result: Upon execution of the procedure, the physical table data is updated (if no parameters are used), based
on the data that you enter in the form of condition values and action values.
Remember
If parameters are being used as actions in a decision table, the physical table is not updated.
12.2 Changing the Layout of a Decision Table
You use this procedure to change the decision table layout by arranging the condition and action columns. By
default, all the conditions appear as vertical columns in the decision table. You can choose to mark a condition
162
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Working with Decision Tables
as a horizontal condition, and view the corresponding values in a row. The evaluation order of the conditions is
such that the horizontal condition is evaluated first, and then the vertical ones.
Note
You can only change the layout of a decision table if it has more than one condition. You can mark only one
condition as a horizontal condition.
Procedure
Mark as Horizontal Condition
1. Select the Decision Table node.
2. In the context menu of the Details panel, choose Change Layout.
3. If you want to view a condition as a horizontal condition, in the Change Decision Table Layout dialog, select
the Table Has Horizontal Condition (HC) checkbox.
Note
The first condition in the list of conditions is marked as horizontal by default.
4. Choose OK.
5. Save the changes.
Note
You can also set a condition as horizontal from the context menu of the condition in the Output panel.
You can also arrange the conditions and actions in the desired sequence in the Output panel by using
the navigation buttons in the toolbar.
Rearranging Conditions and Actions
1. Select the Decision Table node.
2. In the context menu of the Details panel, choose Change Layout.
3. In the Conditions and Actions section, choose the options on the right-hand side of the dialog box to
arrange the conditions and actions in the desired sequence.
The following options are available for arranging the conditions in a sequence:
Move Condition to Top
Move Condition Up
Move Condition Down
Move Condition to Bottom
SAP HANA Modeling Guide
Working with Decision Tables
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 163


Note
You can also arrange the sequence by using the navigation buttons at the top of the Output panel.
12.3 Use Parameters in a Decision Table
You use this procedure to create a parameter that can be used to simulate a business scenario.
Procedure
1. Create a Parameter
a) In the Output panel, select the Parameters node.
b) From the context menu, choose New and Enter a name and description.
c) Select the required data type from the dropdown list
d) Enter the length and scale as required.
e) Choose the required Type from the dropdown list.
Note
If you have selected Static List for Type, choose Add in the List of Values section to add values. You
can also provide an alias for the enumeration value.
a) Choose OK.
2. Use Parameter as Condition or Action
a) In the Output panel, select the Parameters node.
b) From the context menu of the parameter, choose Add as Conditions/ Add as Actions.
12.3.1 Supported Parameter Types
Parameters are used to simulate a business scenario.You can use parameters as conditions and actions in the
decision table at design time. Parameters used as conditions determine the set of physical table rows to be
updated based on the parameter value that you provide at runtime during the procedure call. Parameters used
as actions simulate the physical table without updating it.
The following parameter types are supported:
Type Description
Static List Use this if the value of a parameter comes from a user-
defined list of values.
164
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Working with Decision Tables
Type Description
Empty Use this if the value of a parameter could be any of the
selected data types.
Example
Consider a sales order physical table with column headers as follows:
ID Name Supplier Model Price Quantity
If you want to evaluate Discount based on the Quantity and Order Amount, you can create two parameters:
Order Amount and Discount. Use Quantity and Order Amount as the condition, and Discount as the action.
The sample decision table could look like this:
Quantity Order Amount Discount
>5 50000 10
>=10 100000 15
12.4 Use Calculated Attributes in Decision Tables
You use this procedure to create calculated attributes that can be used as conditions in a decision table.You
can create a calculated attribute to perform a calculation using the existing attributes, parameters, and SQL
functions.
Procedure
1. In the Output panel, select the Calculated Attributes node.
2. From the context menu, choose New and do the following:
a) Enter a name and description.
b) Select the required data type, length, and scale.
c) The standard string functions that are present in the wizard can be used for string data types and any
other format would be interpreted as a full String. Example, NAME = FIRST_NAME +
LAST_NAME or Alert For ATTRIBUTE would not be considered as expressions, but are interpreted
as string.
Note
We do not support dynamic expressions for string data types.
You can also create the expression by dragging and dropping the expression elements from the
options at the bottom of the editor. Only arithmetic operators and SQL functions are supported
for expression creation.
SAP HANA Modeling Guide
Working with Decision Tables
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 165


3. Choose OK.
4. Add the required calculated attribute as a condition.
166
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Working with Decision Tables
13 Managing Object Versions
This sections describes on how you can manage active and inactive versions of objects in SAP HANA modeling
environement.
13.1 Switch Ownership of Inactive Objects
Use this procedure to take over the ownership of the inactive version of an object from other users' workspace.
Objects in edit mode in other workspaces are not available for modification. In order to modify such objects
you need to own the inactive object.
The options available for changing the inactive object ownership are as follows:
Option Purpose
Switch Ownership To take over multiple inactive objects from other users.
Inactive objects that do not have an active version are also
available for take over using this option
Take Over To take a single inactive object from another workspace
that you wish to edit using the editor.
Note
Using this functionality you can only own the inactive version of the object. The active version is owned by
the user who created and activated the object.
Prerequisite
You have obtained the Work in Foreign Workspace authorization.
Procedure
1. If you want to own multiple inactive objects from other workspaces, do the following:
a. In the Quick Launch page, choose Switch Ownership.
b. In the Source User field, select the user who owns the inactive objects.
c. Add the required inactive objects to the Selected Models section.
d. Choose OK.
2. If an object opens in read only mode and you want to edit it, do the following:
a. In the editor toolbar, select Switch Version.
b. Choose Take Over.
SAP HANA Modeling Guide
Managing Object Versions
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 167


Note
You can choose to save the changes made by the other user (previous owner of the inactive
version) to the inactive version of the object.
13.2 Toggle Versions of Content Objects
You use this procedure to view the active version of an information object while working with its inactive
version for example, to view the changes made to the active version.
Procedure
1. In the Modeler perspective, expand the Content node of the required system.
2. Select the required object from a package.
3. From the context menu, choose Open.
4. In the editor pane, choose Show Active Version.
5. Compare the inactive and active versions of the object.
6. Choose OK.
13.3 View Version History of Content Objects
You use this procedure to view the version details of an information model for tracking purposes.
Procedure
1. In the Modeler perspective, expand the Content node of the required system.
2. Select the required object from a package.
3. From the context menu, choose History.
168
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved.


SAP HANA Modeling Guide
Managing Object Versions
Important Disclaimers on Legal Aspects
This document is for informational purposes only. Its content is subject to change without notice, and SAP does not warrant that it is error-free. SAP MAKES NO
WARRANTIES, EXPRESS OR IMPLIED, OR OF MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
Coding Samples
Any software coding and/or code lines / strings ("Code") included in this documentation are only examples and are not intended to be used in a productive system
environment. The Code is only intended to better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and
completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, unless damages were caused by SAP
intentionally or by SAP's gross negligence.
Accessibility
The information contained in the SAP documentation represents SAP's current view of accessibility criteria as of the date of publication; it is in no way intended to be
a binding guideline on how to ensure accessibility of software products. SAP specifically disclaims any liability with respect to this document and no contractual
obligations or commitments are formed either directly or indirectly by this document.
Gender-Neutral Language
As far as possible, SAP documentation is gender neutral. Depending on the context, the reader is addressed directly with "you", or a gender-neutral noun (such as
"sales person" or "working days") is used. If when referring to members of both sexes, however, the third-person singular cannot be avoided or a gender-neutral noun
does not exist, SAP reserves the right to use the masculine form of the noun and pronoun. This is to ensure that the documentation remains comprehensible.
Internet Hyperlinks
The SAP documentation may contain hyperlinks to the Internet. These hyperlinks are intended to serve as a hint about where to find related information. SAP does
not warrant the availability and correctness of this related information or the ability of this information to serve a particular purpose. SAP shall not be liable for any
damages caused by the use of related information unless damages have been caused by SAP's gross negligence or willful misconduct. Regarding link classification,
see: http://help.sap.com/disclaimer.
SAP HANA Modeling Guide
Important Disclaimers on Legal Aspects
PUBLI C

2014 SAP SE or an SAP affiliate company. All rights reserved. 169


www.sap.com/contactsap

2014 SAP SE or an SAP affiliate company. All rights reserved.


No part of this publication may be reproduced or transmitted in any
form or for any purpose without the express permission of SAP SE
or an SAP affiliate company. The information contained herein may
be changed without prior notice.
Some software products marketed by SAP SE and its distributors
contain proprietary software components of other software
vendors. National product specifications may vary.
These materials are provided by SAP SE or an SAP affiliate company
for informational purposes only, without representation or warranty
of any kind, and SAP or its affiliated companies shall not be liable for
errors or omissions with respect to the materials. The only
warranties for SAP or SAP affiliate company products and services
are those that are set forth in the express warranty statements
accompanying such products and services, if any. Nothing herein
should be construed as constituting an additional warranty.
SAP and other SAP products and services mentioned herein as well
as their respective logos are trademarks or registered trademarks
of SAP SE (or an SAP affiliate company) in Germany and other
countries. All other product and service names mentioned are the
trademarks of their respective companies.
Please see http://www.sap.com/corporate-en/legal/copyright/
index.epx for additional trademark information and notices.

Você também pode gostar