Sie sind auf Seite 1von 120

PUBLIC

SAP HANA Platform SPS 06 Document Version: 1.0 - 26-06-2013

SAP HANA Modeling Guide

Table of Contents
1 2 2.1 Introduction to Modeling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4 SAP HANA Architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 SAP HANA In-Memory Database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5 2.1.1 2.1.2 2.1.3 2.2 3 3.1 3.2 3.3 3.4 Columnar Data Storage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Parallel Processing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Simplifying Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

SAP HANA Database Architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Getting Started. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Required Permissions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Adding a System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 SAP HANA Studio. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.3.1 3.4.1 Quick Tour: Modeler Perspective. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Attributes and Measures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Creating a View. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

4 4.1 4.2 4.3

Setting Up Your Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Configuring the Import Server. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Importing Table Definitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 4.2.1 4.3.1 4.3.2 Configuring Data Services for Metadata Import. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Suspending and Resuming Data Load. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Uploading Data from Flat Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Loading Data into Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

4.4 4.5 4.6 5 5.1 5.2 5.3 5.4 6 6.1 6.2 6.3

Copying Content Delivered by SAP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Mapping the Authoring Schema to the Physical Schema. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.5.1 Changing Authoring Schemas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 Generating Time Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Setting Up the Modeling Environment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Setting Modeler Preferences. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Setting Keyboard Shortcuts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Applying Filters to Packages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40 Applying Filter to Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Information Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Creating Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Attribute Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 6.2.1 6.3.1 Creating Attribute Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Creating Analytic Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 Analytic Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Table of Contents

6.4

Calculation Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 6.4.1 6.4.2 Creating a Script-Based Calculation View. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Creating a Graphical Calculation View. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

6.5 6.6 6.7 6.8 6.9 7 7.1 7.2 7.3 7.4 7.5 7.6 8 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 9 9.1 9.2 9.3 10 10.1 10.2 10.3 11 11.1 11.2 11.3 11.4

Creating Analytic Privileges. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Importing BW Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 Activating Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Description Mapping. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Display Folders. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 Additional Functionality for Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Creating Level Hierarchies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Creating Parent-Child Hierarchies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 Creating Input Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Assigning Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Using Currency and Unit of Measure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Working with Broken Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Working with Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Managing Layout. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .94 Validating Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Viewing the Job Log. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Maintaining Search Attributes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Previewing Data of Content Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 Functions used in Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 Searching Tables, Models and Column Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 Copying an Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Creating Decision Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Changing the Layout of a Decision Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 Using Parameters in a Decision Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 Using Calculated Attribute in Decision Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 Managing Object Versions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Switching Ownership of Inactive Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .115 Toggling Versions of Content Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 Viewing Version History of Content Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 Managing Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Checking Model References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117 Enabling Multilanguage Support for Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Generating Object Documentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 Refactoring Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

SAP HANA Modeling Guide Table of Contents

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

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 decisionmaking. 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.

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Introduction to Modeling

SAP HANA Architecture

SAP HANA is an in-memory data platform that is deployable on premise or on demand. At its core, it is an innovative in-memory relational database management system that makes 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 possible before. 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.

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.

SAP HANA Modeling Guide SAP HANA Architecture

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

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.

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide SAP HANA Architecture

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.

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

SAP HANA Modeling Guide SAP HANA Architecture

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

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. The statistics server collects information about status, performance and resource consumption from the other servers in the system. Monitoring clients, such as the SAP HANA studio, access the statistics server to get the status of various alert monitors. The statistics server also provides a history of measurement data for further analysis. Related Links SAP HANA SQLScript Reference SAP HANA Business Function Library (BFL) Reference SAP HANA Predictive Analysis Library (PAL) Reference SAP HANA R Integration Guide

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide SAP HANA Architecture

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 which 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.

Note

SAP HANA Modeling Guide Getting Started

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

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 67].

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, seeImporting 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.

Note
The SAP HANA Systems view of the Modeler perspective lists only inactive objects from the default workspace along with the active objects. Also, in the Modeler perspective, the objects can be created,

10

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Getting Started

edited, and saved only when no other inactive version exists in other workspaces other than default workspace. 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. 2. 3. 4. _SYS_BI - SELECT privilege _SYS_BIC - SELECT privilege REPOSITORY_REST (SYS) - EXECUTE privilege <<schema_where_tables_reside>> - SELECT privilege

Note
The above permissions need not be Grantable to other users and roles. Analytic Privileges 1. 1. 2. _SYS_BI_CP_ALL Root Package - REPO.MAINTAIN_NATIVE_PACKAGES privilege <<package_used_for_content_objects>> - REPO.READ, REPO.EDIT_NATIVE_OBJECTS & REPO.ACTIVATE_NATIVE_OBJECTS Package Privileges

Note
The above permissions need not be Grantable to other users and roles. Grant select on the schema <<schema_where_tables_reside>> to _SYS_REPO For creation of delivery units, you need the REPO.MAINTAIN_DELIVERY_UNITS system privilege For export & import of delivery units, use the REPO.IMPORT, REPO.EXPORT system privileges

SAP HANA Modeling Guide Getting Started

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

11

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. 2. 3. 4. In the SAP HANA Systems view, right-click anywhere in the view and select Add System. In the System window, enter the host name, instance number, and a description for the SAP HANA system you want to add. Select Next. 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 Quick Launch Default Connection . Window Preferences Modeler

You can to switch to a different system by choosing Select System... in the Quick Launch tab page.

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. Window Open Perspective , or select on the toolbar.

To open a perspective, go to

12

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Getting Started

3.3.1

Quick Tour: Modeler Perspective

The Modeler perspective is used to define your analytic model by creating various types of views.

The perspective contains the following main areas: SAP HANA Systems view: A view of the database objects, that is, those objects you create from the Modeler perspective. Quick Launch area: A collection of shortcuts for performing the most common modeling tasks. If you close the Quick Launch tab, you can reopen it by selecting Help Quick Launch . Properties view: A view that consists of all the object properties. Job Log view: A view that displays information related to requests entered for a job such as, validation, activation, and so on. 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 SAP HANA Systems view is one of the basic elements of the SAP HANA Development perspective. You can use the SAP HANA Systems view to display the contents of the SAP HANA database that is hosting your development project artifacts. The SAP HANA 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

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

13

The SAP HANA 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. 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 SAP HANA Repositories view.

14

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Getting Started

Related Links The SAP HANA Repositories View

3.3.1.2

Information View Editor Components

In the 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:

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

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

15

Analytic View

The 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.

16

PUBLIC 2013 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 Enable Multi Dimensional Reporting to true or false, these default nodes appear. If the property is set to true, the default node is aggregation node. If the property is set to false, 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

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

17

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.

18

PUBLIC
2013 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

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

19

Analytic views can 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> Optionally, attribute views can also be included 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> 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 Associate a measure with the currency and unit of measure using the Measure Type property

Calculation Views A calculation view is used to define more advanced slices on the data in the SAP HANA database. Calculation views can be simple and mirror the functionality found in both attribute views and analytic views. However, they are typically used when the business use case requires advanced logic that is not covered in the previous types of information views.

20

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Getting Started

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

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

21

Procedure
1. 2. 3. Open the Modeler perspective. To set the view parameter, perform the steps in Creating Views [page 42]. The view editor opens where you can define the input elements of the view and its output structure. To design a view that can be used for analytical purposes, see Information Views [page 42].

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.

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.

22

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Getting Started

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

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

23

Setting Up Your Data

4.1

Configuring the Import Server

You need to establish a connection with the server to load data from external sources to SAP HANA .

Prerequisites
You have the details of the BusinessObjects Data Services repository and ODBC drivers.

Procedure
1. 2. 3. 4. In the Quick Launch tab page, choose Configure Import Server. Enter the IP address of the server from which you want to import data. Enter the repository name. Enter the ODBC data source, and choose OK.

Results
Once the connection is established you can import the tables definition and then load the data into table definitions.

4.2

Importing Table Definitions

One of the ways to create tables to load source system data into SAP HANA is to import the table definitions from the source system.

Prerequisites
You have configured the SAP HANA modeler for importing metadata using the Data Services infrastructure.

24

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Setting Up Your Data

Context
Use this procedure to import table definitions (metadata) from a source system to load source system data into SAP HANA. You can point to these table definitions for creating various content models such as attribute, analytic, and calculation views. 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 user name and password of the target system. 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. 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.

SAP HANA Modeling Guide Setting Up Your Data

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

25

h) Select the schema into which you want to import the metadata. i) j) If you selected object type as extractor, select the package into which you want to place the corresponding objects. Choose Next, then review and confirm the import by choosing Finish.

If the source object is a table or non V-type extractor, the system creates physical tables and stores them in the selected schema. However, if the source object is a V-Type extractor, the system creates content models and stores these models in the selected package, and the underlying physical tables in the schema.

4.2.1

Configuring Data Services for Metadata Import

Use this procedure to enable the SAP HANA modeler to import table definitions from the source system using the Data Services infrastructure.

Procedure
1. Set the Passphrase a) Log on to the Central Management Console of SAP BusinessObjects Enterprise (BOE). b) Choose Manage Applications Data Services Application Settings . c) In the Encryption Passphrase field, enter the passphrase that you have been using for the SAP HANA studio, and choose Save. d) Restart the TOMCAT and BOE services. 2. Disable Session Security a) Log on to the Data Services Management Console. b) Choose Administrator. c) In the Navigator view panel, choose Web Services. d) Choose the Web Services Configuration tab page. e) Select the Import_Repo_Object checkbox to save the connection details. f) 3. Select Disable Session Security from the dropdown menu, and choose Apply. Creating a Data Source a) Go to Start Control Panel Administrative Tools . b) Choose Data Sources (ODBC). c) Choose the System DSN tab page, and choose Add. d) Select HDBODBC from the driver list, and choose Finish. e) Enter a name and description for the data source. f) Enter server details.

Note
The format in which you need to enter details is <<host>:3<instance number>15>. For example, abc2012.wdf.sap.corp:30115. g) Enter the required database details in the format, <<SID><instance number>>. For example, M4701.

26

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Setting Up Your Data

h) Choose Connect.

4.3

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 24]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.

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. 2. In the Quick Launch tab page, choose Data Provisioning. 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. 4. 5. If you are using the SLT-based replication, select the target schema which is configured for SAP ERP or nonSAP systems in the Target Schema Configured dropdown list. Choose Load for initial load or Replicate for data replication . Select the required tables to load or replicate data in any of the following ways:

SAP HANA Modeling Guide Setting Up Your Data

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

27

Search for the required tables. 1. 2. Select the table from the list, and choose Add. 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. Choose Load from file. Select the file that contains the required list of tables.

Load the list of tables from a local file as follows: 1. 2.

Note
The supported file type is .csv. 6. 7. If you are using the load controller infrastructure, choose Next and enter the operating system user name and password. Choose Finish.

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. 2. Choose Operation for which you want to delete the status table entries such as load, replicate, or create. 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. 4. 5. If the value for Entry Type is Specific, in the Value dropdown, select the tables for which you want to delete the entries. If you want to delete the entries for a specific time period, select it using the From and To calendar options. Choose Delete.

4.3.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.

28

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Setting Up Your Data

Procedure
1. 2. 3. 4. 5. In the Quick Launch tab page, choose Data Provisioning. Select the source system for which you want to suspend or resume data load. Choose Suspend or Resume . Select the tables, and choose Add. Choose Finish.

4.3.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. 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. 2. 3. 4. 5. In the File menu, choose Import. In the Select an import source section, expand the SAP HANA content node. Select Data from Local File, and choose Next. In the Target System section, select the target system to which you want to import the data using the flat file, and choose Next. 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.

SAP HANA Modeling Guide Setting Up Your Data

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

29

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. 9. Enter a value in the Default Value column to provide a default value for a column at the target. ChooseFinish.

4.4

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.

30

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Setting Up Your Data

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. 2. 3. In the Quick Launch tab page, choose Mass Copy. To create a mapping between the source package and the target package, choose Add. 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.

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.5

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.

SAP HANA Modeling Guide Setting Up Your Data

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

31

Context
Youcan map the authoring schemas to the physical database schemas in the target system to access and deploy transported objects. A physical schema is a schema in which the tables are available. It may differ in the source and target systems. An authoring schema (logical schema) is the database schema used in the design time views. For example, this is the database schema that is used in the content development system. Content object definitions are stored in the repository and contain references to the physical database schemas. When you copy the content objects to a different system, for example, from an SAP system to a customer system or between customer systems, the object definition still refers to the physical database schemas at the source. To resolve this, you use schema mapping.

Remember
Schema mapping only applies to references from repository objects to catalog objects. It is not intended to be used for repository to repository references.

Restriction
You need to map the references of the script-based calculation views and procedures manually, that is, by changing the script if the tables are qualified with the schema. If the tables are not qualified, the default schema of the view is used, and the schema mapping is also applied to the default schema. You can map several authoring schemas to the same physical schema. For example, content objects delivered by SAP refer to different authoring schemas, whereas in the customer system, all these authoring schemas are mapped to a single physical schema where the tables are replicated.

Remember
The mapping between authoring and physical schemas is stored in the configuration table _SYS_BI.M_SCHEMA_MAPPING

Note
If a system does not have schema mapping, the authoring schema is filled 1:1 from the physical schema; otherwise, the default schema cannot be changed.

Procedure
1. 2. 3. In the Quick Launch tab page, choose Schema Mapping. Choose Add. Enter the authoring schema and physical schema that need to be mapped.Choose OK.

Example

32

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Setting Up Your Data

Consider a source system, SAP, with an information object, AV1. This refers to the table MARA in the SAP_ERP physical database schema. There is a target system, Customer, with the physical database schema EMEA. After you import content, the object AV1 cannot be activated in the Customer system, because it still refers to the SAP_ERP schema. AV1 in the Customer system currently refers to SAP_ERP. To be able to activate the object, you need to modify the mapping of AV1 in the Customer system. To do this, a mapping is created in the target system Customer between the authoring and physical schema as follows: Authoring Schema
SAP_ERP

Physical Schema
EMEA

4.5.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.

SAP HANA Modeling Guide Setting Up Your Data

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

33

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. 2. In the Quick Launch tab page, choose Change Authoring Schema. 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. 4. Select or enter the authoring schema that you want to change for the objects selected above in the Source dropdown list. Select or enter the authoring schema that you want to associate with the objects selected above in the Target dropdown list and choose OK.

Note
If you enter an authoring schema as a target that does not exist in the schema mapping defined for the current system instance, then the specified authoring schema name is set in the information models 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 AS1 AS2 AS3 Physical Schema PS1 PS1 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.

34

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Setting Up Your Data

Table 2: Schema Mapping Authoring Schema AS1 AS2 AS3 Physical Schema PS1 PS1 PS1

4.6

Generating Time Data

For modeling a business scenario that requires time dimension, you can populate time data in the default timerelated tables present in _SYS_BI schema, for example while creating time attribute views. You can choose to generate the time data for a given time span based on your requirements such as, calendar type and granularity.

Context
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
Seconds Minutes Hour Day Week Month Year

Range
<= 5 years <= 15 years <= 30 years <= 50 years <= 50 years <= 50 years <= 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. 2. In the Quick Launch tab page, choose Generate Time Data. If your financial year is same as he calendar year,for example, January to December, chooseGregorianin the Calendar Type dropdown .

SAP HANA Modeling Guide Setting Up Your Data

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

35

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. 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.

36

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Setting Up Your Data

5
5.1

Setting Up the Modeling Environment


Setting Modeler Preferences

You can set modeling preferences to thedefault settings that the system uses when you log on.

Procedure
1. Choose Window Preferences Modeler .

Note
You can also set the preferences choosing 2. Quick Launch Manage Preferences

Identify the required preference and perform the corresponding steps: Requirement
To specify the structure of content packages in the SAP HANA Systems view

Preference
Content Presentation

Substeps
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

SAP HANA Modeling Guide Setting Up the Modeling Environment

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

37

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 Data From Local File using flat file

1.

Browse the location to save error log files for data load using flat files. 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. 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.

2.

3.

To set the default value for the client that will be used while previewing model data To enforce various rules on objects

Default Model Parameters

Choose the client from Default Client.

Validation Rules

Select the required rules to be applied while performing object validation.

Note
Enforcing validation rules with severity Error are mandatory. To determine the numbers of rows to be displayed in a page To specify a location for job log files Data Preview Logs Select the maximum rows for data preview as required. Expand the Logs node and choose Job Log.Browse the location where you want to save the job log files. 1. 2. 3. Expand the Logs node and select Job Log. Choose True. Browse the location where you want to save the repository log files.

To enable logging for repository calls and specify a location for repository log files

Logs

38

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Setting Up the Modeling Environment

Requirement
To enable search for the attributes used in the views To allow lower case alphabets for attribute view, analytic view, calculation view, procedure and analytic privilege names

Preference
Search Options Case Restriction

Substeps
Choose Enable Search Attributes. 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 Activate Activate Add Table/Model Auto Arrange Data Preview Data Preview Display XML Find Fit to Window Move Element in Output Pane (Direction: Down) Move Element in Output Pane (Direction: Up) Open Binding Ctrl+Shift+A Ctrl+Shift+A Ctrl+Shift+= Ctrl+L Ctlr+Shift+P Ctlr+Shift+P Alt+D Ctrl+F Ctrl+0 Ctrl+] Ctrl+[ Ctrl+O When Navigator In Windows In Windows In Windows Navigator In Windows In Windows Navigator In Windows In Windows In Windows Navigator In Windows In Windows In Windows In Windows Navigator Category Modeler Keys Modeler Keys Modeler Keys Modeler Keys Modeler Keys Modeler Keys Modeler Keys Modeler Navigator Modeler Keys Modeler Keys Modeler Keys Modeler Keys Views Views Views Modeler Keys Modeler Keys

Show View (View: History) Alt+Shift+H Show View (View: Job Log) Show View (View: WhereUsed List) Validate Validate Alt+Shift+L Alt+Shift+U Ctrl+Shift+V Ctrl+Shift+V

SAP HANA Modeling Guide Setting Up the Modeling Environment

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

39

Zoom (Type: In) Zoom (Type: Out) Zoom (Type: Reset) 1. 2. 3. Choose Window

Ctrl+= Ctrl+Alt+Shift+0 Preferences General Keys .

In Windows In Windows In Windows

Modeler Keys Modeler Keys Modeler Keys

In the Keys panel, choose Modeler as a Scheme. If you only want to see the keyboard shortcuts for the Modeler , enter Modeler Keys in the text field.

Note
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.

4.

Choose Apply.

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. 2. 3. 4.

In the SAP HANA Systems view, choose Content. In the context menu, choose Filter Packages.... In the Filter Packages dialog, enter the filter text. 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.

40

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Setting Up the Modeling Environment

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.

Context

Procedure
1. 2. 3. 4. 5. In the SAP HANA Systems view, expand Content. In the context menu of a package, choose Filter Objects.... In the Filter Objects dialog, enter the filter text. If you want to search for the exact word written in the filter text, select Match whole word checkbox. 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.

SAP HANA Modeling Guide Setting Up the Modeling Environment

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

41

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 Modeler perspective, perform the following steps:

Procedure
1. 2. 3. In the SAP HANA Systems view, right-click on the relevant system and expand Content . Expand the package to which you want to save your information object. In the context menu of the required object, such asAttribute 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 Create a view with table attributes. Create a view with time characteristics. Procedure Under Sub Type , choose Standard.

1. 2.

Under Sub Type drop-down list, choose Time. Select the required calendar type : a. b. If the calendar type is Fiscal,, select a variant schema, and a fiscal variant. If the calendar type is Gregorian, select the granularity for the data.

3.

To use the system-generated time attribute view, select Auto Create.

Note

42

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

Scenario

Procedure The system creates a time attribute view based on the default time tables, 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_DIMENSION_ 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 attribute view, you need to generate time data into tables from the Quick Launch. Copy a view from an existing 1. view in this case, you can 2. modify the copied view. Derive a view from an 1. existing view if you cannot modify the derived view that acts as a reference to the base attribute view. 5. Choose Copy From. Select the required attribute view. Under Sub Type , choose Derived and select the required attribute view.

In case of a calculation view, perform the following: 1. 2. 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. Choose Graphical if you want to use to the graphical modeling features to create a calculation view. Choose Enable Multidimensional Reporting if you want to make the view available for reporting purposes.

Note
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. 6. Choose Finish.

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

SAP HANA Modeling Guide Information Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

43

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 T009 and T009B tables for creating an attribute view whose type is Time.

Procedure
1. Define Output Structure a) Add the tables that you want to use in any of the following ways: Drag the required tables present in the Catalog to the Data Foundation node. Select the Data Foundation node in the Scenario panel, and in the context menu of the Details panel, choose Add... and search for the object to add.

Note
You can choose to add the same table again in Data Foundation using table aliases in the editor. For example, consider a table containing supplier and buyer information with postal code, and another table containing the link from postal code to region and country. Now, you want to join this geography table two time 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.

44

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

You can also join two tables by dragging and dropping the join from the column of one table to a column in another table . After creating the join, you can edit its properties, such as join type and cardinality, in the Properties view. You can choose to create Text Join between table fields in order to get language-specific data You have a product table that contains product IDs without descriptions and you have a text table for products that contains language-specific descriptions for each product. You can create a text join between the two tables to get the language-specific details. In a text join, the right table should be the text table and it is mandatory to specify the Language Column.

Tip
You can set the cardinality of the join as required. By default, the cardinality of the join is empty. The empty cardinality can be specified if you are not sure about the right cardinality. If you specify the empty cardinality, the system will determine the the cardinality during the join evaluation phase.

Caution
Selecting the incorrect cardinality can lead to erroneous data and memory issues. c) Add the table columns to the output structure that is, the Semantics node that you want to use to define attribute data. You can define the attribute data by doing one of the following: Select the toggle button on the left of the table field. Right-click the table field, and choose Add to Output.

d) If you want to specify a filter condition based on which system must display data for a table field in the output do the following: 1. 2. 2. Right-click the table field, and choose Apply Filter. Select the required operator, and enter filter values.

All the table fields that you have added to the output are automatically mapped as attributes. 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

SAP HANA Modeling Guide Information Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

45

(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: 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 Dynamic then, the value set for the Session Client property is used to filter table data. The Session Client property is set while creating a user. 5. Activate the view using one of the following options: If you are in the 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. 2. In the Project Explorer view, select the required object. In the context menu, select Team Activate .

Note

46

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

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.

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 Links Creating Level Hierarchies [page 81] 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. Activating Objects [page 76] 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 timerelated 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 79] 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 Parent-Child Hierarchies [page 83] 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.3

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. 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.

SAP HANA Modeling Guide Information Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

47

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 there is a name conflict that is, more than one element having the same name among the local and shared attributes, calculated columns, restricted columns, and measures of an analytic view, the activation of the view does not go through. 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 old 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 MultiDimensional Reporting to true or false. If the MultiDimensional Reporting property of the analytic view is set to false, the view will not be available for multidimensional reporting purposes. If the value is set to true, an additional column Aggregation is available to specify the aggregation type for measures. You can enable relational optimization for your analytic view such as, Optimize stacked SQL for example, convert SELECT a, SUM(X) FROM ( SELECT * FROM AV) GROUP BY A to SELECT A, SUM(X) FROM AV GROUP BY A by setting the property Allow Relational Optimization. Setting this property would be effective only for analytic views having complex calculations such that deployment of analytic view generates catalog calculation view on top of the generated catalog OLAP view.

Caution
In this case, if this flag is set counters and SELECT COUNT may deliver wrong results

6.3.1

Creating Analytic Views

Analytic views are typically defined on a fact table that contains transactional data (as measures). You can define analytic views in a single or joined table, create a selection of measures, add attributes and join attribute views.

48

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

Context
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.

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. 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.

SAP HANA Modeling Guide Information Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

49

Caution
Selecting the incorrect cardinality can lead to erroneous data and memory issues. c) Perform one of 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. 2. Right-click the table field, and choose Apply Filter. Select the required operator, and enter the filter values.

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: 2. 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.

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:. . 2. 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

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.

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

50

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

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 Restricted Columns You can create restricted columns if you want to filter the value for an output field based on the user-defined rules. For example, you can choose to restrict the value for the Revenue column only for Region = APJ, and Year = 2012. a) In the Output panel of the Logical Join, right-click Restricted Columns, and choose New. b) Enter a name and description for the restricted column. c) From the Column dropdown list, select the column for which you want to apply a restriction.

Caution
The column for which you apply a restriction must be defined as measure in the semantics node otherwise the validation will fail. d) Choose Add Restriction. e) In the Parameter field, select the column that you want to create a restriction for, then select the operator and value. f) Choose OK.

Note

SAP HANA Modeling Guide Information Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

51

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 4. 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. 5. Optional Step: You can filter and view the table data in the modeled view for a specific client as specified in the table fields, such as MANDT or CLIENT, by doing the following: 1. Select the Semantics node, in the Properties panel, edit the Default Client property.

Note
The default value for the property is the one that is specified as a preference. If the property is set to Dynamic, at run-time the value set for the Session Client property is considered to filter table data. The Session Client property is set while creating a user. 6. 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. 7. 8. If you want to parametrize currency conversion, calculated columns and Data Foundation filters, create input parameters. Activate the view using one of the following options: If you are in the 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.

52

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

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. 2. In the Project Explorer view, select the required object. 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 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 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 Links Using Currency and Unit of Measure [page 90] Activating Objects [page 76] You activate objects available in your workspace to expose the objects for reporting and analysis. Creating Input Parameters [page 85] 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 54] 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 79] 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

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

53

Display Folders [page 80] 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.

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. 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. 2. Create a referential join between the attribute of the fact table and the attribute view. In the Properties panel, 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.

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.

54

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

But to fetch data for a particular time period you need to assign temporal properties to the join. The temporal column in our example would be Date field in the Analytic view, and the From date and To date would come from the Validity_Date_From, and Validity_Date_To of the attribute view.

6.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 MultiDimensional Reporting property to true or false as follows:

SAP HANA Modeling Guide Information Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

55

Set to true - if you want to define a calculation view that is visible in the multidimensional reporting tools. Set to false - if you want to define a simple SQL like calculation view, which, for example, is used to fill simple list user interfaces where recurring attribute values are not a problem, but are desired. The view is not available for multidimensional reporting and is only consumable via SQL.

Procedure
1. In the Details panel of the Semantics node, select the required schema from the Default Schema property, for unqualified access in SQL Script.

Note
If you do not select a default schema while scripting, you need to provide fully qualified names of the objects used. 2. 3. Choose SQL Script node in the Semantics node. 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. 5. Write the script using SQL Script commands to fill the output structure. Activate the view using one of the following options: 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.

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. 2. In the Project Explorer view, select the required object. 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.

56

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

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 Related Links Assigning Variables [page 88] 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 85] 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 80] 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 79] 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 81] 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 83] 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 Multidimensional Reporting to true or false based on the following requirement: Set to true - if you want to define a calculation view that is visible in the reporting tools. You just must define at least one measure and the default node is Aggregation. Set to false - 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

SAP HANA Modeling Guide Information Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

57

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. You can switch the execution of the calculation view to the SQL Engine rather that the Column Engine for better performance by selecting the SQL Engine value in the Execute In property. When this property is set to SQL Engine, the calculation engine generates SQL code for each node at runtime and combines them into one big SQL statement which is then passed to the SQL interface. This might be beneficial since the SQL interface also involves standard SQL optimizer which implements a lot more optimization rules than the Calculation Engine. For example, the most important rule is join ordering determination. 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 onlycontain 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. 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

58

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

cardinality and execute the join. Wrong selection of cardinality can lead to erroneous data and out of memory issues.

Procedure
1. Choose one of the following options from the Tools Palette: View Node
Union

Description
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. 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. 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. 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.

Join

Projection

Aggregation

Note
The input for union, join, projection, and aggregation view nodes can consist of data sources, union, join, projection, or aggregation views. You can only have one source of input for aggregation and projection view nodes, and two inputs for a join. You can choose to create filters on projection and aggregation view node attributes.

2.

To add the data sources to the selected node like, join, select data source from the SAP HANA systems view to the join node. a) Map the input to the selected option. Mapping attributes

next to the join node or drag and drop the

To map attributes in a union view, 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 63]

Tip
To create a system generated mapping, choose Auto Map By Name.

SAP HANA Modeling Guide Information Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

59

In case of a join view, join the columns of the data sources in the Details view.

Note
The output of a union view node is the attributes that you added to the Target. 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. To add attributes of projection or aggregation view node to its output, choose Add to Output from the context menu.

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 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. 3. 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 MultiDimensional Reporting property of the calculation view is set to true, it is mandatory to specify at least one column as measure; otherwise, the view activation fails. Also, if the value is set to true, 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 Measure 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.

4.

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. 5. Activate the view. If you are in the Modeler perspective, choose one of the following:

60

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

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. 2. In the Project Explorer view, select the required object. 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 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. 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.

2.

Related Links Assigning Variables [page 88] 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 85] 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 80] 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 79] 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 81]

SAP HANA Modeling Guide Information Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

61

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 83] 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 66] Creating Calculated Columns [page 62] You can create calculated columns to perform some calculation based on the existing view columns. Mapping Input Parameters [page 63] You can map the input parameters in the underlying data sources (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.

6.4.2.1

Creating Calculated Columns

You can create calculated columns to perform some calculation based on the existing view columns.

Procedure
1. 2. 3. 4. Right-click Calculated Columns node and choose New. Enter a name and description (label). Select a data type, and enter length and scale for the calculated column. Select the Column Type to determine whether it is a calculated attribute or a calculated measure. 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. 6. 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. Choose OK.

62

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

6.4.2.2

Mapping Input Parameters

You can map the input parameters in the underlying data sources (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.

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 pane, 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 <mapping icon> 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: 4. 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.

Select Create Constant to create a constant at the target calculation view, .

Note
You can change the constant name by double clicking it.

6.4.2.3

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.

SAP HANA Modeling Guide Information Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

63

Procedure
1. 2. 3. 4. 5. Right-click the attribute in the target list. From the context menu, choose Manage Mappings. To map the source to the target column, select the required source from the dropdown list. To assign a default value to the constant column, enter the value in the Constant Value field. . Select the required data type. Enter the length and scale as required and choose OK.

Related Links Constant Column [page 64]

6.4.2.4

Constant Column

In a union view, a Constant Column is created if there are any target or output attributes for which there are no mappings to the source attributes. The default value for the constant column is NULL.

Note
The target attribute is mapped to all the sources. For example, you have two tables with similar structures, Actual Sales and Planned Sales, corresponding to the sales of products. You want to see the combined data in a single view, but differentiate between the data from the two tables for comparison. To do so, you can create a union view between the two tables and have a constant column indicating constant values like A & P, as shown below: Actual Sales Sales
5000 2000

Product
A1 B1

Planned Sales Sales


3000 6000

Product
A1 B1

The result of this query can be as follows: Actual Planned Indicator


A P A P

Sales
5000 3000 2000 6000

Product
A1 A1 B1 B1

64

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

6.4.2.5

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 runtime error. This behavior of dynamic join is different from the standard (non-dynamic) join. In the standard join, the join condition is static, which means that the join-condition does not change depending on the client query. Whereas in the case of a dynamic join, the join-condition changes based on the query. The dynamic join is only applicable for multi-column join scenarios. Therefore, it is disabled for single column joins. The dynamic join enforces the aggregation before executing the join as opposed to a standard join where the aggregation happens after the join. This means, if a join field is not requested by the client query, its value is first aggregated and then the join condition is executed based on the requested fields.

Example
You want to evaluate the sales data to calculate the sales share for a product. The table shown below contains the product sales data at the region and country level. Region APJ APJ APJ APJ EUR EUR EUR EUR Country IND IND CHN CHN DE DE UK UK Product Prod1 Prod2 Prod1 Prod2 Prod1 Prod2 Prod1 Prod2 Sales 10 10 20 50 50 100 20 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:

SAP HANA Modeling Guide Information Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

65

Table 3: Dynamic Join Result REGION APJ APJ EUR EUR PRODUCT PROD1 PROD2 PROD1 PROD2 SUM(SALES) 30 60 70 130 SUM(TOT_SALES) 90 90 200 200 SUM(SALES_SHAR E) .33 .66 .35 .65

Table 4: Standard Join Result REGION APJ APJ EUR EUR PRODUCT PROD1 PROD2 PROD1 PROD2 SUM(SALES) 30 60 70 130 SUM(TOT_SALES) 90 90 200 200 SUM(SALES_SHAR E) .78 1.21 .73 1.26

The dynamic join delivers the sales share at the region level by aggregating the sales values before joining the data sets. The standard join model first calculates the sales share at the region level plus the country level (because the join condition contains both region and country), and then aggregates the resulting sales share after the join has been executed.

Note
You can specify if a join is dynamic by setting Dynamic Join to true or false.

6.4.2.6

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*')

66

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

the equivalent SQL is where ABC like %abc% .

Procedure
1. 2. 3. 4. Right-click the required attribute. From the context menu, choose Apply Filter. Select the required operator. Enter a value and choose OK.

Note
You can edit a filter using filter expressions from the Output pane which provides more conditions that can be used in the filter including AND, OR, and NOT. For example, to retrieve the sales of a product where (revenue >= 100 AND region = India) OR (revenue >=50 AND region = Germany).

6.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-

SAP HANA Modeling Guide Information Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

67

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.

Procedure
1. Set Parameters for the Analytic Privilege a) If you are in the Modeler perspective, do the following: 1. 2. 3. 4. 5. 6. Expand the system node from the SAP HANA Systems view. Expand the Content node. Select the required package. From the context menu, choose New Analytic Privilege . Enter a name and description for the analytic privilege, and choose Next. 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. 2. 3. 4. 2. Select a project and in the context menu, choose In the pop-up wizard, select SAP HANA Modeler. Select Analytic Privilege. Enter a name and description for the analytic privilege, and choose Finish. New Other... .

Select Applicable to all Information Models optionIf you want to add restrictions for all models.

Note

68

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

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 Fixed Description If you want to create an analytic privilege with static filter conditions such that, once granted to a user, will be automatically applied to all the queries of a user to restrict the query results only to the authorized data. Example For example, DEPARTMENT IN ("Finance", "Development") on the DEPARTMENT attribute of the view. A granted user can then only access records of the view qualifying the filter condition, as the results of all queries of the user on the view are automatically filtered using the filter condition For example, the same filter condition in the example above can be defined as DEPARTMENT IN (GET_DEPARTMENT_FOR_USER( )) Here, GET_DEPARTMENT_FOR_USER is a database procedure, which can contain any arbitrarily complex logic to determine the relevant DEPARTMENT value for a given user. At runtime, the procedure is executed and the obtained result is employed as operand in the actual filter condition DEPARTMENT IN <...>.

Catalog Procedure or Repository Procedure

For example, DEPARTMENT IN ("Finance", "Development") on the DEPARTMENT attribute of the view. A granted user can then only access records of the view qualifying the filter condition, as the results of all queries of the user on the view are automatically filtered using the filter condition

Note
Only views for which the property Enable Analytic Privilege is set to true, are checked for the applied restrictions while querying the views otherwise, no restriction is checked against the view. This is required in some of the scenarios like, the suite virtual data model in which only the query views (top level views)

SAP HANA Modeling Guide Information Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

69

needs to be protected by analytic privileges. The underlying views should only be protected by SQL privileges. The operators supported are: IN <list of scalar value> CONTAINSPATTERN <pattern with *> EQUAL (=), LESSEQUAL (<=), LESSTHAN (<), GREATERTHAN (>), GREATEREQUAL (>=) <scalar value> BETWEEN <scalar value as lower limit> <scalar value as upper limit>. NULL and IS NULL is not supported. 5. Select the required operator and enter a value (manually or via Value Help dialog).

Note
If you are not using the value help for adding value for dynamic privilege, the syntax for repository procedure is <package name>::<procedure name>. In case of catalog procedure, the syntax is "<schema name>".<procedure name>. 6. Activate the analytic privilege using the Save and Activate option in the editor.

Remember
To activate the analytic privilege, you must assign a minimum of one restriction to each attribute.

Note
Select the Save and Activate All option to activate the privilege along with all the required objects. 7. Assign the privilege to a user a) In the SAP HANA Systems view, go to 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. Security Authorizations Users . Select a user.

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
1 2 3 1

CUST_GROUP
GRP1 GRP2 GRP3 GRP4

SALES
1000 1500 1200 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
1 2

CUST_GROUP
GRP1 GRP2

SALES
1000 1500

70

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

CUST_ID
1

CUST_GROUP
GRP4

SALES
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
1

CUST_GROUP
GRP1

SALES
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. CUST_ID
1 2 3 1

COUNTRY
IN IN US DE

MANDT
1 1 1 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
1 2 1

COUNTRY
IN IN DE

MANDT
1 1 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
1

COUNTRY
IN

MANDT
1000

Note

SAP HANA Modeling Guide Information Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

71

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 restricted using the technical name. 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.

Related Links Structure of Analytic Privileges Runtime Authorization Check of Analytic Privileges Dynamic Value Filters in the Attribute Restriction of Analytic Privileges Creation and Management of Analytic Privileges Example: Creating an Analytic Privilege with Dynamic Value Filter

6.6

Importing BW Objects

You can import SAP NetWeaver Business Warehouse (SAP NetWeaver BW) models that are SAP HANAoptimized InfoCubes, SAP HANA-optimized DataStore objects, Standard DataStore Objects, and Query Snapshot InfoProviders to the SAP HANA modeling environment.

Prerequisites
You have implemented SAP Notes 1703061, 1759172, 1752384, 1733519, 1769374, and 1790333. You have upgraded your Modeler to SAP HANA 1.0 SPS06. 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

72

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

You can only import those Standard DataStore objects that have SID Generation set to During Activation. 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, theSAP HANA model is an analytic view. 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: 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 0PRODUCT Table 7: AO2 0CTAIPROV 0CUSTOMER 0CTAACTVT CUBE1, CUBE2 3000 - 4000 03 (display) 1000 - 2000 ABC*

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.

SAP HANA Modeling Guide Information Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

73

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. 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 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 Exclude operator Aggregated value operator : Variables, User exits Authorization on Key Figures

The following features are not supported on generated analytic privileges:

74

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

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.

Procedure
1. 2. 3. 4. 5. Open the Modeler perspective. In the main menu, choose File Import .

Expand the SAP HANA Content node. Choose Import SAP NetWeaver BW Models, and choose Next. 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. 7. Select the target system (an SAP NetWeaver BW on SAP HANA) to which you want to import the models, and choose Next. 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.

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.

SAP HANA Modeling Guide Information Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

75

12. If you want to import the role based analysis authorizations as analytic privileges, select Generate Role based analytic privileges, and choose Next. 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
Quick Launch tab page Package context menu

Activate
A dialog box appears with a preselected list of all your inactive objects. A dialog box appears with a preselected list of all your inactive objects.

Redeploy
A dialog box appears with a list of active objects in your workspace. A dialog box appears with a list of active objects in your workspace.

76

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

Context
Content context menu Editor

Activate
A dialog box appears with a preselected list of all your inactive objects. 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.

Redeploy
Not applicable 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.

SAP HANA Modeling Guide Information Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

77

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 Modeler perspective. Scen ario Objec in Team Provider t in SAP HANA Systems view SAP HANA Systems view Description

User: User: User: U, U1,Workspa U2,Workspa Workspace: ce: WS1 ce: WS2 (default/ other workspace) 1 OBJ1 Inactive Inactive Inactive

Take Over

Activat e

Not Applic able

Allowe If an object has multiple inactive d versions, and the object version in Modeler is also inactive, for example, through delivery unit import or another workspace in Project Explorer, user can activate his own inactive 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 Not If an object has multiple inactive Allowe Allowe versions in the Project Explorer d d and the object version in Modeler is active, neither activation nor take over option is enabled. Allowe Not If an object has single inactive d Allowe version in the Project Explorer, and d the object version in Modeler is active, only take over option is enabled.

OBJ1

Inactive

Active

Active

78

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

Scen ario

Objec in Team Provider t

in SAP HANA Systems view Inactive

SAP HANA Systems view

Description

OBJ1

Inactive

Active

Not Applic able

Allowe If an object has inactive versions in d the Project Explorer and Modeler, only activation option is enabled.

OBJ1

Active

Inactive

Active

Allowe Not If an object has multiple active d Allowe versions such as, one in the Project d Explorer and one in the Modeler, only take over option is enabled. Not Applic able Allowe If an object has single inactive d version, and the object version in Modeler is inactive, only activation option is enabled.

OBJ1

Active

Active

Inactive

OBJ1

Active

Inactive

Inactive

Not Allowe If an object has single active Allowe d version, and the object version in d Modeler is inactive, only activation option is enabled. Not Applic able (Rede ploy) If an object has multiple active versions, and the object version in Modeler is active, only take over activation (redeploy) option is enabled.

OBJ1

Active

Active

Active

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.

SAP HANA Modeling Guide Information Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

79

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.

80

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Information Views

7
7.1

Additional Functionality for Views


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 manyto-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. 2. 3. 4. Select the Semantics node. In the Hierarchies panel, choose Create option. Enter a name and description for the hierarchy. In the Hierarchy Type dropdown, select Level Hierarchy. 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.

SAP HANA Modeling Guide Additional Functionality for Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

81

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 Root Node Error Ignore Step Parent Description Treat them as root nodes Stop processing and show an error Ignore them 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 enables you to assign all the orphaned nodes under this node. The node ID should be entered

82

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Additional Functionality for Views

Option

Description according to the node style selected. For example if the node style selected is level name, the stepparent node ID can be [Level2].[B2].

Note
If you have selected Step Parent in the Orphan Nodes dropdown, enter a value to create the stepparent 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.

SAP HANA Modeling Guide Additional Functionality for Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

83

Procedure
1. 2. 3. 4. Select the Semantics node. In the Hierarchies panel, choose the Create option . Enter a name and description for the hierarchy. In the Hierarchy Type dropdown, choose Parent Child Hierarchy. In the Node tab page, add the parent and child nodes by selecting Parent Node and Child Node from the dropdown list.

Note
If you decide to place the orphaned parent-child pair under a node called Step Parent from the Advanced tab page, you can specify its value in the Step Parent column. You can specify different stepparent values for all the parent-child pairs. These values appear as a comma separated list in the Advance tab page Step Parent 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. 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 Root Node Error Ignore Step Parent Description Treat them as root nodes Stop processing and show an error Ignore them Put them under a stepparent node

Note

84

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Additional Functionality for Views

Option

Description 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 enables 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: in("attr", $$param$$)

SAP HANA Modeling Guide Additional Functionality for Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

85

Then you need to pass several values as: select ... from CV1( 'PLACEHOLDER' = ('$$var$$' = 'VAL1,VAL2,VAL3') For string type parameters The filter expression of a calculation view CV1 is defined as: in("attr", $$param$$) Then you need to pass several values (with double quotes) as: select ... from CV1( 'PLACEHOLDER' = ('$$var$$' = '''VAL1'',''VAL2'',''VAL3''') You use input parameters as placeholders during currency conversion 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
Column Static List Derived From Table

Description
Use this when the value of a parameter comes from an attribute or table column. Use this when the value of a parameter comes from a userdefined list of values. 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. Use this to specify an input parameter as currency and date during currency conversion.

Direct

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 Yes No Expected Behavior Calculates the formula based on the default value Results in error

Note
The table above implies that it is mandatory to provide a value for the input parameter either at runtime or assign a default value while creation, otherwise, it leads to errors.

86

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Additional Functionality for Views

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. 2. In the Scenario panel, select a node. 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. b. Enter a name and description (Label). 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 parameter as a currency or date, for example, to specify the target currency during currency conversion. For a Static List input parameter, specify a list of values along with the data types, length and scale that you would use for the input parameter.

c.

To provide the default value for the input parameter that is considered in case a value at runtime is not provided, choose the option Constant or Expression as required.

Note
You can use expressions for default value when you want to calculate the default value based on some formula like, date(Now()) to perform calculation based on the current date. d. If required, select a data type.

SAP HANA Modeling Guide Additional Functionality for Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

87

e. f.

Enter length and scale for the input parameter. 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. Also, if you copy an input parameter in one editor, go to another view editor, and select a restricted column, a calculated column or an input parameter for copying the paste option in the previous editor is not available. 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
Single Value

Description
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. Use this to filter and view a specific set of data. For example, to view the expenditure of a company from March to April. 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..

Interval Range

Each type of variable can be either mandatory or non-mandatory. For a mandatory variable, you need to provide a value at runtime. For a non-mandatory variable, if you have not specified a value at runtime, you view unfiltered data.

Note
You can check if a variable is mandatory from the properties of the variable in the Properties pane.

88

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Additional Functionality for Views

Procedure
1. In the Semantics node Variables/Input Parameter panel, choose the Create Variable option.

Note
Alternatively, you can invoke the variable dialog by selecting the attribute from the Column panel, and choosing the <Create Variable icon>. If you create variable using this option, the Attribute and Assign variable filter to fields are auto-filled with the selected attribute. 2. 3. Enter a name and description for the variable. 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. 5. 6. Choose the required Selection Type from the dropdown list. 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. 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. 9. To assign the variable to attribute(s), in the Apply variable filter to panel, choose Add. Select the attribute(s) from the dropdown list to which you want to assign this variable.

Note
You can also assign a variable to an attribute later in the Column panel of the Semantics node Details panel. To assign a variable to an attribute, select a variable from the variable dropdown list in the Variable column.

Remember
Once you assign a attribute to the variable, you can delete that variable only after removing the attribute from the Apply variable filter to in the Variable dialog.

SAP HANA Modeling Guide Additional Functionality for Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

89

10. Choose OK.

7.5

Using Currency and Unit of Measure

Use this procedure to define a measure as an amount or weight in the analytical space and to perform currency conversion. 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. 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.

Note
Currency conversion is enabled for analytic views and base measures of calculation views.

Prerequisites
You have imported tables T006 and T006A for Unit of Measure. You have imported TCURC, TCURF, TCURN, TCURR, TCURT, TCURV, TCURW, and TCURX for currency.

Procedure
1. 2. 3. Select a measure. In the Properties pane, select Measure Type. If you want to associate the measure with a currency, do the following: a. b. In the Measure Type dropdown list, select the value Amount with Currency. In the Currency Dialog, select the required Type as follows: Type
Fixed Attribute

Purpose
To select currency from the currency table TCURC. To select currency from one of the attributes used in the view.

c. d.

Select the required value, and choose OK. If you want to convert the value to another currency, choose Enable for Conversion.

90

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Additional Functionality for Views

a. b.

To select the source currency, choose Currency. Select the target currency.

Note
For currency conversion, in addition to the types Fixed and Attribute, you can select an 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 is cleared because input parameters can be used only for currency conversion. c. To specify exchange rate type, in the Exchange Rate Types dialog, select the Type as follows: Type
Fixed Input Parameter

Purpose
To select exchange rate from the currency table TCURW. To provide exchange rate input at runtime as input parameter.

d.

To specify the date for currency conversion, in the Conversion Date dialog, select the Type as follows: Type
Fixed Attribute Input Parameter

Purpose
To select conversion date from the calendar. To select conversion date from one of the attributes used in the view. To provide conversion date input at runtime as input parameter.

e. f. e.

To specify the schema where currency tables are located for conversion, in the Schema for currency conversion, select the required schema. To specify the client for which the conversion rates to be looked for, in the Client for currency conversion, select the required option.

From the dropdown list, select the required value that is used to populate data if the conversion fails: Option
Fail Set to NULL Ignore

Result
In data preview, the system displays an error for conversion failure. In data preview, the value for the corresponding records is set to NULL. 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, do the following: a. b. Select the value Quantity with Unit of Measure in the Measure Type dropdown list. In the Quantity Units dialog , select the required Type as follows: Type
Fixed Attribute

Purpose
To select a unit of measure from the unit tables T006 and T006A. To select a unit of measure from one of the attributes used in the view.

SAP HANA Modeling Guide Additional Functionality for Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

91

c. 5.

Select the required value, and choose OK.

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.

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).

92

PUBLIC 2013 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.

SAP HANA Modeling Guide Additional Functionality for Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

93

8
8.1

Working with Views


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
Auto Arrange Show outline

Purpose
Use this option to arrange the user interface elements automatically. 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. Use this option if you want to view only those tables that are related to a table selected in the editor.

Substeps
In the editor tool bar, choose In the editor tool bar, choose . .

Highlight related tables

1. 2.

In the editor, right-click the selected table. From the context menu, choose Highlight related tables. In the editor, right-click the relevant table. From the context menu, choose Display. If you want to view only the table name, choose Collapsed. If you want to view all the columns of the table, choose Expanded. If you want to view only the joined columns of the table, choose Joins only.

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. 2. 3. 4. 5.

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. For more information about setting preferences, see Setting Preferences for Modeler .

94

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Working with Views

Procedure
1. 2. 3. On the Quick Launch page, choose Validate. From the Available list, select the required models that system must validate. Choose Add 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. 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 is reserved for the future usage of the fault-tolerant search.

SAP HANA Modeling Guide Working with Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

95

Fuzziness Threshold: This parameter is reserved for the future usage of the fault-tolerant search.

Note
It is recommended to use the default values for ranking and fuzziness at the beginning. You can fine-tune the search settings based on the experience gained using the search. You can also fine-tune the search using feedback collected from your users.

8.5

Previewing Data of Content Objects

You use this procedure to preview the content of content models for analysis purposes. 1. 2. 3. In the Modeler perspective, expand the Content node of the required system. Select the object from a package for which you want to view the content. From the context menu, choose Data Preview. The system displays the content in different formats as shown in the table below. Tab Page
Raw Data Distinct values Analysis

Displays
All attributes along with data in a table format. All attributes along with data in a graphical format. All attributes and measures in a graphical format.

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.

Note
If you refresh the Analysis or Distinct values view, the behavior is as follows: The selection of the columns in Lables Axis and Values Axis panel of the Analysis view, and in the select objects panel of the Distinct values view gets cleared. 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.

4.

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.

96

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Working with Views

Conversion Functions Function


int float

Syntax
int int(arg) float float(arg)

Purpose
convert arg to int type convert arg to float type

Example
int(2) float(3.0)

double sdfloat decfloat fixed

double double (arg) sdfloat sdfloat (arg) decfloat decfloat (arg) fixed fixed (arg, int, int)

convert arg to double type convert arg to sdfloat type convert arg to decfloat type 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 convert arg to string type convert arg to raw type 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. convert arg to longdate type, similar to date function above.

double(3)

fixed(3.2, 8, 2) + fixed(2.3, 8, 3)

string raw date

string string (arg) raw raw (arg) 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)

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')

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)

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)

convert arg to time type, similar to date function above

SAP HANA Modeling Guide Working with Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

97

Function

Syntax
time time(int, int) time time(int, int, int)

Purpose

Example

String Functions Function


strlen midstr

Syntax
int strlen(string) string midstr(string, int, int)

Purpose
returns the length of a string in bytes, as an integer number. returns a part of the string starting at arg2, arg3 bytes long. arg2 is counted from 1 (not 0)

leftstr

string leftstr(string, int)

returns arg2 bytes from the left of the arg1. If arg1 is shorter than the value of arg2, the complete string will be returned.

rightstr

string rightstr(string, int)

returns arg2 bytes from the right of the arg1. If arg1 is shorter than the value of arg2, the complete string will be returned.

instr

int instr(string, string)

returns the position of the first occurrence of the second string within the first string (>= 1) or 0, if the second string is not contained in the first.

hextoraw

string hextoraw(string)

convert a hexadecimal representation of bytes to a string of bytes. The hexadecimal string may contain 0-9, upper or lowercase a-f and no spaces between the two digits of a byte; spaces between bytes are allowed.

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

98

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Working with Views

Function

Syntax

Purpose
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). removes whitespace from the beginning and end of a string.

trim

string trim(string) string trim(string, 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). add whitespace to the end of a string. A second string argument specifies the whitespace which will be added repeatedly until the string has reached the intended length. If no second string argument is specified, chr(32) (' ') will be added. This function operated on UTF-8 bytes and has no knowledge of unicode characters (neither for the whitespace string nor for length computation).

rpad

string rpad(string, int) string rpad(string, int, string)

replace

string replace(string, string, string)

replace every occurrence of arg2 in arg1 with arg3 and return the resulting string

Mathematical Functions Function


sign

Syntax
int sign(double) int sign(time)

Purpose
Sign returns -1, 0 or 1 depending on the sign of its argument. Sign is

Example

SAP HANA Modeling Guide Working with Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

99

Function

Syntax
int sign(date)

Purpose
implemented for all numeric types, date and time. Abs returns arg, if arg is positive or zero, -arg else. Abs is implemented for all numeric types and time.

Example

abs

double abs(double) decfloat abs(decfloat) decfloat abs(decfloat) time abs(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


utctolocal

Syntax
utctolocal(datearg, timezonearg)

Purpose
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 returns the weekday as an integer in the range 0..6, 0 is monday. returns the current date and time (localtime of the server timezone) as date 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,

weekday now

weekday(date) now()

daysbetween

daysbetween(date1, date2) daysbetween(daydate1, daydate2) daysbetween(seconddate1, seconddate2) daysbetween(longdate1, longdate2)

100

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Working with Views

Function

Syntax

Purpose
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. 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. 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.

addseconds

addseconds(date, int) addseconds(seconddate, decfloat) addseconds(longdate, decfloat)

adddays

adddays(date, int) adddays(daydate, int) adddays(seconddate, int) adddays(longdate, int)

Misc Functions Function


if

Syntax
if(intarg, arg2, arg3)

Purpose

Example

return arg2 if intarg is if("NETWR"<=500000,'A', considered true (not equal to if("NETWR"<=1000000,'B','C ') ) 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.

SAP HANA Modeling Guide Working with Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

101

Function
in

Syntax
in(arg1, ...)

Purpose
return 1 (= true) if arg1 is equal to any of the remaining args, return 0 else

Example

case

case(arg1, default) case(arg1, return value1 if arg1 == cmp1, cmp1, value1, cmp2, value2 if arg1 == cmp2 etc, value2, ..., default) default if there no match isnull(arg1) return 1 (= true), if arg1 is set to null and null checking is on during Evaluator run (EVALUATOR_MAY_RETURN _NULL)

case("CATEGORY", 'A', 'LV', 'B', 'MV', 'HV')

isnull

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.

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.

102

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Working with Views

Procedure
1. 2. 3. Enter the object that you want to search in the Modeler toolbar search field. Choose the system in which you want to search the object from the dropdown option next to the Search button. 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 General Keys and select Modeler as scheme. Window Preferences

Note
Copy-paste is supported only for a single object.

Procedure
1. In the SAP HANA Systems view, select an object and in the contect menu, choose Copy.

Note
If you have applied the keyboard shortcuts then you can also press CTRL + C to copy an object. 2. Navigate to the package where you want to paste the object, and choose Paste.

Note

SAP HANA Modeling Guide Working with Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

103

If you have applied the keyboard shortcuts then you can also press CTRL + V to paste an object.

104

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Working with Views

Creating Decision Tables

You use this procedure to create a decision table to model related business rules in a tabular format for decision automation. Using decision tables you can manage business rules, data validation, data quality rules without any IT knowledge on technical languages like, SQL Script, 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.

Procedure 1. Set Parameters


1. 2. 3. 4. In the Modeler perspective, expand <System Name> New Content <Package Name> . .

In the context menu of the package, choose

Decision Table

In the New Decision Table dialog box, enter a name and description for the decision table. To create data foundation for the decision table, perform substeps of the required scenario given in the table below: Scenario
Create a decision table from scratch.

Substeps
1. 2. Choose Create New. Choose Next.

Note
If you launch the New Decision Table dialog from the Quick Launch tab page, specify the package where you want to save the decision table. 3. Add the required tables, table type or an information view to the Selected list.

Note
You can choose to add the required data sources to the decision table later by dragging them from the Catalog node in the Navigator view to the Data Foundation panel. 4. Create a decision table from an existing decision table. 1. Choose Finish. 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 decision table. 2. 3. Select the required decision table. Choose Finish.

SAP HANA Modeling Guide Creating Decision Tables

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

105

Note
Only an active version of an information view can be used. Any changes made to the information view are not reflected in the decision table. You can create a decision table using an analytic view only if it has a calculated attribute. If you choose to create a decision table based on a table type or an information view, you cannot add any other data source. This implies that a decision table can be based on multiple tables or a table type or an information view. You can add only one table type or information view to the data foundation. You can mark table type columns and information view columns only as conditions. While designing decision table using information view, you can only use view's attributes as conditions and not the other attributes. In addition, you can use only parameters as actions.

Remember
You can set the decison table property Multually Exclusive to true or false. By default, the value of this property is set to true. If set to true, as soon as any condition row is matched in decision table the search is stopped even though there might be other rows that could have been matched. This required additional effort to model the decision table in specific way such that the more specific rules appear on top of the decision table and general rules appear at the end. If the value is set to false, all the condition rows are checked and based on the best suited match, the action value is updated. For example, consider a scenario where you would like to give the Discount as 5 % on all the Cold Drinks in the Summer Season for Country India. If the decision table has been modeled as below: Country India India India Season Summer Any Summer Drinks Any Any Cold Drink Discount 7 2 5

If Mutually Exclusive is set to true, the first row would be matched and it would lead to Discount as 7%. If it is set to false, the third row would be considered providing discount as 5%.

2. Create Joins
1. If you want to define a relationship between tables to query data from two or more tables, do the following: a. b. c. In the editor pane, from the context menu, choose Create Join. In the Create Join dialog, select the required tables, columns, join type, and cardinality. Choose Create Join.

Note
You can also create a join between table columns by dragging it from one table column to another table column. The supported join types are inner, left outer and right outer.

106

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Creating Decision Tables

3. Add Conditions and Actions


1. In the Data Foundation view, select the required column, and perform substeps of the required scenario given in the table below: Scenario
Include table field in the output structure.

Substeps
From the context menu, choose Add as Attribute.

Note
Attributes contains a subset of columns that you use to derive conditions and actions. Add conditions based on which you want to derive actions.

1. 2.

In the Output view, select the required attributes . From the context menu, choose Add as Conditions. In the Output view, select the required attributes . From the context menu, choose Add as Actions.

Add actions for the selected conditions.

1. 2.

2.

To add condition values, do the following: a. In the Decision Table view, right-click a condition, and choose Add Conditions Values.

Note
The supported data types for an operator are: Operator Not Equal To In Not In Like Not Like Greater Than Greater Than or Equals Less Than Less Than or Equals Between Before Date Number Dates Number & CHAR-based Supported Data Types Number & CHAR-based Number & Char-based Number & Char-based CHAR-based CHAR-based Number & CHAR-based Syntax != ABC In ABC;CDA Not In A;B;C Like Abc* Not Like Abc* >20 >=20 <10 <=10 Between 20 and 30 Before 2012-12-12 Or < 2012-12-12 After Date Dates After 2012-12-12

SAP HANA Modeling Guide Creating Decision Tables

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

107

Operator

Supported Data Types

Syntax Or > 2012-12-12

Between Date

Dates

Between 2012-12-12 and 2012-12-25

b.

Enter a value, and choose OK.

Note
If a database table column is used as 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 having data type as 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

3. 4.

To set action values, right-click an action cell, and enter value. If you want to write a complex expression as action or condition value, do the following: a. b. c. d. Right-click the action field. From the context menu, choose Set Dynamic Value. Write the expression for example, PRICE-(PRICE*0.1). To edit a value you need to select that value.

Note
You can use parameters and table columns of the same data type as that of the action or condition in expressions. 5. 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 search and choose Find, all the data corresponding to the selected column is shown. b. Select a value, and choose OK.

Remember
You can provide an alias name to a condition or an action by editing the value of Alias name property. You can choose to create parameters and use them as conditions or actions. The values you provide to the parameters at the runtime determine which data records are selected for consumption. For more information regarding how to use parameters, Using Parameters in a Decision Table [page 112]. You can export decision table data to an excel sheet using context menu option Export Data to Excel in the Decision Table view. You can also import decision table data from an excel using context menu option Import Data from Excel in the Decision Table view.

108

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Creating Decision Tables

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 [page 111].

6. Optional Step: Validate Decision Table


1. To set the rules that you want to use for validation do the following: a. b. c. d. e. 2. Choose Window Preferences . Modeler Validation Rules .

In the Preferences dialog box, expand

In the Validation Rules view, select Decision Table checkbox to check for all the rules during validation. If you want to check for individual rules, select the required rules. Choose OK. .

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

7. Activate Decision Table


1. 2. Choose File Save .

From the context menu of the decision table, choose Activate.

Note
You can choose to save and activate the view from the editor using .

Result: On successful activation, a procedure corresponding to the decision table is created in _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 _SYS_BIC schema. The name of the table type is in the format, <package name>/<decision table name>/TT.

Remember
If in a decision table, parameters are used as conditions then corresponding IN parameters are generated. Also, if the parameters are used as actions then an OUT parameter is generated.

8. Execute Decision Table Procedure


1. To execute the decision table procedure perform the following steps as required:

SAP HANA Modeling Guide Creating Decision Tables

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

109

Data Source Physical tables Physical tables

Condition Physical table column Parameters

Action Physical table column Physical table column Parameters Parameters

Script call "<schema name>"."<procedure name>"; call "<schema name>"."<procedure name>"(<IN parameter>,,<IN parameter>); call "<schema name>"."<procedure name>"(?); call "<schema name>"."<procedure name>"(<IN parameter>,,<IN parameter>,?); call "<schema name>"."<procedure name>"(?); call "<schema name>"."<procedure name>"(<IN parameter>,,<IN parameter>,?); call "<schema name>"."<procedure name>"(?); call "<schema name>"."<procedure name>"(<IN parameter>,,<IN parameter>,?);

Physical tables Physical tables

Physical table column Parameters

Information View Information View Table Type Table Type

View attributes Parameters

Parameters Parameters

Table Type column Parameters

Parameters Parameters

Remember
The order of the parameter while executing the procedure must be same as in the Output panel, and not as used in the Decision Table.

Tip
You can view the procedure name using the Open Definition context menu option on the selected procedure. Result: On 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. Data Preview
To preview the populated data in the decision table, in the Decision Table editor, from the toolbar, choose Open Data Preview.

110

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Creating Decision Tables

Restriction
Data preview is supported only if: A decision table is based on physical tables and has at least one parameter as action. A decision table is based on information views and parameter(s) as action.

9.1

Changing the Layout of a Decision Table

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 first the horizontal condition is evaluated 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 select only one condition as horizontal condition.

Procedure
1. 2. In the context menu of the Decision Table editor, choose Change Layout. If you want to view a condition as a horizontal condition, in the Change Decision Table Layout dialog, select Table has Horizontal Condition (HC) checkbox.

Note
By default the first condition in the list of conditions is marked as horizontal. 3. In the Conditions and Actions sections, choose options on the right-hand side of the dialog box to arrange the conditions and actions in the desired sequence.

Note
The available options to arrange the conditions in a sequence are: 4. 5. Move Condition to Top Move Condition Up Move Condition Down Move Condition to Bottom

Choose OK. Save the changes.

Note

SAP HANA Modeling Guide Creating Decision Tables

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

111

You can also set a condition as horizontal from the context menu of the condition in the Output view. You can also arrange the conditions and actions in the desired sequence in the Output view using the respective buttons.

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, determine the set of physical table rows to be updated based on the condition value that you provide at runtime during procedure call. Parameters used as actions, simulate the physical table without updating to it. The following parameter types are supported: Type
Static List Empty

Description
Use this when the value of a parameter comes from a userdefined list of values. Use this when the value of a parameter could be anything of the selected data type.

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 be:
Quantity >5 >=10 Order Amount 50000 100000 Discount 10 15

Procedure 1. Create a Parameter


1. 2. In the Output pane, right-click the Parameters node. From the context menu, choose New and do the following: a. b. c. Enter a name and description. Select the required data type from the dropdown list. Enter the length and scale as required.

112

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Creating Decision Tables

d.

Choose the required Type from the dropdown list.

Note
If you have selectedStatic 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.

2. Use Parameter as Condition or Action


1. 2. In the Output pane, expand the Parameters node. Right-click a parameter, choose Add As Conditions/ Add as Actions.

9.3

Using Calculated Attribute 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 some calculation using the existing attributes, calculated attributes, parameters, and SQL functions.

Procedure
1. 2. In the Output pane, select the Calculated Attributes node. 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 the example of string concatenation function using for deriving the name of a person using the first name and last name values present in the table fields.

Note
You can also assemble the expression by dragging and dropping the expression elements from the editor options below. Only arithmetic operators and SQL functions are supported for expression creation.

SAP HANA Modeling Guide Creating Decision Tables

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

113

3. 4.

Choose OK. Add the required calculated attribute as condition.

114

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Creating Decision Tables

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
Switch Ownership

Purpose
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 To take a single inactive object from another workspace that you wish to edit using the editor.

Take Over

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. b. c. d. 2. a. b. In the Quick Launch page, choose Switch Ownership. In the Source User field, select the user who owns the inactive objects. Add the required inactive objects to the Selected Models section. Choose OK. In the editor toolbar, select Switch Version. Choose Take Over.

If an object opens in read-only mode and you want to edit it, do the following:

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.

SAP HANA Modeling Guide Managing Object Versions

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

115

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. 2. 3. 4. 5. 6. In the Modeler perspective, expand the Content node of the required system. Select the required object from a package. From the context menu, choose Open. In the editor pane, choose Show Active Version. Compare the inactive and active versions of the object. 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. 2. 3. In the Modeler perspective, expand the Content node of the required system. Select the required object from a package. From the context menu, choose History.

116

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Managing Object Versions

11

Managing Views

11.1

Checking Model References

You use this procedure to identify whether an information model is referenced by any other information model(s).

Procedure
1. 2. 3. 4. 5. In the Modeler perspective, expand the system node in the SAP HANA Systems view. Expand the Content node. Expand the required package node. Select the required object. From the context menu, choose Where Used.

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.

Procedure
1. 2. 3. 4. From the Quick Launch tab page, choose Migrate. Select the required objects. Choose Add. Choose OK.

Result
Object texts along with the corresponding elements are flagged for translation. These objects can be viewed in multiple languages provided that the object texts are translated.

SAP HANA Modeling Guide Managing Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

117

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
Attribute View

Description
General object properties, attributes, calculated attributes (that is, calculated columns of type attribute), data foundation joins, cross references, and where-used 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 General object properties, attributes, calculated attributes, measures, calculated measures, counters, variables, input parameters, calculation view SQL script, cross references, and where-used Sub-packages, general package properties, and list of content objects

Analytic View

Calculation View

Package

Procedure
1. 2. From the Quick Launch page, choose Auto Documentation. In the Select Content Type field, select one of the following options as required: Option
Model Details Model List

Description
To generate documentation for models such as attribute, analytic, and calculation views. To generate documentation for packages.

3. 4. 5.

Add the required objects to the Target list. Browse the location where you want to save the file. Choose Finish.

118

PUBLIC 2013 SAP AG or an SAP affiliate company. All rights reserved.

SAP HANA Modeling Guide Managing Views

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
Base Object- active Impacted Object- active Base Object- inactive Impacted Object- inactive Base Object- active Impacted Object- inactive Base Object- inactive Impacted Object- active

At Target
Base Object- active Impacted Object- active Base Object- inactive Impacted Object- inactive Base Object- active 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. 2. 3. 4. 5. 6. Open the Modeler perspective. In the SAP HANA Systems view, expand the Content node. Select the required objects, in the context menu, choose Refactor Move .

In the Move dialog, select the target package where you want to move the package/objects, and choose Next. If you want to skip the movement of objects/packages, in the Changes to be performed panel, deselect them. Choose Finish.

SAP HANA Modeling Guide Managing Views

PUBLIC
2013 SAP AG or an SAP affiliate company. All rights reserved.

119

www.sap.com/contactsap

2013 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.