Anda di halaman 1dari 142

PUBLIC

SAP HANA Platform SPS 07


Document Version: 1.1 - 13-03-2014
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 Required Permissions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12
3.2 Adding a System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.3 SAP HANA Studio. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.3.1 Quick Tour: Modeler Perspective. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.4 Creating a View. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.4.1 Attributes and Measures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4 Importing Table Definitions and Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.1 Importing Table Definitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.2 Loading Data into Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2.1 Suspending and Resuming Data Load. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.2.2 Uploading Data from Flat Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.3 Copying Content Delivered by SAP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.4 Mapping the Authoring Schema to the Physical Schema. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.4.1 Changing Authoring Schemas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34
4.5 Generating Time Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5 Setting Up the Modeling Environment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.1 Setting Modeler Preferences. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.2 Setting Keyboard Shortcuts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.3 Applying Filters to Packages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.4 Applying Filter to Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6 Information Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
6.1 Creating Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
6.2 Attribute Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
6.2.1 Creating Attribute Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
6.3 Analytic Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
6.3.1 Creating Analytic Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.4 Calculation Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
6.4.1 Creating a Script-Based Calculation View. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
2
PUBLI C

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


SAP HANA Modeling Guide
Table of Contents
6.4.2 Creating a Graphical Calculation View. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
6.5 Creating Analytic Privileges. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
6.6 Importing BW Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
6.7 Activating Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
6.8 Description Mapping. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
6.9 Display Folders. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
7 Additional Functionality for Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .92
7.1 Creating Level Hierarchies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
7.2 Creating Parent-Child Hierarchies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
7.3 Creating Input Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
7.4 Assigning Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
7.5 Using Currency and Unit of Measure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
7.6 Working with Broken Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
7.7 Assigning Default Client. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
7.8 Assigning Semantics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
8 Working with Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
8.1 Managing Layout. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
8.2 Validating Models. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
8.3 Viewing the Job Log. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
8.4 Maintaining Search Attributes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
8.5 Previewing View Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
8.6 Functions used in Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
8.7 Searching Tables, Models and Column Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
8.8 Copying an Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
8.9 Tracing Performance Issues. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
9 Creating Decision Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
9.1 Changing the Layout of a Decision Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
9.2 Using Parameters in a Decision Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
9.3 Using Calculated Attributes in Decision Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
10 Managing Object Versions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
10.1 Switching Ownership of Inactive Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
10.2 Toggling Versions of Content Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .135
10.3 Viewing Version History of Content Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
11 Managing Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
11.1 Checking Object References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
11.2 Enabling Multilanguage Support for Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
11.3 Generating Object Documentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
11.4 Refactoring Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
SAP HANA Modeling Guide
Table of Contents
PUBLI C

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


12 Important Disclaimers on Legal Aspects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
4
PUBLI C

2014 SAP AG 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 AG 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 AG 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 AG 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 AG 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 AG or an SAP affiliate company. All rights reserved. 9


3 Getting Started
The figure below shows the process flow 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
are able to
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
You can perform the following tasks in the Modeler perspective:
Import metadata
Create tables by importing the table definitions from the source systems using the Data Services
infrastructure. For more information, see Importing Table Definitions.
10
PUBLI C

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


SAP HANA Modeling Guide
Getting Started
Note
You can also create tables from scratch using the SAP HANA Development perspective. For more
information, 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 Loading
Data into Tables.
Note
You can also provision data into the table definitions in the SAP HANA Development perspective. For more
information, see Setting Up the Persistence Model in the SAP HANA Developer Guide.
Create packages
Logically group objects together in a structured way. For more information, see Maintaining Repository
Packages in the SAP HANA Developer Guide.
Create information views
Model various slices of the data stored in the SAP HANA database. Information views are often used for
analytical use cases, such as operational data mart scenarios or multidimensional reporting on revenue,
profitability, and so on. For more information, see Information Views .
Note
You can also create information views in the SAP HANA Development perspective. For more information,
see Setting Up the Analytic Model in the SAP HANA Developer Guide.
Create procedures
Create procedures using SQLScript for implementing 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 Creating Analytic Privileges [page 78].
Note
For detailed information regarding the SAP HANA database authorization mechanisms, see Setting Up
Roles and 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 Importing BW Objects.
Create decision tables
Create a tabular representation of related rules using conditions and actions. For more information, see
Creating Decision Tables.
Import and export objects
Import and export the content objects from and to the client and server location. For more information about
the import and export mechanisms, see Implementing Lifecycle Management in the SAP HANA Developer
Guide.
SAP HANA Modeling Guide
Getting Started
PUBLI C

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


Note
The SAP HANA Systems view of the SAP HANA Modeler perspective lists both the atcive and inactive
objects from the default workspace. Also, in the SAP HANA Modeler perspective, the objects can be
created, edited, and saved only when no other inactive version exists.
The object types listed below are supported in the 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, that is, they are opened in the simple text editor using the Modeler perspective. They can be
opened in respective editors only in other perspectives such as SAP HANA Development or Administration
and Monitoring, and so on.
3.1 Required Permissions
You need a minimum set of permissions to perform the modeling activities like, create, activate, and data-preview
on views and analytic privileges.
SQL Privileges
1. _SYS_BI - SELECT privilege
2. _SYS_BIC - SELECT privilege
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.
12
PUBLI C

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


SAP HANA Modeling Guide
Getting Started
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
3.2 Adding a System
To create modeling objects, you must first make a connection from your SAP HANA studio to an SAP HANA
system.
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
To ensure a secure connection, you have to disconnect instances of all SAP HANA systems in the SAP HANA
Studio, after you have completed working on an instance. To disconnect a specific SAP HANA instance:
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 AG or an SAP affiliate company. All rights reserved. 13


3.3 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 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.3.1 Quick Tour: Modeler Perspective
The Modeler perspective is used to define your analytic model by creating various types of views.
14
PUBLI C

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


SAP HANA Modeling Guide
Getting Started
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.
Where-Used view: A view that list down all the objects where the selected object has been used.
3.3.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.
SAP HANA Modeling Guide
Getting Started
PUBLI C

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


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 emote 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.
3.3.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 know 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:
16
PUBLI C

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


SAP HANA Modeling Guide
Getting Started
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
SAP HANA Modeling Guide
Getting Started
PUBLI C

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


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.
18
PUBLI C

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


SAP HANA Modeling Guide
Getting Started
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.
SAP HANA Modeling Guide
Getting Started
PUBLI C

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


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.4 Creating a View
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. 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.
Context
Attribute Views
Attribute views are used to model an entity based on the relationships between attribute data contained in
multiple source tables.
20
PUBLI C

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


SAP HANA Modeling Guide
Getting Started
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
Note
For more information about the attributes and hierarchies mentioned above, see Attributes and Measures,
Creating Parent-Child Hierarchies and Creating Level 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.
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.
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.
SAP HANA Modeling Guide
Getting Started
PUBLI C

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


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 simply 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. For more information about the attributes and
measures mentioned above, see Attributes and Measures.
Variables
Input parameters
Note
For more information about the variables and input parameters mentioned above, see Assigning Variables
and Creating 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 attribues 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
22
PUBLI C

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


SAP HANA Modeling Guide
Getting Started
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)
Note
For more information about the attributes, measures, counters, and hierarchies, see Attributes and
Measures, Creating Parent-Child Hierarchies and Creating Level Hierarchies.
Variables
Input parameters
Note
For more information about the variables and input parameters mentioned above, see see Assigning
Variables and Creating 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 SQL
script . 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.
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
SAP HANA Modeling Guide
Getting Started
PUBLI C

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


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.
Procedure
1. Open the Modeler perspective.
2. To set the view parameter, perform the steps in Creating Views [page 43].
The view editor opens where you can define the input elements of the view and its output structure.
3. To design a view that can be used for analytical purposes, see Information Views [page 43].
3.4.1 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.
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 used 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 are
consuming 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.
24
PUBLI C

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


SAP HANA Modeling Guide
Getting Started
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, calculated measures can be used 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.
SAP HANA Modeling Guide
Getting Started
PUBLI C

2014 SAP AG 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 Importing 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 AG 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 Loading 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 Importing Table
Definitions [page 26]Importing Table Definitions.
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 AG 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 AG 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 Suspending and Resuming 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.
4.2.2 Uploading 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.
SAP HANA Modeling Guide
Importing Table Definitions and Data
PUBLI C

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


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.
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) ChooseNext.
b) On the Manage Table Definition and Data Mapping screen, map the source and target columns.
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.
30
PUBLI C

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


SAP HANA Modeling Guide
Importing Table Definitions and Data
9. Enter a value in the Default Value column to provide a default value for a column at the target. ChooseFinish.
4.3 Copying Content Delivered by SAP
You can copy the standard content shipped by SAP or an SAP partner to your local package for your 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 copy the content shipped by SAP or an SAP partner to your local package to avoid
overwriting your changes during the subsequent import.
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, and choose Next.
Tip
If you want to create more package mapping, select the source and target packages as required. To copy
the objects, you need to map the source root packages to the target root packages.
4. Select the required objects, and choose Add.
SAP HANA Modeling Guide
Importing Table Definitions and Data
PUBLI C

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


Caution
If you copy an object, but not its dependent objects, the copied object in the target package will have
references to the dependent objects in the source package.
5. Choose Next to view the summary and choose Finish to confirm content copy.
Tip
You can deselect an object to avoid copying it to the target package.
Next Steps
You need to activate the copied objects in the target package to consume them for reporting purposes.
4.4 Mapping the 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.
Caution
An authoring schema name should not be equal to the physically existing schema name.
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.
32
PUBLI C

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


SAP HANA Modeling Guide
Importing Table Definitions and Data
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.
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.
SAP HANA Modeling Guide
Importing Table Definitions and Data
PUBLI C

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


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 Changing 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 admininistrator
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.
34
PUBLI C

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


SAP HANA Modeling Guide
Importing Table Definitions and Data
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
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 1: 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 2: Schema Mapping
Authoring Schema Physical Schema
AS1 PS1
AS2 PS1
AS3 PS1
4.5 Generating 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.
SAP HANA Modeling Guide
Importing Table Definitions and Data
PUBLI C

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


Context
If you model a time attribute view without generating time data andyou 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 he calendar year,for example, January to December, chooseGregorianin 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 asthecalendar year, for example, March to April, select Fiscalin 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.
36
PUBLI C

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


SAP HANA Modeling Guide
Importing Table Definitions and Data
c) Select the required variant that specifies the number of periods, along with their start and end dates,
according to your use case.
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
SAP HANA Modeling Guide
Importing Table Definitions and Data
PUBLI C

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


5 Setting Up the Modeling Environment
5.1 Setting Modeler Preferences
You can set modeling preferences to thedefault settings that the system uses when you log on.
Procedure
1. Choose Window Preferences SAP HANA Modeler .
Note
You can also set the preferences choosing Quick Launch Manage Preferences
2. Identify the required preference and perform the corresponding steps:
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
38
PUBLI C

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


SAP HANA Modeling Guide
Setting Up the Modeling Environment
Requirement Preference Substeps
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.
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 will be used while previewing
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.
SAP HANA Modeling Guide
Setting Up the Modeling Environment
PUBLI C

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


Requirement Preference Substeps
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.
3. Choose Apply and OK.
5.2 Setting Keyboard Shortcuts
You can enable keyboard shortcuts for modeling actions such as, activate and validate.
The supported commands with the default keyboard shortcuts are as follows:
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: History) 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
Validate Ctrl+Shift+V Navigator Modeler Keys
40
PUBLI C

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


SAP HANA Modeling Guide
Setting Up the Modeling Environment
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
Note
By default all the modeler key board shortcuts are available in the default scheme. You cannot add new
commands, but you can customize the commands as follows:
Copy Command - to provide a different keyboard shortcut for an existing command.
Unbind Command - to clear the key bindings with the command and provide a new keyboard shortcut for
an existing command.
Restore Command - to restore the default key bindings provided by the Modeler for an existing command.
5.3 Applying Filters to Packages
In SAP HANA Systems view you can choose to filter the content and view packages that you want to work with. If
you apply a filter at the package level, all the packages including subpackages that satisfies the filter criteria are
shown. 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
chooseOK.
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.4 Applying 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.
SAP HANA Modeling Guide
Setting Up the Modeling Environment
PUBLI C

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


Context
Procedure
1. In the SAP HANA Systems view, expand Content.
2. In the context menu of a package, choose Filter Objects....
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.
42
PUBLI C

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


SAP HANA Modeling Guide
Setting Up the Modeling Environment
6 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. All three types of information views are non-materialized views.
This creates agility through the rapid deployment of changes.
6.1 Creating Views
You can create information views to depict a business scenario using content data that is, attributes and
measures. These views can be used for analysis and decision making.
Context
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 at
tributes.
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 variant schema, and a fiscal var
iant.
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.
SAP HANA Modeling Guide
Information Views
PUBLI C

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


Scenario Procedure
Note
The system creates a time attribute view based on the default time ta
bles, and defines the appropriate columns or attributes based on the
granularity. It also creates the required filters.
Note
The tables used for time attribute creation with calendar type Gregorian
are, M_TIME_DIMENSION, M_TIME_DIMENSION_ YEAR, M_TIME_DIMEN
SION_ MONTH, M_TIME_DIMENSION_WEEK and for calendar type Fiscal is
M_FISCAL_CALENDAR. If you want to do a data preview for the created at
tribute 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 exist
ing 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.
44
PUBLI C

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


SAP HANA Modeling Guide
Information Views
6. Choose Finish. The editor opens with the new view.
To view the definition of Information views that you have already created, choose the 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.2 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 could 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.
6.2.1 Creating 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.
SAP HANA Modeling Guide
Information Views
PUBLI C

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


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.
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 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:
46
PUBLI C

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


SAP HANA Modeling Guide
Information Views
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 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 '?' ques
tion 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 Pattern filter with value A*. This would
show the data for all the continents 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.
SAP HANA Modeling Guide
Information Views
PUBLI C

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


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
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.
48
PUBLI C

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


SAP HANA Modeling Guide
Information Views
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.
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 .
SAP HANA Modeling Guide
Information Views
PUBLI C

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


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 .
Related Information
Creating Level Hierarchies [page 92]
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.
Creating Parent-Child Hierarchies [page 94]
A parent-child hierarchy is defined using a parent attribute that determines the relationship between the view
attributes. A parent attribute describes a self-referencing relationship, or self-join, within the main table.
Activating Objects [page 87]
You activate objects available in your workspace to expose the objects for reporting and analysis.
Generating Time Data [page 35]
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 90]
Description mapping helps you to associate an attribute with another attribute, which describes it in detail. For
example, when reporting via Label Column , you can associate Region_ID with Region_Text.
50
PUBLI C

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


SAP HANA Modeling Guide
Information Views
6.3 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.
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.
SAP HANA Modeling Guide
Information Views
PUBLI C

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


Caution
In this case, if this flag is set counters and SELECT COUNT may deliver wrong results
6.3.1 Creating Analytic Views
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 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.
52
PUBLI C

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


SAP HANA Modeling Guide
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 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.
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 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
SAP HANA Modeling Guide
Information Views
PUBLI C

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


Filter Operator Description
Contains Pattern To filter and show data that matches the pattern
specified in the filter value. You can use '?' ques
tion 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 Pattern filter with value A*. This would
show the data for all the continents 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.
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 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. Create Calculated Column (Optional)
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.
54
PUBLI C

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


SAP HANA Modeling Guide
Information Views
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.
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.
SAP HANA Modeling Guide
Information Views
PUBLI C

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


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.
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.
56
PUBLI C

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


SAP HANA Modeling Guide
Information Views
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:
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.
SAP HANA Modeling Guide
Information Views
PUBLI C

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


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 parametrize currency conversion, calculated columns and Data Foundation filters, create input
parameters.
10. 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.
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
The behavior of analytic views with the information model editor is as follows:
58
PUBLI C

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


SAP HANA Modeling Guide
Information Views
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 .
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.
12. Choose Finish .
Related Information
Using Currency and Unit of Measure [page 101]
Activating Objects [page 87]
You activate objects available in your workspace to expose the objects for reporting and analysis.
Creating Input Parameters [page 96]
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.
Using Temporal Joins [page 59]
A temporal join indicates the time interval mapping between the master data and the transaction data for
which you want to fetch the records.
Description Mapping [page 90]
Description mapping helps you to associate an attribute with another attribute, which describes it in detail. For
example, when reporting via Label Column , you can associate Region_ID with Region_Text.
Display Folders [page 91]
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.3.1.1 Using 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.
Context
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.
SAP HANA Modeling Guide
Information Views
PUBLI C

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


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.
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 which would be considered while executing the join.
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 executing the
join.
Exclude To Include From This temporal condition excludes the value from the To
field and includes the value of From field while executing
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.
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.
60
PUBLI C

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


SAP HANA Modeling Guide
Information Views
6.4 Calculation Views
Calculation views are used to provide composites of other views. Essentially, they 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.
6.4.1 Creating 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:
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.
SAP HANA Modeling Guide
Information Views
PUBLI C

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


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.
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 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.
62
PUBLI C

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


SAP HANA Modeling Guide
Information Views
Related Information
Assigning Variables [page 99]
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.
Creating Input Parameters [page 96]
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.
Display Folders [page 91]
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 90]
Description mapping helps you to associate an attribute with another attribute, which describes it in detail. For
example, when reporting via Label Column , you can associate Region_ID with Region_Text.
Creating Level Hierarchies [page 92]
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.
Creating Parent-Child Hierarchies [page 94]
A parent-child hierarchy is defined using a parent attribute that determines the relationship between the view
attributes. A parent attribute describes a self-referencing relationship, or self-join, within the main table.
6.4.2 Creating 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.
SAP HANA Modeling Guide
Information Views
PUBLI C

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


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 behaviour is as follows:
The output node does not offer any measures (or hierarchies), just 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 if the Always Aggregate Result property in the general properties view of
the Semantics node is set to True, then the output of measures always appears aggregated.
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.
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. We suggest using 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.
64
PUBLI C

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


SAP HANA Modeling Guide
Information Views
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 calculation nodes 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.
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 it's input. For example, if you drop a Projection view node on the DS1 datasource of
the existing Aggregation view node, the Aggregation view node would now have Projection view node
as it's data source and DS1 would be the data source of the Projection node.
SAP HANA Modeling Guide
Information Views
PUBLI C

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


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.
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 Managing Column Mappings [page
73]
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 As Aggregated Column.
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 Join node in the scenario panel, perform the following:
a) Add the required Calculation View with data category as dimension in the Star Join node:
66
PUBLI C

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


SAP HANA Modeling Guide
Information Views
Drag the required calculation views present in the Content node to the Start Join node.
Select the Star Join node in the Scenario panel, and choose Add from the context menu 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.
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.
You can set the Keep Flag property to True for attributes in an aggregation node, to force those
columns to be retrieved from the database even when not requested in the query. In other words,
you are including those columns into the group by clause even if you do not select them in the
query. To set the Keep Flag property to True for attributes in an aggregation node, choose an
attribute in the Details Panel, and in the Properties Panel set the Keep Flag property to True .
7. Assign Semantics to the attributes, measures and calculated columns (optional)
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
SAP HANA Modeling Guide
Information Views
PUBLI C

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


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:
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. Create counters to obtain the number of distinct values of an attribute (optional)
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 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.
68
PUBLI C

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


SAP HANA Modeling Guide
Information Views
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 .
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. 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
Assigning Variables [page 99]
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.
Creating Input Parameters [page 96]
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.
Display Folders [page 91]
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 90]
Description mapping helps you to associate an attribute with another attribute, which describes it in detail. For
example, when reporting via Label Column , you can associate Region_ID with Region_Text.
SAP HANA Modeling Guide
Information Views
PUBLI C

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


Creating Level Hierarchies [page 92]
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.
Creating Parent-Child Hierarchies [page 94]
A parent-child hierarchy is defined using a parent attribute that determines the relationship between the view
attributes. A parent attribute describes a self-referencing relationship, or self-join, within the main table.
Applying Filter on Aggregation and Projection Node [page 76]
Creating Calculated Columns [page 71]
You can create calculated columns to perform some calculation based on the existing view columns.
Mapping Input Parameters [page 71]
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.4.2.1 Creating 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.
Context
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.
70
PUBLI C

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


SAP HANA Modeling Guide
Information Views
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.
6.4.2.2 Creating 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.4.2.3 Mapping 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
SAP HANA Modeling Guide
Information Views
PUBLI C

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


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 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 .
3. In the Map Input Parameters dialog, map the data source input parameters 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.
72
PUBLI C

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


SAP HANA Modeling Guide
Information Views
Note
You can change the constant name by double clicking it.
6.4.2.4 Managing 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 datatype 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 73]
6.4.2.5 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.
SAP HANA Modeling Guide
Information Views
PUBLI C

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


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
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.4.2.6 Using 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.
74
PUBLI C

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


SAP HANA Modeling Guide
Information Views
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
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 3: Dynamic Join Result
REGION PRODUCT SUM(SALES) SUM(TOT_SALES) SUM(SALES_SHAR
E)
APJ PROD1 30 90 .33
APJ PROD2 60 90 .66
EUR PROD1 70 200 .35
EUR PROD2 130 200 .65
Table 4: Standard Join Result
REGION PRODUCT SUM(SALES) SUM(TOT_SALES) SUM(SALES_SHAR
E)
APJ PROD1 30 90 .78
APJ PROD2 60 90 1.21
EUR PROD1 70 200 .73
EUR PROD2 130 200 1.26
SAP HANA Modeling Guide
Information Views
PUBLI C

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


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.
6.4.2.7 Applying 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 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 opertaors 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 specified
in the From Value and To Value
List of Values To filter and show data for a specific list of values sepa
rated 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.
76
PUBLI C

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


SAP HANA Modeling Guide
Information Views
Filter Operator Description
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 speci
fied in the filter value. You can use '?' question mark to
substitute a single character, and '*' asterik to substi
tute many. For example, 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. The filter
Contains Pattern in expression editor is converted
as match. Hence, for the given example the corre
sponding filter expression is (match("CONTI
NENT",'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).
SAP HANA Modeling Guide
Information Views
PUBLI C

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


6.5 Creating 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.
Context
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
schema _SYS_BIC and is named _SYS_BIC.p1.p2/MyView. Ensure that the users who are allowed to see the
view have select privileges on the view (or the entire schema _SYS_BIC).
Note
Multiple restrictions applied on the same column are combined by OR. However, restrictions across several
columns are always combined by AND.
78
PUBLI C

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


SAP HANA Modeling Guide
Information Views
Procedure
1. Set Parameters for the Analytic Privilege
a) If you are in the 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 Database Development Modeler .
3. Select Analytic Privilege.
4. Enter a name and description for the analytic privilege, and choose Finish.
2. Select Applicable to all Information Models optionIf 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 5:
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 qualify
ing the filter condition, as the re
sults of all queries of the user on
SAP HANA Modeling Guide
Information Views
PUBLI C

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


Type Description Example
the view are automatically filtered
using the filter condition
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 qualify
ing the filter condition, as the re
sults of all queries of the user on
the view are automatically filtered
using the filter condition
For example, the same filter condi
tion 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 op
erand in the actual filter condition
DEPARTMENT IN <...>.
Note
Only for those views for which the property Apply Privilege is set to either Analytic Privileges or SQL
Analytic Privileges, are checked for the applied restrictions while querying the views otherwise(If Apply
Privileges is set to blank), 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.
80
PUBLI C

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


SAP HANA Modeling Guide
Information Views
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.
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.
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.
SAP HANA Modeling Guide
Information Views
PUBLI C

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


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.
6.6 Importing BW Objects
You can import SAP NetWeaver Business Warehouse (SAP NetWeaver BW) models that are SAP HANA-
optimized InfoCubes, SAP HANA-optimized DataStore objects, Standard DataStore Objects, Query Snapshot
InfoProviders, and InfoObjects of type Characteristics to the SAP HANA modeling environment.
82
PUBLI C

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


SAP HANA Modeling Guide
Information Views
Prerequisites
You have implemented SAP Notes 1703061 , 1759172 , 1752384 , 1733519 , 1769374 , 1790333 ,
and 1870119 .
You have upgraded to the latest version of SAP HANA Modeler.
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
The BW imported objects are exposed as SAP HANA information models and can be consumed for reporting via
SQL and using client tools such as, SAP BusinessObjects Explorer, SAP BusinessObjects BI 4.0 Suite (Web
Intelligence via Universes, Dashboards, Crystal Reports), Microsoft Office and so on. The model properties are set
based on the SAP NetWeaver BW models metadata.
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.
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.
Conversion of BW analysis authorizations to analytic privileges
When you import the SAP NetWeaver BW InfoProviders, you can import the relevant BW analysis authorizations.
The analysis authorizations are imported as analytic privileges in the SAP HANA Modeler. These analysis
authorizations can be associated with the InfoProviders or roles. You can import the analysis authorizations in the
following way:
SAP HANA Modeling Guide
Information Views
PUBLI C

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


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 6: AO1
0CUSTOMER 1000 - 2000
0PRODUCT ABC*
Table 7: AO2
0TCAIPROV CUBE1, CUBE2
0CUSTOMER 3000 - 4000
0TCAACTVT 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.
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.
84
PUBLI C

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


SAP HANA Modeling Guide
Information Views
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
Aggregated value operator :
Variables, User exits
Authorization on Key Figures
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
SAP HANA Modeling Guide
Information Views
PUBLI C

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


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
Procedure
1. Open the Modeler perspective.
2. In the main menu, choose File Import .
3. Expand the SAP HANA Content node.
4. Choose Import SAP NetWeaver BW Models, and choose Next.
5. To establish a connection with the SAP NetWeaver BW system (underlying BW Application Server), in the
Source System page, 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. Select the target system (an SAP NetWeaver BW on SAP HANA) to which you want to import the models, and
choose Next.
7. 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.
8. 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.
9. If you want import the selected models along with the display attributes for IMO Cube and IMO DSO, select
Include display attributes.
For InfoObjects all the attributes are added to the output and joined to their text tables if exists.
10. If you want to replace previously imported models in the target system with a new version, select Overwrite
existing models.
11. If you do not want to import the analysis authorizations associated with the selected InfoProviders, deselect
Generate InfoProvider based analytic privileges.
12. If you want to import the role based analysis authorizations as analytic privileges, select Generate Role based
analytic privileges, and choose Next.
86
PUBLI C

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


SAP HANA Modeling Guide
Information Views
If you have selected both the InfoProviders and InfoObjects, only authorizations set on InfoProviders can be
imported after selecting the checkbox.
13. Select the roles to import the related analysis authorizations.
14. Choose Finish.
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.
6.7 Activating 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.
SAP HANA Modeling Guide
Information Views
PUBLI C

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


Context Activate Redeploy
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
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.
Not applicable
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 a number of 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.
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.
88
PUBLI C

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


SAP HANA Modeling Guide
Information Views
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 Ex
plorer, user can activate his own in
active object. After activation, the
object is the scenario 2 as in the
next row.
Note
If the logged-in user and the
user to whom the object belongs
are different, the activation is
not allowed. For example, 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 ac
tive, only take over option is ena
bled.
SAP HANA Modeling Guide
Information Views
PUBLI C

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


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 Modeler,
only activation option is enabled.
5 OBJ1 Active Inactive Active Al
lowed
Not Al
lowed
If an object has multiple active ver
sions 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 activation
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 activation
option is enabled.
8 OBJ1 Active Active Active Not
Appli
cable
(Rede
ploy)
If an object has multiple active ver
sions, and the object version in
Modeler is active, only take over
activation (redeploy) option is ena
bled.
6.8 Description Mapping
Description mapping helps you to associate an attribute with another attribute, which describes it in detail. For
example, when reporting via 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.
90
PUBLI C

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


SAP HANA Modeling Guide
Information Views
6.9 Display Folders
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.
SAP HANA Modeling Guide
Information Views
PUBLI C

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


7 Additional Functionality for Views
7.1 Creating 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:
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 drop-down list. You can select columns from the required
table fields in the drop-down list to add to the view.
92
PUBLI C

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


SAP HANA Modeling Guide
Additional Functionality for Views
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
drop-down 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 drop-down 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
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. Enter
the node ID for the stepparent node. This ena
bles you to assign all the orphaned nodes under
this node. The node ID should be entered ac
SAP HANA Modeling Guide
Additional Functionality for Views
PUBLI C

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


Option Description
cording to the node style selected. For example
if the node style selected is level name, the step
parent 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.
7.2 Creating Parent-Child Hierarchies
A parent-child hierarchy is defined using a parent attribute that determines the relationship between 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 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 reuses the attribute view.
94
PUBLI C

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


SAP HANA Modeling Guide
Additional Functionality for Views
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 drop-
down 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.
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
SAP HANA Modeling Guide
Additional Functionality for Views
PUBLI C

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


Option Description
Note
The stepparent node must already exist in the
hierarchy and it must be at the root level. Enter
the node ID for the stepparent node. This ena
bles you to assign all the orphaned nodes under
this node. For example, if the cost center 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.
6. Choose OK.
7.3 Creating 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:
96
PUBLI C

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


SAP HANA Modeling Guide
Additional Functionality for Views
in("attr", $$param$$)
Then you need to pass several values as:
select ... from CV1( 'PLACEHOLDER' = ('$$param$$' = '100,200,300')
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' = ('$$param$$' = '''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.
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
SAP HANA Modeling Guide
Additional Functionality for Views
PUBLI C

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


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.
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.
98
PUBLI C

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


SAP HANA Modeling Guide
Additional Functionality for 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 .
7.4 Assigning 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.
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.
The following types of variables are supported:
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.
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..
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.
SAP HANA Modeling Guide
Additional Functionality for Views
PUBLI C

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


Note
You can check if a variable is mandatory from the properties of the variable in the Properties pane.
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.
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.
100
PUBLI C

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


SAP HANA Modeling Guide
Additional Functionality for Views
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.
7.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 quanity 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.
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.
SAP HANA Modeling Guide
Additional Functionality for Views
PUBLI C

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


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:
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.
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:
102
PUBLI C

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


SAP HANA Modeling Guide
Additional Functionality for Views
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.
g. To specify the client for which the conversion rates to be looked for, in the Client for currency
conversion, select the required option.
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. 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.
d. To specify the client for which the unit conversion factors to be looked for, in the Client for unit
conversion, select the required option.
e. From the dropdown list, select the required value that is used populate data if the conversion fails:
SAP HANA Modeling Guide
Additional Functionality for Views
PUBLI C

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


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.
5. 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
Creating Input Parameters [page 96]
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.
7.6 Working with 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).
104
PUBLI C

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


SAP HANA Modeling Guide
Additional Functionality for Views
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.
7.7 Assigning Default Client
You can set a value for theDefault 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 coloumn 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
SAP HANA Modeling Guide
Additional Functionality for Views
PUBLI C

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


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.
You can specify the default value for the property by setting the preference as follows:
1. Navigate to Window Preferences SAP HANA Modeler Default Model Parameters .
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.
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
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
106
PUBLI C

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


SAP HANA Modeling Guide
Additional Functionality for Views
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.
7.8 Assigning Semantics
Client tools use semantic types to represent data in an appropriate format. You can assign semantic types to
attributes or Calculated attributes either from properties or from the Assign Semantics action in the Semantic
node editor.
Context
Currently the Semantic types supported are:
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.
SAP HANA Modeling Guide
Additional Functionality for Views
PUBLI C

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


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.
108
PUBLI C

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


SAP HANA Modeling Guide
Additional Functionality for Views
8 Working with Views
8.1 Managing 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 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.
1. In the editor, right-click the relevant
table.
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.
SAP HANA Modeling Guide
Working with Views
PUBLI C

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


8.2 Validating 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.
8.3 Viewing 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:
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.
8.4 Maintaining 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.
110
PUBLI C

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


SAP HANA Modeling Guide
Working with Views
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.
8.5 Previewing View Data
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.
You can view the content of the information views in two editors:
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
SAP HANA Modeling Guide
Working with Views
PUBLI C

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


Tab Page Displays Options
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.
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.
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 .
c. 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.
d. From the context menu, choose Data Preview.
112
PUBLI C

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


SAP HANA Modeling Guide
Working with Views
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.
e. Navigate to the required tab page and view the content.
8.6 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(20000203135026
.1234567, 10, 4)) ->
date('2000-02-03 13:50:26')
SAP HANA Modeling Guide
Working with Views
PUBLI C

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


Function Syntax Purpose Example
longdate
longdate longdate(stringarg)
longdate longdate(fixedarg)
longdate longdate(int, int, int)
longdate longdate(int, int, int,
int, int)
longdate longdate(int, int, int,
int, int, int)
longdate longdate(int, int, 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')
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.
114
PUBLI C

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


SAP HANA Modeling Guide
Working with Views
Function Syntax Purpose
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.
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
SAP HANA Modeling Guide
Working with Views
PUBLI C

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


Function Syntax Purpose
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).
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
116
PUBLI C

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


SAP HANA Modeling Guide
Working with Views
Function Syntax Purpose
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
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 Views
PUBLI C

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


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_RETURN
_NULL)
8.7 Searching 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.
118
PUBLI C

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


SAP HANA Modeling Guide
Working with Views
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.
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.
8.8 Copying 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.
Note
Copy-paste is supported only for a single object.
SAP HANA Modeling Guide
Working with Views
PUBLI C

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


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.
8.9 Tracing 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 just the activity or action you want to
troubleshoot. Also, the recommended format for log file is CSV.
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.
120
PUBLI C

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


SAP HANA Modeling Guide
Working with Views
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.
SAP HANA Modeling Guide
Working with Views
PUBLI C

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


9 Creating 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, 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.
Procedure
1. Create a Decision Table
You can create a decision table by using one of the following options:
If you are in the Modeler perspective, perform the following steps:
1. In the 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.
122
PUBLI C

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


SAP HANA Modeling Guide
Creating Decision Tables
Scenario Substeps
Note
If you launch the New Decision Table dialog
from the Quick Launch tab page, specify the
package where you want to save the deci
sion 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 dialog
from the Quick Launch page, specify the
package where you want to save the deci
sion 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.
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.
SAP HANA Modeling Guide
Creating Decision Tables
PUBLI C

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


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.
2. 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:
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 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.
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
124
PUBLI C

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


SAP HANA Modeling Guide
Creating Decision Tables
Country Season Discount
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
3. Create Joins
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.
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.
4. Add Attributes
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.
SAP HANA Modeling Guide
Creating Decision Tables
PUBLI C

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


5. Add Conditions and Actions
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.
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 Using Parameters in
a Decision Table.
You can arrange the condition and action columns of the decision table depending on how you want them
to appear. For more information, see Changing the Layout of a Decision Table.
6. Add Condition and Action Values
1. Add Condition Values
In the Details panel of the Decision Table node, do any of the following:
a. Double-click to edit the cell and enter a value.
b. In the context menu of the condition cell, choose Add Conditions Values or Set Dynamic Value.
c. 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
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
126
PUBLI C

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


SAP HANA Modeling Guide
Creating Decision Tables
Operator Supported Data Types Syntax
Less Than
Less Than or Equals
Number & CHAR-based <10
<=10
Between Number Between 20 and 30
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
Remember
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
In the Details panel of the Decision Table node, do any of the following:
a. Double-click to edit the cell and enter a value.
b. In the context menu of the action cell, select Set Dynamic Value and enter a value.
3. Add a Complex Expression
If you want to write a complex expression as an action or condition value, do the following:
a. Right-click the action field.
b. From the context menu, choose Set Dynamic Value.
SAP HANA Modeling Guide
Creating Decision Tables
PUBLI C

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


c. Write the expression, for example, PRICE-(PRICE*0.1).
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
To assign a value to a condition or an action based on the table data, choose Open Value Help Dialog, and do
the following:
a. 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.
b. 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.
7. Optional Step: Validate Decision Table
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 .
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 Modeler
perspective, both client- and server-side validation occurs.
128
PUBLI C

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


SAP HANA Modeling Guide
Creating Decision Tables
8. Activate Decision Table
Activate the decision table by using one of the following options:
If you are in the 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.
9. Execute Decision Table Procedure
1. To execute the decision table procedure, perform the following steps as required:
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 parame
ter>);
Physical tables Physical table
column
Parameters call "<schema name>"."<procedure
name>"(?);
Physical tables Parameters Parameters call "<schema name>"."<procedure
name>"(<IN parameter>,,<IN parame
ter>,?);
SAP HANA Modeling Guide
Creating Decision Tables
PUBLI C

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


Data Source Condition Action Script
Information
View
View attributes Parameters call "<schema name>"."<procedure
name>"(?);
Information
View
Parameters Parameters call "<schema name>"."<procedure
name>"(<IN parameter>,,<IN parame
ter>,?);
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 parame
ter>,?);
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.
9.1 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 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.
130
PUBLI C

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


SAP HANA Modeling Guide
Creating Decision Tables
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
Note
You can also arrange the sequence by using the navigation buttons at the top of the Output panel.
9.2 Using Parameters in a Decision Table
You use this procedure to create a parameter that can be 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
SAP HANA Modeling Guide
Creating Decision Tables
PUBLI C

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


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.
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
Procedure
1. Create a Parameter
1. In the Output panel, select the Parameters node.
2. From the context menu, choose New and do the following:
a. Enter a name and description.
b. Select the required data type from the dropdown list.
c. Enter the length and scale as required.
d. 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.
e. Choose OK.
132
PUBLI C

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


SAP HANA Modeling Guide
Creating Decision Tables
2. Use Parameter as Condition or Action
1. In the Output panel, select the Parameters node.
2. From the context menu of the parameter, choose Add as Conditions/ Add as Actions.
9.3 Using Calculated Attributes in Decision Tables
Context
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) In the expression editor, enter the expression. For example, you can write a formula such as (NAME =
FIRST_NAME + LAST_NAME). This expression is an example of the string concatenation function,
which is used to derive the name of a person by using the first name and last name values from the table
fields.
Note
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.
3. Choose OK.
4. Add the required calculated attribute as a condition.
SAP HANA Modeling Guide
Creating Decision Tables
PUBLI C

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


10 Managing Object Versions
10.1 Switching 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.
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.
134
PUBLI C

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


SAP HANA Modeling Guide
Managing Object Versions
10.2 Toggling 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.
10.3 Viewing 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.
SAP HANA Modeling Guide
Managing Object Versions
PUBLI C

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


11 Managing Views
11.1 Checking 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.
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.
11.2 Enabling Multilanguage Support for Objects
You use this procedure to enable translation of text pertaining to objects and their elements that did not have
multilanguage support.
For example, you can enable multilanguage support for models along with their elements like attributes and
measures in different languages.
136
PUBLI C

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


SAP HANA Modeling Guide
Managing Views
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.
11.3 Generating 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:
SAP HANA Modeling Guide
Managing Views
PUBLI C

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


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.
11.4 Refactoring 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.
138
PUBLI C

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


SAP HANA Modeling Guide
Managing Views
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.
8. Choose Finish.
SAP HANA Modeling Guide
Managing Views
PUBLI C

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


12 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
140
PUBLI C

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


SAP HANA Modeling Guide
Important Disclaimers on Legal Aspects
SAP HANA Modeling Guide
Important Disclaimers on Legal Aspects
PUBLI C

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


www.sap.com/contactsap

2014 SAP AG 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 AG.
The information contained herein may be changed without prior
notice.
Some software products marketed by SAP AG and its distributors
contain proprietary software components of other software
vendors. National product specifications may vary.
These materials are provided by SAP AG and its affiliated
companies ("SAP Group") for informational purposes only, without
representation or warranty of any kind, and SAP Group shall not be
liable for errors or omissions with respect to the materials. The only
warranties for SAP Group 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 AG in Germany and other countries.
Please see http://www.sap.com/corporate-en/legal/copyright/
index.epx for additional trademark information and notices.

Anda mungkin juga menyukai