SAP HANA Modeling Guide For SAP HANA Web Workbench
SAP HANA Modeling Guide For SAP HANA Web Workbench
SAP HANA Modeling Guide For SAP HANA Web Workbench
This guide explains how to create information views based on data that can be used for analytical purposes
using the SAP HANA modeler. It Includes graphical & script based calculation views and analytic privileges that
governs data access to information views.
Modeling refers to an activity of refining or slicing data in database tables by creating information views that
depict a business scenario. You can use these information views for any reporting and decision making
purposes.
Information views consume various combinations of content data (that is, nonmetadata) to model a business
use case. You can classify content data as:
Creating an information view involves simulation of entities (such as customer, product, sales and so on.) and
their relationship. Data visualization and analysis applications such as SAP BusinessObjects Explorer and
Microsoft Office based reporting tools consume these information views and helps decision makers in their
decision process.
SAP HANA Web based modeler provides extensive capabilities that helps you to create and edit information
views (content models). It also helps you to create analytic privileges that govern the data access to
information views.
You can create the following information view types in using SAP HANA Web based modeler:
This guide is intended for data modelers or business analyst or data analysts or application developers building
database models or database experts involved in the processes of defining data models and schemas,
database tables, information views, primary keys, indexes, partitions and all other aspects of layout and
interrelationship of data in SAP HANA.
Related Information
Web-based development environments provide data modelers with tools that enable access to repository and
catalog objects from a remote location, for example, using a Web browser.
SAP HANA Web workbench is a Web-browser based Integrated Development Environment that runs on SAP
HANA Extended Application Services( SAP HANA XS). It offers data modelers and other user personas the
modeling tools to work with SAP HANA content repository and SAP HANA database catalog objects, from a
remote location. By using a browser, without requiring them to install any software locally, user can execute the
data modeling tasks quickly and easily.
Note
The SAP HANA Web-based Development Workbench is available on the SAP HANA XS Web server at the
following URL: http://<WebServerHost>:80<SAPHANAinstance>/sap/hana/ide. SAP HANA Web-
based Development Workbench supports Microsoft Internet Explorer (10+), Mozilla Firefox, and Google
Chrome Web browsers.
Related Information
Before you start using the SAP HANA Web-based Development Workbench, the SAP HANA administrator must
set up a user account for you in the database and assign the required modeling roles.
If modelers are using the SAP HANA Web-based Development Workbench, the privileges that they require for
creating and activating information views as well as tool access are bundled into the following roles:
● sap.hana.xs.ide.roles::EditorDeveloper
● sap.hana.xs.debugger::Debugger
For more information, see SAP HANA Web-Based Development Workbench in the SAP HANA Developer Guide
(For Web Workbench)
Note
If you want to grant users with full data access to all information views in your SAP HANA system, then
assign the analytic privilege _SYS_BI_CP_ALL to the users, for example, in development systems. If you
want to grant only restricted data access to information views, for example, in production systems, then
create an analytic privilege with filters by including these information views as secured models, and assign
this analytic privilege to the user role. For more information, see Defining Data Access Privileges.
Attributes and measures form content data that you use for data modeling. The attributes represent the
descriptive data, such as region and product. The measures represent quantifiable data such as revenue and
quantity sold.
Attributes
Simple Attributes Individual nonmeasurable analytical ele For example, PRODUCT_ID and PRODUCT_NAME
ments that are derived from the data are attributes of product data source.
sources.
Calculated Attributes Derived from one or more existing attrib For example, deriving the full name of a customer
utes or constants. (first name and last name), assigning a constant
value to an attribute that can be used for arithmetic
calculations.
Measures
Measures are measurable analytical elements that are derived from calculation views.
Calculated Measures Calculated measures are defined based For example, you can use calculated measures to
on a combination of data from other data calculate the net profit from revenue and opera
sources, arithmetic operators, constants, tional cost.
and functions.
Counters Counters add a new measure to the calcu For example, to count how many times product
lation view definition to count the distinct appears and use this value for reporting purposes.
occurrences of an attribute.
A calculation view is a powerful and flexible information view, which you can use to define more advanced slices
on the data available in the SAP HANA database. Calculation views are simple and they mirror the functionality
found in both attribute views and analytic views and much more.
However, you use calculation views when your business use case requires advanced logic, which you cannot
achieve by creating the previous analytic views or attribute views. For example, you can create calculation
views with layers of calculation logic, which includes measures sourced from multiple source tables, or
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 data sources.
Calculation views can include measures and be used for multidimensional reporting or can contain no
measures and used for list-type reporting. There are two types of calculation views that you can create:
● Graphical calculation views, which you can create using a graphical editor.
● Script-based calculation views, which can you create by writing SQL scripts.
Related Information
Create graphical calculation views using a graphical editor to depict a complex business scenario with ease.
You can create graphical calculation views to include layers of calculation logic and with measures from
multiple data sources.
Context
Creating graphical calculation views is useful in bringing together normalized data that are generally dispersed.
You can combine multiple transaction tables and analytic views, while creating a graphical calculation view.
Procedure
Modeler launches a new graphical calculation view editor with the semantics node and default aggregation
or projection node depending on the data category of the calculation view.
8. Continue modeling the graphical calculation view by dragging and droping the necessary view nodes from
the tools pallete.
9. From the editor’s tools pallete, drag and drop a view node type to the editor.
b. Choose .
c. In the Find Data Sources dialog, enter the name of the data source and select it from the list.
You can add one or more data sources depending on the selected view node.
d. Choose OK.
Note
If you want to retrieve columns of aggregation or projection nodes to the result set even if you do not
request it in your query. In other words, if you want to include those columns into the SQL group
by clause even if you do not select them in the query, then:
1. Select Semantics node.
2. In the Columns tab select the Keep Flag checkbox for the required attributes.
If you are creating a calculation view with data category as cube, then to successfully activate the
information view, you have to specify at least one column as a measure.
If the value is set to Cube, an additional Aggregation column is available to specify the aggregation type
for measures.
Note
If you are using any attribute view as a data source to model the calculation view, the Shared section
displays attributes from the attribute views that are used in the calculation view.
a. In the navigator toolbar, choose the icon or the keyboard shortcut Ctrl + S to save and
activate your calculation view.
b. In the open change list, select a change ID that you want to use to assign your changes.
Note
The change list appears only if you have enabled change tracking for your SAP HANA system.
Next Steps
After creating a graphical calculation view, you can perform certain additional tasks to obtain the desired
output. The table below lists the additional tasks that you can perform to enrich the calculation view.
If you want to query data from two data sources and combine records from both the Create Joins
data sources based on a join condition or to obtain language specific data.
If you want to query data from database tables that contains spatial data. Create Spatial Joins
If you want to validate joins and identify whether you have maintained the referential Validate Joins
integrity.
If you want to combine the results of two more data sources. Create Unions
If you want to partition the data for a set of partition columns, and perform an order Create Rank Nodes
by SQL operation on the partitioned data.
If you want to filter the output of projection or aggregation view nodes. Filter Output of Aggregation or Pro
jection View Nodes.
If you want to count the count the number of distinct values for a set of attribute col Create Counters
umns.
If you want to create new output columns and calculate its values at runtime using an Create Calculated Columns
expression.
If you want to restrict measure values based on attribute restrictions. Create Restricted Columns
If you want to assign semantic types to provide more meaning to attributes and Assign Semantics
measures in calculation views.
If you want to parameterize calculation views and execute them based on the values Create Input Parameters
users provide at query runtime.
If you want to, for example, filter the results based on the values that users provide to Assign Variables
attributes at runtime.
If you want associate measures with currency codes and perform currency conver Associate Measures with Currency
sions.
If you want associate measures with unit of measures and perform unit conversions. Associate Measures with Unit of
Measure
If you want to create level hierarchies to organize data in reporting tools. Create Level Hierarchies
If you want to create parent-child hierarchies to organize data in reporting tools. Create Parent-Child Hierarchies
If you want to group related measures together in a folder. Group Related Measures.
If you want to filter the view data either using a fixed client value or using a session Filter Data for Specific Clients
client set for the user.
If you want to execute time travel queries on calculation views. Enable Calculation Views for Time
Travel Queries
If you want to invalidate or remove data from the cache after specific time intervals. Invalidate Cached Content
Related Information
Create graphical calculation view with star joins to join multiple dimensions with a single fact table. In other
words, you use star joins to join a central entity to multiple entities that are logically related.
Context
Star joins in calculation views help you to join a fact table with dimensional data. The fact table contains data
that represent business facts such price, discount values, number of units sold and so on. Dimension tables
represent different ways to organize data, such as geography, time intervals, contact names and so on.
Procedure
Note
You can create star join with data category as cube only.
7. Choose Create.
Modeler launches a new graphical calculation view editor with the semantics node and the star join node.
8. Add data sources.
a. Select the Star Join node.
b. Choose .
c. In Find Data Sources dialog, enter the name of the calculation view with descriptive data.
Note
You can only add calculation views with data category types as dimension or blank as a data source
in star join node.
d. Choose OK.
9. Add inputs to star join node.
Continue modeling the graphical calculation view with a cube structure, which includes attributes and
measures. The input to the star join node must provide the central fact table.
10. Maintain star join properties.
a. Select the Star Join node.
b. In the Join Definition tab, create joins by selecting a column from one data source, holding the mouse
button down and dragging to a column in the central fact table.
c. Select the join.
d. In the Properties section, define necessary join properties.
11. Activate the calculation view.
a. If you want to activate the calculation view, in the menu bar, choose Save.
b. If you want to activate the calculation view along with all objects, in the menu bar, choose Save All.
12. Assign changes.
a. In the open change list, select a change ID that you want to use to assign your changes.
Note
The change list appears only if you have enabled change tracking for your SAP HANA system.
b. Choose Assign.
Related Information
Table functions as a data source in graphical calculation views helps build calculation views for complex
calculation scenarios. Using table functions in graphical calculation views are an alternate to script-based
calculation views, which you generally use for building complex calculation views.
Procedure
3. Choose .
4. In the Find Data Sources dialog, enter the name of the table function and select it from the list.
5. Choose OK.
Considering the different business scenario and reporting use cases, SAP HANA modeler offers different view
nodes to model graphical calculation views.
The following table lists the view nodes and its description.
Note
You can use data sources, union, join, projection, or aggregation view nodes and the inputs to union, join,
projection, and aggregation view nodes.
Related Information
View nodes form the buidling blocks of information views. These view nodes help you build complex, flexible
and robust analytic models, and each view node type possess specialized capabilities that triggers advanced
features in the database.
This section describes the different views nodes that you can use within graphical calculation views, its
functionalities and examples on how you can use these views nodes to build calculation views and obtain the
desired output.
Related Information
Use join nodes in calculation views to query data from two data sources. The join nodes help limit the number
of records or to combine records from both the data sources, so that they appears as one record in the query
results.
Procedure
b. Choose .
c. In the Find Data Sources dialog, enter the name of the data source and select it from the list.
d. Choose OK.
4. Define output columns.
a. Select the Mapping tab.
b. Select the columns you want to add to the output of the join node.
c. In the context menu, choose Add To Output.
Note
If you want to add all columns of a data source to the output, in the context menu of the data source,
choose Add To Output.
5. Create a join.
a. In the Join Definition tab, create a join by selecting a column from one data source, holding the mouse
button down and dragging to a column in the other data source.
b. Edit join properties.
Related Information
Create spatial joins by using the join nodes in graphical calculation views to query data from data sources that
have spatial data.
Procedure
b. Choose .
c. In the Find Data Sources dialog, enter the name of the data source with spatial data and select it from
the list.
d. Choose OK.
4. Define output columns.
a. Select the Mapping tab.
b. Select the columns you want to add to the output of the join node.
c. In the context menu, choose Add To Output.
Note
If you want to add all columns from the data source to the output, in the context menu of the data
source, choose Add To Output.
5. Create a join.
a. In the Join Definition tab, create a join by selecting a column from one data source, holding the mouse
button down and dragging to a column in the other data source.
For spatial joins, you join the two databases tables on columns of spatial data types.
6. Define spatial join properties.
Note
If you select Relate as the predicate value, in the Intersection Matrix value help, select a value.
Similarly, if you select Within Distance as the predicate value, in the Distance value help, select a
b. If you want to execute the spatial join only if predicate condition evaluates to true, then in the
dropdown list, select True.
Related Information
SAP HANA modeler offers spatial data types in its data model and query language for storing and accessing
geospatial data.
Geometries The term geometry means the overarching type for objects such as points, linestrings, and
polygons. The geometry type is the supertype for all supported spatial data types.
Points A point defines a single location in space. A point geometry does not have length or area. A
point always has an X and Y coordinate.
In GIS data, points are typically used to represent locations such as addresses, or geo
graphic features such as a mountain.
Linestrings A linestring is geometry with a length, but without any area. ST_Dimension returns 1 for
non-empty linestrings. Linestrings can be characterized by whether they are simple or not
simple, closed or not closed. Simple means a linestring that does not cross itself. Closed
means a linestring that starts and ends at the same point. For example, a ring is an exam
ple of simple, closed linestring.
In GIS data, linestrings are typically used to represent rivers, roads, or delivery routes.
In GIS data, multilinestrings are often used to represent geographic features like rivers or a
highway network.
Polygons A polygon defines a region of space. A polygon is constructed from one exterior bounding
ring that defines the outside of the region and zero or more interior rings, which define
holes in the region. A polygon has an associated area but no length.
In GIS data, polygons are typically used to represent territories (counties, towns, states,
and so on), lakes, and large geographic features such as parks.
In GIS data, multipolygons are often used to represent territories made up of multiple re
gions (for example a state with islands), or geographic features such as a system of lakes.
A text join helps obtain language-specific data. It retrieves columns from a text table based on the session
language of the user.
The text tables contain description for a column value in different languages. For example, consider a PRODUCT
table that contains PRODCUT_ID and a text table PRODUCT_TEXT that contains the columns PRODUCT_ID,
DESCRIPTION, and LANGUAGE.
PRODUCT
PRODUCT_ID SALES
1 1000
2 2000
3 4000
PRODUCT_TEXT
1 E Description in English.
1 D Description in German.
2 E Description in English.
3 E Description in English.
Create a text join to join the two tables and retrieve language-specific data using the language column
LANGUAGE. For example, if your session language is E and if you have added all columns to the output of the join
view node, the output of the text join is:
Note
For text joins, always add the text table as the right table.
After creating a join between two data sources, you can define the join property as dynamic. Dynamic joins
helps improve the join execution process by reducing the number of records processed by the join view node at
runtime.
Dynamic joins are special type of joins. In this join type, two or more fields from two data sources are joined
using a join condition that changes dynamically based on the fields requested by the client. For example –
Table1 and Table2 are joined on Field1 and Field2. But, if only one, Field1 or Field2 is requested by a client, the
tables (Table1 and Table2) are joined based only on the requested field (Field1 or Field2).
Note
You can set the Dynamic Join property only if the two data sources are joined on multiple columns.
Dynamic join behavior is different from the classical join behavior. In the classical join, the join condition is
static. This means that, the join condition does not change irrespective of the client query. The difference in
behavior can result in different query result sets. Use dynamic joins with caution.
At least one of the fields involved in the join condition is part of the client query. If you define a join as dynamic,
the engine dynamically defines the join fields based on the fields requested by the client query. But, if the field
is not part of the client query, it results in query runtime error.
● In static joins, the join condition isn't changed, irrespective of the client query.
● In a dynamic join, if the client query to the join doesn't request a join column, a query runtime error occurs.
This behavior of dynamic join is different from the static joins.
● Dynamic join enforces aggregation before executing the join, but for static joins the aggregation happens
after the join. This means that, for dynamic joins, if a join column is not requested by the client query, its
value is first aggregated, and later the join condition is executed based on columns requested in the client
query.
Related Information
Consider that you want to evaluate the sales of a product and also calculate the sales share of each product
using the following data sources.
SALES
APJ IND 10
APJ IND 10
APJ CHN 20
APJ CHN 50
EUR DE 50
EUR DE 100
EUR UK 20
EUR UK 30
PRODUCT
EUR DE PROD1
EUR DE PROD2
EUR UK PROD1
EUR UK PROD2
So you use a calculation view to join the above two data sources via two different aggregation view nodes as
inputs to the join view node. The aggregation view node with the data source SALES does not has the PRODUCT
column but contains total sales for a given region or country.
Now assume that the two aggregation view nodes join dynamically on the columns, REGION and COUNTRY.
The outputs of the join view node are columns REGION, PRODUCT, SALES and the calculated columns,
TOT_SALES, and SALES_SHARE.
When you execute a client query on the calculation view to calculate the sales share of a product at a region
level, the output from the dynamic join and static join is different:
Dynamic Join
Static Join
The dynamic join calculates the sales share at the region level by aggregating the sales values before joining the
data sources. The static join, on the other hand, first calculates the sales share at the region level and the
country level (because the join condition contains both region and country), and then aggregates the resulting
sales share after the join is executed.
While executing the join, by default, the query retrieves join columns from the database even if you don't
specify it in the query. The query automatically includes the join columns into the SQL GROUP BY clause
without you selecting them in the query.
You can avoid this default behavior by using the join property Optimizing Join Columns. When this property for
a join is set to True, only the columns specified in the query are retrieved from the database.
Note
Optimizing join columns is supported only for left outer joins with cardinality 1:1 or N:1, text joins with
cardinality 1:1 or N:1, right outer joins with cardinality 1:1 or 1:N, and referential joins.
If the filters are defined on join columns for which you have enabled Optimize Join Columns, the join optimizer
cannot remove attributes of static filters. In this case, you can optimize the join column by introducing a
dummy projection view node between the join and the input node with static filters.
Note
Optimize join columns are not supported for non equi joins.
Prerequisites
Consider a scenario in which a query requests only fields from one join partner, the cardinality to the other
partner (of which no fields are requested) is set to 1, and the join is not an inner join. In such scenarios, the join
execution does not influence the result set. You can use the optimize join columns property to prune the fields
that are not requested in the query.
In general, for scenarios that have multiple join partners on different join fields, if the query requests fields from
only a small subset of join partners, you can use the optimize join columns property to omit various join fields
from the aggregation. This flag helps to explicitly state to the join optimizer to not include the join fields in the
aggregation. Omitting the join fields help reduce the number of records processed by the join optimizer.
This optimization therefore results in a better performance and lower memory consumption. The extent of
optimization depends on the fields that the query request at runtime, and on which fields you have defined the
join.
Remember
Using a wrong cardinality impacts the result set.
SAP HANA modeler allows you to validate the join cardinality and identify whether you have maintained the
referential integrity for the join tables.
Prerequisites
You have SELECT privileges on the catalog tables participating in the join to view the join validation status. If the
participating catalog tables are virtual tables, then you can view the join validation status only if the user has
SELECT privileges on the virtual table and also if the user credential to remote source has SELECT privileges on
the remote table.
Context
While defining a join, you can validate the cardinality and identify whether you have maintained referential
integrity for the join tables. If you have chosen a cardinality, which is not optimal for the join tables, modeler
recommends to you cardinality after analyzing the data in the participating join tables.
Note
Choosing a valid cardinality for your data sources is necessary to avoid incorrect results from the engine,
and to achieve better performance. If you are not aware of the optimal cardinality for your join, then it is
recommended not to provide any cardinality value.
Results
After analyzing the participating tables in your join definition, modeler recommends to you an optimal
cardinality and also specifies whether you have maintained referential integrity for the join tables. You can
choose to modify the join definition based on this recommendation.
Note
The cardinality that SAP HANA modeler recommends is applicable only to the current state of the system. It
becomes invalid if you perform any changes to the data or if you transport your calculation view to another
system with a different data set.
After creating a join, define its properties to obtain a desired output when you execute the join.
SAP HANA modeler allows you to define the following join properties.
Join Type The value of this property specifies the join type used for creating a join. For more
information, see Supported Join Types.
Cardinality The value of this property specifies the cardinality used for creating a join.
By default, the cardinality of the join is empty. If you are not sure about the right
cardinality for the join tables, we recommend to not specify any cardinality. Modeler
determines the cardinality when executing the join.
Language Column The value of this property specifies the language column that modeler must use for
executing text joins. For more information, see Text Joins.
Dynamic Join The value of this property determines whether modeler must dynamically define the
columns of the join condition based on the client query. For more information, see
Dynamic Joins.
Optimize Join Columns The value of this property determines whether modeler must retrieve the columns that
are not specified in the query from the database. For more information, see Optimize
Join Execution.
When creating a join between two tables, you specify the join type. The following table lists the supported join
types in SAP HANA modeler.
Inner This join type returns all rows when there is at least one match in both the database ta
bles.
Left Outer This join type returns all rows from the left table, and the matched rows from the right
table.
Right Outer This join type returns all rows from the right table, and the matched rows from the left
table.
Referential This join type is similar to inner join type, but assumes that referential integrity is main
tained for the join tables.
Text Join This join type is used to obtain language-specific data from the text tables using a lan
guage column.
Full Outer Joins This join type displays results from both left and right outer joins and returns all
(matched or unmatched) rows from the tables on both sides of the join clause.
Note
Full outer join type is supported only in new calculation views created with SPS 11 version onwards.
Use union nodes in graphical calculation views to combine the results of two or more data sources.
Context
A union node combines multiple data sources, which can have multiple columns. You can manage the output of
a union node by mapping the source columns to the output columns or by creating a target output column with
constant values.
Procedure
b. Choose .
c. In the Find Data Sources dialog, enter the name of the data source and select it from the list.
d. Choose OK.
4. Define output columns.
a. Select the Mapping pane.
b. Select the columns you want to add to the output of the union node.
c. In the context menu, choose Add To Output.
Note
If you want to add all columns from the data source to the output, in the context menu of the data
source, choose Add To Output.
If you want to assign a constant value to any of the target columns, then
If you want to create a new output column and assign a constant value to it, then
Note
By default, the value of the constant output column in null.
Constant output columns help denote the underlying data from the source columns with constant values in the
output. You can also map the unmapped source columns to a constant output column based on the business
requirement.
For example, consider that you want to compare the planned sales of each quantity with its actual sales using
two data sources with similar structures, ACTUALSALES and PLANNEDSALES.
ACTUALSALES
SALES_QUANTITY PRODUCT_ID
5000 P1
3000 P2
PLANNEDSALES
SALES_QUANTITY PRODUCT_ID
4000 P1
4000 P2
When you use a union view node to combine the results of the two data sources, you cannot differentiate the
data from these data sources.
SALES_QUANTITY PRODUCT_ID
5000 P1
3000 P2
4000 P1
4000 P2
In such cases, create a constant output column PLANNED_OR_ACTUAL and assign the constant value ACTUAL
to ACTUALSALES and the constant value PLANNED to PLANNEDSALES.
5000 P1 ACTUAL
3000 P2 ACTUAL
4000 P1 PLANNED
4000 P2 PLANNED
Now, you can identify the data source and its underlying data.
This property is useful, for example, for value help queries in applications. You can select either No Row or Row
with Constant as values for the Empty Union Behavior property. Select the data source in the mapping
definition and in the Properties tab define the values for this property based on your business requirement.
For understanding the Empty Union Behavior property and how the value this property determines the output
data, consider the following mapping definition in a union node:
Constant values A and B are defined for Projection_1 and Projection_2 using the constant column CONSTANT.
● If the Empty Union Behavior property is set to No Row, no data from Projection _2 appears in the output
data. In the other words, only data from Projection_1 appears in the output data.
● If the Empty Union Behavior property is set to Row with Constant, then the output data includes one record
from Projection _2. In this one record, the constant value A appears for the CONSTANT column and values
for all other columns appears as null.
Context
For example, consider a TRANSACTION table with two columns PRODUCT and SALES. If you want to retrieve the
top five products based on sales, use a rank node. The rank node first partitions the TRANSACTION table with
the PRODUCT as the partition column, and performs an order by operation on the partitioned table using the
SALES column to retrieve the top five products based on sales.
Procedure
Note
If you want to add all columns from the data source to the output, in the context menu of the data
source, choose Add To Output.
Descending (Top N) Retrieves top N values from the ordered set where N is the threshold value that
you define.
Ascending (Bottom N) Retrieves bottom N values from the ordered set where N is the threshold value
that you define.
Use a Fixed value or a Input Parameter as the threshold value. It helps the tool identify the number of
records from the ordered set.
a. In the Threshold Value dropdown list, select a threshold value type and provide the threshold value.
8. In the Order By dropdown list, select a column that the tool must use to perform the order by operation.
9. (Optional) Select the Dynamic Partition Elements checkbox.
Select to partition the data with only partition by columns that the query requests for processing the rank
node.
Note
In the converse, without dynamic partition, the tool partitions the data with all partition by columns in
the Partition By section, even if these columns are not requested in the query.
Note
You can partition the data using more than one partition column.
b. Choose (Add).
c. Select Input Parameter or Variable menu option.
d. Select and expand the new input parameter or variable.
e. Define the input parameter or variable.
13. Add result as inputs to other view nodes.
a. In the view editor, select the rank node.
Related Information
Rank nodes help you partition the data source for a set of partition columns and then perform an order by SQL
operation on the partitioned set.
For example, consider a business scenario where you want to retrieve the top five sales for each product using
the SALES_TRANSACTION data source.
SALES_TRANSACTIONS
C1 P1 1000
C7 P5 1000
C1 P1 3000
C2 P2 3000
C2 P1 2500
C2 P4 1900
C3 P3 2100
C4 P1 2000
C5 P1 3050
C5 P4 3100
C6 P2 4000
Add SALES_TRANSACTION as a data source within the rank node and define the following:
● Threshold Value = 5
● Partition By Column = PRODUCT
● Order By Column = PRODUCT_SALES
C7 P5 1000
C5 P4 3100
C2 P4 1900
C3 P3 2100
C6 P2 4000
C2 P2 3000
C5 P1 3050
C1 P1 3000
C2 P1 2500
C4 P1 2000
C1 P1 1000
Context
For example, you could apply filters to retrieve sales of a product where (revenue >= 100 AND region = India)
OR (revenue >=50 AND region = Germany). You can also define filters using nested or complex expressions.
Filters on columns are equivalent to the HAVING clause of SQL. Filters help optimize the calculation view
execution. At runtime, the system executes the filters after performing all the operations defined in the lower
view nodes.
You can define filters on columns using a filter expression, and can use the column engine language or the SQL
language to define the filter expression.
Procedure
(revenue >= 100 AND region = India) OR (revenue >=50 AND region = Germany)
Tip
In the expression editor, the tool provides hints for all supported functions. The hints give you more
information on the functions, its purpose, and syntax.
The following table lists the operators and its meanings, which you can use while defining filter conditions.
Not Equal To filter and show data other than the filter value
Between To filter and show data for a particular range specified in the From Value and To Value
List of Values To filter and show data for a specific list of values separated by comma
Not in list To filter data and show data for the values other than the ones specified. You can provide a list
of values to be excluded using comma.
Is not NULL To filter and show data of all the rows that have non NULL values
Less than To filter and show data with values less than the one specified as filter value
Less than or Equal to To filter and show data with values less than or equal to the one specified as filter value
Greater than To filter and show data with values greater than the one specified as filter value
Greater than or Equal to To filter and show data with values greater than or equal to the one specified as filter value
Contains Pattern To filter and show data that matches the pattern specified in the filter value. You can use '?'
question mark to substitute a single character, and '*' asterisk to substitute many. For exam
ple, to filter data for continents that start with letter A, use Contains Pattern filter with value A*.
This would show the data for all the continents that start with A like Asia and Africa. The filter
Contains Pattern in expression editor is converted as match. Hence, for the given ex
ample the corresponding filter expression is (match("CONTINENT",'A*')).
Generate time data into default time-related tables present in the _SYS_BI schema and use these tables in
calculation views to add a time dimension.
Context
For modeling business scenarios that require time dimension, you generate time data in default time-related
tables available in the _SYS_BI schema. You can select the calendar type and granularity and generate the time
data for a specific time span.
Procedure
Note
For the granularity level Week, you need to specify the first day of the week.
The variant specifies the number of periods along with the start and end dates.
8. Choose Create.
Note
For the Gregorian calendar type, modeler generates time dimension data into
M_TIME_DIMENSION_YEAR, M_TIME_DIMENSION_MONTH, M_TIME_DIMENSION_WEEK,
M_TIME_DIMENSION tables and for the Fiscal calendar type, the modeler populates the generated time
dimension data into the M_FISCAL_CALENDAR table. These tables are present in _SYS_BI schema.
Related Information
For the Gregorian calendar type, based on the granularity you choose, modeler defines certain restrictions on
the time range for which you can generate time dimension data.
For each granularity level, the following table displays the time range for which you can generate time
dimension data.
Granularity Range
Note
The following restrictions are applicable for generating time dimension data:
Related Information
SAP HANA modeler supports generating time dimension data using the Fiscal or Gregorian calendar types.
The following table provides more information on each of the calendar types.
Gregorian Use the Gregorian calendar type, if your financial year is same as the calendar
year, for example, January to December.
Fiscal Use the Fiscal calendar type, if your financial year is not same as the calendar
year, for example, March to April.
Related Information
Create script-based calculation views to depict complex calculation scenarios by writing SQL script
statements. It is a viable alternative to depict complex business scenarios, which you cannot achieve by
creating graphical calculation views.
Context
For example, if you want to create calculation views that require certain SQL functions (i.e. window), or
predictive functions (i.e. R-Lang), then you use script-based calculation views. Sufficient knowledge of SQL
scripting including the behavior and optimization characteristics of the different data models is a prerequisite
for creating script-based calculation views.
Note
If you do not select a default schema while scripting, then you need to provide fully qualified names
of the objects used.
8. If you want to create and add new columns to the output, then in the Columns pane, create new columns
by typing the column name and its data type using the syntax col_name>:<data_type>.
a. If you want to edit or define additional properties to these columns, then choose the Columns tab.
For example, you can mark columns as attributes or measures, assign semantics, assign variables and
so on.
b. Define required additional properties.
9. If you want to create or add new input parameters of type Direct to the output, then in the Parameters
pane, create new parameters using the syntax <parameter_name>:<data_type>.
a. If you want to edit or define additional properties on these parameters, then choose Parameters/
Variables tab.
For example, you can create new parameters or variables, manage parameter mappings, choose
parameter or variable types, assign semantics and so on.
b. Define additional required properties.
Note
The defined order and data types of columns and parameters must match with the order and data types
of the columns and parameters in the select query, which is assigned to the output function var_out.
10. If you want to add multiple columns that are part of existing information views or catalog tables or table
functions to the output structure of script-based calculation views, then:
a. In the Columns pane, choose Add Columns From.
b. In the Available Columns section, choose Add.
c. Enter the name of the object that contains the columns you want to add to the output.
d. Select one or more objects from the dropdown list.
e. Choose OK.
h. Choose .
Note
For all duplicate column names in the Select Columns pane, the modeler displays an error. You
cannot add two columns with the same name to your output. If you want to retain both the columns,
then change the name of columns in the Target pane before you add them to the output.
i. If you want to override the existing output structure, select Replace existing output columns in the
Output.
j. Choose OK.
11. Write the SQL Script statements to fill the output columns.
12. Activate the calculation view.
a. If you want to activate the calculation view, in the menu bar, choose Save.
b. If you want to activate the calculation view along with all objects, in the menu bar, choose Save All.
13. Assign changes.
a. In the navigator toolbar, choose the icon or the keyboard shortcut Ctrl + S to save and
activate your calculation view.
b. In the open change list, select a change ID that you want to use to assign your changes.
Note
The change list appears only if you have enabled change tracking for your SAP HANA system.
c. Choose Assign.
Next Steps
After creating a script-based calculation view, you can perform certain additional tasks to obtain the desired
output. The table below lists the additional tasks that you can perform to enrich the calculation view.
If you want to assign semantic types to provide more meaning to attributes and Assign Semantics
measures in calculation views.
If you want to parameterize calculation views and execute them based on the values Create Input Parameters
users provide at query runtime.
If you want to, for example, filter the results based on the values that users provide to Assign Variables
attributes at runtime.
If you want associate measures with currency codes and perform currency conver Associate Measures with Currency
sions.
If you want associate measures with unit of measures and perform unit conversions. Associate Measures with Unit of
Measure
If you want to create level hierarchies to organize data in reporting tools. Create Level Hierarchies
If you want to create parent-child hierarchies to organize data in reporting tools. Create Parent-Child Hierarchies
If you want to group related measures together in a folder. Group Related Measures.
If you want to filter the view data either using a fixed client value or using a session Filter Data for Specific Clients
client set for the user.
If you want to execute time travel queries on calculation views. Enable Calculation Views for Time
Travel Queries
If you want to invalidate or remove data from the cache after specific time intervals. Invalidate Cached Content
Related Information
SAP HANA modeler supports two types of data categories to classify calculation views. The following table
provides more information on each of these data category types.
Cube Calculation views with data categories as Cube are visible to the reporting tools and supports data
analysis with multidimensional reporting.
If the data categories for graphical calculation views are set to Cube, modeler provides aggregation
as the default view node. Also, an additional aggregation column behavior is available that you can
use to specify the aggregation types for measures.
Dimension Calculation views with data categories as Dimension are not visible to the reporting tools and does
not support data analysis. However, you can use these information views as data sources in other
calculation views, which have data category as Cube, for any multidimensional reporting purposes.
If the data category is Dimension, you cannot create measures. You can only consume them with
SQL. For example, you use such calculation views to fill simple list user interfaces, where recurring
attribute values are not a problem, but are desired. The output node offers only attributes of nu
merical data types.
If the data categories for graphical calculation views are set to Dimension, modeler provides projec
tion as the default view node.
You cannot create script-based calculation views with data category as Dimension.
<blank> Calculation views with data categories as <blank>, or if the calculation views are not classified as
cube or dimension, then they are not visible to the reporting tools and do not support multidimen
sional reporting.
However, you can use these calculation views as data sources in other information views, which
have data category as Cube, for any multidimensional reporting purposes.
If the graphical calculation views are not classified as cube or dimension, modeler provides projec
tion as the default view node.
Related Information
After modeling calculation views based on your requirements, deploy them within SAP HANA modeler to
preview and analyze the output data. You can also view the SQL query that modeler generates for the deployed
calculation view.
Context
Data preview refers to visualizing the output of calculation views in graphical or tabular format. You can preview
output of information views within SAP HANA modeler using any of the following preview options:
If you have not used any input parameters or variables, this operation opens a new editor and displays
the raw data output of all attributes along with its data in a simple table format.
If you have defined any variables or input parameters, provide your values.
5. Apply filters.
If you want to export the raw data output to a .csv file, choose .
7. View SQL query for the calculation view.
a. If you want to view the SQL query that modeler generates for the deployed calculation view, choose
.
b. If you want to modify the SQL query and view output accordingly, modify the query in SQL console and
Launch SAP BusinessObjects Design Studio, which is integrated within the SAP HANA Web-based
Development Workbench Editor to preview and analyze the output of your calculation view.
This launches SAP BusinessObjects Design Studio in a new tab of your browser.
Note
If there are inconsistencies in runtime information (that is, calculation views in catalog or in tables
related to runtime) of an calculation view, you get invalidated view error. In such cases, you need to
redeploy the view in order to correct the inconsistencies of runtime information.
Use SAP BusinessObjects Design Studio to view output data with rich visualizations, and to perform advanced
analysis using the labels and value axis. For example, to analyze the sales on a country basis, add Country to
the labels axis and Sales to the value axis.
In SAP BusinessObjects Design Studio you can preview calculation view output in different charts such as the
column charts, pie charts, and so on. You can also apply filters on attributes and visualize filtered data.
For more information on SAP BusinessObjects Design Studio, see SAP BusinessObjects Design Studio
documentation.
Attributes and measures form content data that you use for data modeling. The attributes represent the
descriptive data such as city and country and the measures represent quantifiable data such as revenue and
quantity sold.
Information views can contain two types of columns, the measures and the attributes. Measures are columns
for which you define an aggregation. If information views are used in SQL statements, then aggregate the
measures, for example, using the SQL functions SUM(<column name>), MIN(<column name>), or
MAX(<column name>. Attributes can be handled as regular columns as they do not need to be aggregated.
This section describes the different operations you can perform using the attributes and measures. For
example, you can create calculated attributes or calculated measures.
Related Information
If you want to count the number of distinct values of one or more attribute columns, then you create counters,
which are special type of columns that displays the distinct count of attribute columns.
Context
You can create counters for multiple attribute columns at a time. For example, if you create a counter for two
columns, then the counter displays the count of distinct combinations of both the columns.
Note
You can create counters for attribute columns in the default star join node or in the default aggregation view
node only.
Procedure
Related Information
After creating a counter, you can view its properties or change them based on your business requirement.
Modeler displays the following properties for counter in the Semantics node.
Properties Description
Data Type The value of this property specifies the data type of the counter.
Semantic Type The value of this property specifies the semantics assigned to the
counter. For more information, see Assign Semantics [page 53]
Hidden The value of this property determines whether the counter column is
hidden in reporting tools.
Exception Aggregation Type The value of this property specifies the exception aggregation type
used for creating counters. SAP HANA modeler supports only the
COUNT_DISTINCT exception aggregation type for counters. This ex
ception aggregation type counts the distinct occurrences of values for
a set off attribute columns.
Display Folder If the counter is grouped in any of the display folder, the value of this
property specifies the display folder that was used to group related
measures. For more information, see Group Related Measures [page
84].
Columns The attribute columns used in the counter. Modeler counts the distinct
combinations of these columns in the data source.
Counters help you count the number of distinct values for one or more of attribute columns.
For example, consider a business scenario where you want to count the distinct products in each region.
Consider the sales transaction table, SALES_TRANSACTION with columns PRODUCT_ID and REGION.
SALES_TRANSACTION
PRODUCT_ID REGION
P1 R1
P2 R1
P3 R2
P4 R3
P5 R4
P6 R4
P7 R1
P8 R1
P9 R2
P10 R3
P11 R4
P12 R4
Create a counter, DISTINCT_PRODUCTS using the attributes REGION, and PRODUCT_ID within an aggregation
node.
REGION DISTINCT_COUNT
R1 4
R1 2
R2 2
R3 4
Create new output columns and calculate its values at runtime based on the result of an expression. You can
use other column values, functions, input parameters or constants in the expression.
Context
For example, you can create a calculated column DISCOUNT using the expression if("PRODUCT" =
'NOTEBOOK', "DISCOUNT" * 0.10, "DISCOUNT"). In this sample expression, you use the function if(), the
column PRODUCT and operator * to obtain values for the calculated column DISCOUNT.
Procedure
4. Choose .
5. In the General section, enter a name and description for the calculated column.
6. In the Data Type dropdown list, select the data type of the calculated column.
7. Enter length and scale based on the selected data type.
8. Select a column type.
You can create calculated attributes or calculated measures using attributes or measures respectively.
This allows you to propose the aggregation that client needs to perform on calculated measures.
9. If you want to hide the calculated column in reporting tools, select the Hidden checkbox.
10. Assign semantics to the calculated column.
a. In the Semantic Type dropdown list, select a semantic value.
11. Provide an expression.
a. In the Expression section, choose the Expression Editor.
b. In the expression editor enter a valid expression.
For example, if("PRODUCT" = 'NOTEBOOK', "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. Else use the original value of the attribute DISCOUNT.
Note
You can also create an expression by dragging and dropping the expression elements, operators and
functions from the menus to the expression editor.
Note
By default, modeler allows you to drilldown calculated attributes in reporting tools. If you want to disable
the drilldown property, in the Drill Down dropdown list, set the value to blank.
Related Information
After creating a calculated attribute or a calculated measure, you can view its properties or change them based
on your business requirements.
Modeler displays the following properties for calculated columns in the Semantics node.
Data Type The value of this property specifies the data type of the calculated attributes or calcu
lated measures.
Semantic Type The value of this property specifies the semantics assigned to the calculated attributes
or calculated measures. For more information, see Assign Semantics [page 53].
Hidden The value of this property determines whether the calculated column is hidden in report
ing tools.
Drill Down Enablement The value of this property determines whether the calculated attribute is enabled for drill
down in reporting tools. If it is enabled, the value of this property specifies the drill down
type. For more information, see Enable or Disable Attributes for Drilldown in Reporting
Tools [page 81].
Display Folder If the calculated measure is grouped in any of the display folder, the value of this property
specifies the display folder that was used to group related measures. For more informa
tion, see Group Related Measures [page 84].
Create a new measure column and calculate its value at runtime based on the result of an expression.
For example, consider a business scenario where you want to create a new calculated measure column,
PRODUCT_PROFIT_PERCENT within an aggregation node. This measure column stores the profit of a product
in percentage.
SALES_TRANSACTION
P1 30000 32000
P2 32000 24000
P3 40000 41000
P4 10000 11000
P5 14000 13800
P6 18000 17000
(("PRODUCT_SALES_PRICE" - "PRODUCT_COST_PRICE")/"PRODUCT_COST_PRICE")*100
Create a new attribute column and calculate its value at runtime based on the results of an expression.
For example, consider a business scenario where you want to create a new calculated attribute column,
PRODUCT_SALES_RATING within an aggregation node. This attribute column stores the rating for sales of a
product as either Good Sales or Poor Sales or Average Sales based on the product quantity sold.
SALES_TRANSACTION
PRODUCT_ID PRODUCT_QUANTITY_SOLD
P1 50
P2 30
P3 20
P4 25
P5 40
P6 10
Sample Code
P1 50 Good Sales
P2 30 Good Sales
P3 20 Average Sales
P4 25 Average Sales
P5 40 Good Sales
P6 10 Poor Sales
Assigning semantics to attributes and measures helps define the output structure of an information view, as
they provide meaning to attributes and measures of an information view.
Context
For example, if you use an attribute PRICE, which contains price data of product, and another attribute CODE
which contains currency format, then you can assign semantic type Currency Code to the attribute CODE and
assign the semantic type Amount with Currency Code to the attribute PRICE.
Procedure
Defining semantics for calculation views includes defining the output columns of the calculation views (its
label, its label column, its aggregation type, and its semantic type) and the hierarchies. While defining the
semantics for a calculation view, you can extract and copy the semantic definitions of columns and hierarchies
from their underlying data sources.
Context
For example, consider that you are modeling a complex calculation view with multiple underlying data sources
and these data sources have their own semantic definitions for its columns and hierarchies. In such cases, you
can extract and copy the semantic definitions of columns and hierarchies from their underlying data sources to
define the semantics of the calculation view. This way of extracting and copying the semantic definitions helps
you save the effort of manually defining the semantics of the calculation view.
Procedure
In the Extract Semantics dialog box, modeler displays the output columns and hierarchies of underlying
data sources.
5. Select columns and columns properties.
If you want to extract and copy semantic definition of columns from their underlying data sources,
a. In the Columns tab, select the columns available in the underlying data sources.
Note
If the same column is available in two or more data sources specify the data source that modeler
must use to extract and copy the semantic definition. In the Data Sources dropdown list, select the
data source.
If you want to extract and copy hierarchies defined in the underlying views to the semantic definition,
a. Select the Hierarchies tab.
Note
You can extract and copy hierarchies only if the nodes in the hierarchies are available as output
columns of the calculation view.
Propagate columns from underlying view nodes to the semantics node and to other view nodes that are in the
joined path. In other words, you can reuse the output columns of underlying view nodes in other view nodes up
to the semantic node.
Context
Modeler allows to you propagate columns from an underlying view node to all nodes in the joined path up to the
semantics node. This helps you to avoid defining the output columns of each node if the same columns are
available in its underlying node and you also require them as output columns in the above nodes up to the
semantic node. Propagating columns are useful in complex calculation views with many levels of view nodes.
Procedure
Note
You cannot select the default view node and propagate columns to the semantics node.
3. In the Mappings tab, select an output column that you want to propagate to the semantics node.
Results
The modeler propagates the columns you select to all view nodes and up to the semantics node. If a column is
already present in any of the view node in the propagated path, the columns are not propagated.
Client tools use semantic types to represent data in appropriate format. The system supports the following
semantic types for attributes.
Create restricted columns to restrict values of measures based on attribute restrictions. For example, you can
choose to restrict the value for the REVENUE column only for REGION = APJ, and YEAR = 2012.
Context
You can apply restrictions on measures defined in the semantics node by using any of the below approaches:
● Apply restrictions on attribute values by using values from other attribute columns.
● Apply restriction on attribute values using expressions.
Note
For restricted columns, modeler applies the aggregation type of the base column, and you can create
restricted columns in the default aggregation view node or star join node only.
Procedure
Note
You can also create restricted columns in star join nodes.
4. Choose .
5. In the General section, provide a name and description to the restricted column.
6. In the Base Measure dropdown list, select a measure on which you want to apply restrictions.
7. If you want to hide the restricted column for data preview, select the Hidden checkbox.
8. Apply restrictions using column values.
You can define a condition using attribute columns to apply restrictions on the base measure.
a. Select Columns.
b. Choose .
c. In the Column dropdown list, selecte an attribute column.
d. In the Operator dropdown list, select a required operation to define the condition.
e. In the Value field, select a value from the value help.
f. If you want to apply restrictions only for the defined conditions, choose Include.
If you want to use an expression to apply restrictions on the base measure, then:
a. Select Expression.
b. Choose Edit Expression.
c. In the expression editor, enter your expression.
Note
You can also use input parameters in your expressions to create restricted columns.
Related Information
After creating a restricted column, you can view its properties or change them based on your business
requirements.
Modeler displays the following properties for restricted columns in the Semantics node.
Properties Description
Data Type The value of this property specifies the data type of the restricted column.
Hidden The value of this property determines whether the restricted column is hidden in reporting tools.
Display Folder If the restricted measure is grouped in any of the display folder, the value of this property specifies
the display folder that was used to group related measures. For more information, see Group Related
Measures [page 84].
For example, consider a business scenario where you want to create a new restricted measure column,
REGION_SALES within an aggregation node. This restricted column is used to restrict values of the measure,
QUANTITY_SOLD using the attribute, REGION.
Consider the sales transaction table, SALES_TRANSACTION with columns PRODUCT_ID, REGION, COUNTRY,
and QUANTITY_SOLD.
SALES_TRANSACTION
P1 Europe DE 3000
P1 Europe UK 4000
P1 Europe GR 5000
Create a restricted column for the measure QUANTITY_SOLD using the attribute restriction, REGION=Europe
After creating the restricted column, add columns, PRODUCT_ID, REGION, QUANTITY_SOLD, and the
restricted measure, REGION_SALES to the output of the aggregation node. When you execute the aggregation
node, the output is:
P1 APJ 8000 ?
Context
You assign variables to attributes in calculation views to, for example, filter the results. At runtime, you can
provide values to variables by manually entering a value or by selecting them from the value help list.
1. Create a variable.
a. Select the Semantics node.
d. Choose (Add).
e. Choose the Variable menu option.
f. Select and expand the new variable.
2. Define a variable type.
a. Provide a name and description for your variable.
b. In the Selection Type dropdown list, select a variable type.
c. If you want to configure the variable to mandatorily accept a value at runtime, select the Is Mandatory
checkbox.
Note
If you do not provide a value to variable at runtime and if you have not selected the Is Mandatory
checkbox, then the tool displays unfiltered data.
d. If you want to configure the variables to accept multiple values from client tools at runtime, select the
Multiple Entries checkbox.
For example, you can assign variables to identify the revenue for the period 2000 to 2005 and 2012, at
runtime.
3. Define values for the value help list.
a. If you want to use attribute data from another calculation view as the reference column, use a View/
Table Value Help to select the calculation view that contains the required attribute.
b. In the Reference Column value help list, choose an attribute value.
The tool uses this attribute data to provide values in the value help list at runtime.
c. In reporting tools, if you want to use a hierarchy from the calculation view to organize the filtered data,
then in the Hierarchy dropdown list, select a hierarchy.
Selecting a hierarchy also helps populate values in the variable value help list at runtime with
hierarchical representations.
Note
The hierarchy must contain the variable's reference column at the leaf level (in level hierarchies) or
as a child attribute (in parent-child hierarchies).
Provide a default value that the tool must consider as the variable value when you do not provide any value
to the variable.
a. In the Default Value section, provide default values using constant values or expressions.
Constant If you want to use a constant as the default variable value, do the following:
1. In the Type dropdown list, select Constant.
2. Provide values for From Value or both From Value and To Value depending on the variable
type and the operator.
For example, if you are using variable type Single Value and operator Equal, provide just
the From value.
Expression If you want to provide the result of an expression as the default value, do the following:
1. In the Type dropdown list, select Expression.
You use the column engine language or the SQL language to provide the expression.
2. Provide values for From Value or both From Value and To Value depending on the variable
type and the operator.
For example, if you are using variable type Single Value and operator Equal, then provide
just the From value.
3. In the From Value field or To Value field, choose the value help icon to open the expres
sion editor.
4. In the Expression Editor, provide a valid expression.
5. Choose Validate Syntax to identify any inconsistencies in the expression.
6. Choose Back.
Note
Providing multiple default values.
If you have configured the variable to accept multiple values at the runtime by selecting the Multiple
Entries checkbox, then you can provide multiple default values to the variable. In the Default Value
section, choose + to add multiple default values. You can select these values from the selection screen
when executing the calculation view.
Type Description
Single Value Use this to filter and view data based on a single attribute value. For example, to view the sales of a
product where the month is equal to January.
Interval Use this to filter and view a specific set of data. For example, to view the expenditure of a company
from March to April.
Range Use this to filter 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..
Input parameters helps you parameterize calculation views and execute them based on the values you provide
to the input parameters at query runtime. The engine considers input parameters as the PLACEHOLDER
clause of the SQL statement.
Context
You create an input parameter at design time (while creating your calculation views), and provide value to the
engine at runtime and execute calculation views accordingly. For example, if you want your information view to
provide data for a specific region, then REGION is a possible input parameter. You can provide value to REGION
at runtime.
Procedure
1. If you want to create an input parameter from the Semantics node, then
a. Select the Semantincs node.
b. Choose the Parameters/Variables tab.
c. Choose .
3. In the General section, provide a name and description to your input parameter.
4. Maintain input parameter details
a. If you want to configure the input parameter to mandatorily accept a value at runtime, then select the
Is Mandatory checkbox.
b. If you want to configure the input parameter to accept multiple values at runtime, then select the
Multiple Entries checkbox.
For example, you can create input parameter to identify the revenue for the period 2000 to 2005 and
2012, at runtime.
Column At runtime, modeler provides a value a. In the Reference Column dropdown list, select
help with attribute data. You can choose an attribute.
a value from the attribute data as an in b. If you want to use attribute data from another
put parameter value. calculation view as the reference column, in the
You can also choose a hierarchy from View/Table for value help dropdown list, select
the calculation view to organize the data the information view that contains the required
in reporting tools. But, only if the hierar attribute.
chy contains the variable’s reference c. If you want use a hierarchy to organize the
column at the leaf level (in level hierar data in reporting tools, in Hierarchy dropdown
chies) or as a parent attribute (in pa list, select a hierarchy.
rent-child hierarchies).
Derived from table At runtime, modeler uses the value from a. In the Table Name dropdown list, select a ta
the table’s return column as the input ble.
parameter value. This means that, you
b. For the table you select, in the Return Column
need not provide any values to the in
dropdown list, select a column value.
putparameter at runtime.
c. In the Filters section, define filter conditions to
Input parameters of this type are typi
filter the values of return column.
cally used to evaluate a formula. For ex
ample, you calculate a discount for spe
cific clients by creating an input param
eter, which is derived from the SALES
table and return column REVENUE with
a filter set on the CLIENT_ID.
Direct Specify the data type and length and b. In the Data Type dropdown list, select the
scale of the input parameter value that data type.
you want to use at runtime.
c. Provide the Length and Scale for the data type
You can also define an input parameter you choose.
with semantic type as Currency or Unit
a. Optionally, In the Semantic Type dropdown
of Measure or Date.
list, specify the semantic type for you input pa
For example, in currency conversions, rameter.
you can specify the target currency
value at run time by creating an input
parameter of type Direct with semantic
type as Currency.
Static List At runtime, modeler provides a value a. In the Data Type dropdown list, select the data
help with the static list. You can choose type for the list values.
a value from this list as an input param
eter value. b. Provide the Length and Scale for the data type
you choose.
Derived from Proce At runtime, modeler uses the value re a..In Procedure/ Scalar Function textbox, pro
dure/Scalar func turned from the procedure or scalar vide the name of procedure or scalar function.
tions function as the input parameter value.
Note
For input parameter of type Derived from Procedure/Scalar functions or Derived From Table, if you
want to provide a different value to the parameter at runtime (override the default value) and do
want modeler to automatically use the value returned by the procedure or scalar function or the
table as the input parameter, then select the Input Enabled checkbox. If this checkbox is enabled,
then at runtime modeler displays the value returned by the procedure or scalar function as the
default value but, you can override this value based on your requirement.
Constant If you want to use a constant value as the default input parameter value,
1. In the Default Value section, choose the add icon.
2. In Type dropdown list section, select Constant.
3. In Value field, provide a constant value.
Expression If you want to use the result of an expression as the default input parameter value:
For example, you can evaluate the expression date(Now()), and use the result as the default
input parameter value at runtime.
You cannot use a combination of expressions and constants as default values for input parameters.
Related Information
If you are creating a calculation view by using other calculation views, attribute views or analytic views, which
have input parameters or variables defined on it, then you can map the input parameters or variables of the
underlying data sources with the input parameters or variables of the calculation view that you are creating.
Context
Similarly, if you are creating a calculation view, which consists of other external views as value help references
in its variables or input parameters, then you can map the parameters/ variable of external views with the
parameters or variables of the calculation view that you are creating.
Note
SAP HANA modeler for web workbench does not support mapping input paramters of attribute views with
the input parameters of calculation views.
Mapping parameters of the current view to the parameters of the underlying data sources, moves the filters
down to the underlying data sources during runtime, which reduces the amount of data transferred across
them. For value-helps from external views, in addition to parameters, you could also map variables from
current view to the external views.
Note
Only if the input parameters are used in the dependent data sources, they are available for mapping.
Note
If you are choosing Auto Map, then for mapping all unmapped parameters or variables at the source,
the system creates an input parameter or variable of the same name at the target.
9. If you want to create a constant value at the target calculation view, then:
a. Select Create Constant.
b. Enter constant value.
c. Choose OK.
Note
If you want to map input parameters of type derived from table or derived from procedure or scalar
function, which are input enabled, then you can only map them to a constant value of the target
calculation view.
Use input parameters to parameterize the view and to obtain the desired output when you run the view.
This means that the engine uses the parameter value that users provide at runtime, for example, to evaluate
the expression defined for a calculated measure. The parameter value is passed to the engine through the
PLACEHOLDER clause of the SQL statement. A parameter can only have a single value, for example, for
currency conversion. However, when working with the in() function in filter expressions of calculation views,
in("attr", $$param$$)
in("attr", $$param$$)
The table here summarizes with some examples the input parameter expressions at design time and the query
at runtime.
Or
(placeholder."$$IP_1$
$"=>'''test'',''test2''')
You use input parameters as placeholders, for example, during currency conversion, unit of measure
conversion, or in calculated column expressions. When used in formulas, the calculation of the formula is
based on the input that you provide at runtime during data preview.
The expected behavior of the input parameter when a value at runtime is not provided is as follows:
No Results in error
The table implies that it is mandatory to provide a value for the input parameter at runtime, or assign a default
value while creating the view, to avoid errors.
SAP HANA modeler helps create hierarchies to organize data in a tree structure for multidimensional reporting.
Each hierarchy comprises of a set of levels having many-to-one relationships between each other and
collectively these levels make up the hierarchical structure.
For example, a time hierarchy comprises of levels such as Fiscal Year, Fiscal Quarter, Fiscal Month, and so on.
You can create the following two types of hierarchies in SAP HANA Modeler:
● Level Hierarchies
● Parent-child Hierarchies
Note
Hierarchies in attribute views are not available in a calculation view that reuses the attribute view.
Additional information is available for using Multidimensional Expressions (MDX) in the SAP HANA Developer
Guide (for SAP HANA Web Workbench). The link is included in Related Information.
Related Information
In level hierarchies each level represents a position in the hierarchy. For example, a time dimension can have a
hierarchy that represents data at the month, quarter, and year levels.
Context
Level hierarchies consist of one or more levels of aggregation. Attributes roll up to the next higher level in a
many-to-one relationship and members at this higher level roll up into the next higher level, and so on, until
Procedure
The node style determines the node ID for the level hierarchy.
a. In the Node Style dropdown list, select a value.
9. Create levels.
The level type specifies the semantics for the level attributes. For example, level type TIMEMONTHS
indicates that the attributes are months such as, "January", February, and similarly level type
REGULAR indicates that the level does not require any special formatting.
d. In the Order BY dropdown list, select a column value that modeler must use to order the hierarchy
members.
a. In the Sort Direction dropdown list, select a value that modeler must use to sort and display the
hierarchy members.
10. Define level hierarchy properties.
a. In the Properties section, select Aggregate All Nodes only if you want to include the values of
intermediate nodes of the hierarchy to the total value of the hierarchy’s root node (Level 1). If you do
not select Aggregate All Nodes, the modeler does not roll-up the values of intermediate nodes to the
root node (Level 1).
Note
The value of Aggregate All Nodes property is interpreted only by the SAP HANA MDX engine. In the
BW OLAP engine, the modeler always counts the node values. Whether you want to select this
property depends on the business requirement. If you are sure that there is no data posted on
aggregate nodes, you should set the option to false. The engine then executes the hierarchy faster.
This value helps modeler identify the default member of the hierarchy. If you do not provide any value,
all members of hierarchy are default members.
d. In the Root Node Visibility dropdown list, select a value.
The value helps modeler know if it needs to add an additional root node to the hierarchy.
e. In the Orphan Nodes dropdown list, select a value.
This value helps modeler know how to handle orphan nodes in the hierarchy.
Note
If you select Step Parent option to handle orphan nodes, enter a value (node ID) for the step parent
node. The step parent node must already exist in the hierarchy at the root level and you must enter the
node ID according to the node style that you select for the hierarchy. For example if you select node style
Level Name, the stepparent node ID can be [Level2].[B2]. The modeler assigns all orphan nodes under
this node.
Related Information
Based on your business requirements, you can define certain properties of level hierarchies. The value of these
properties determines the characteristics of the hierarchy at runtime.
Open a level hierarchy to view the following properties in the Properties section.
Properties Description
Aggregate All Nodes The value of this property determines whether modeler must roll-up the value of inter
mediate nodes of the hierarchy to the root node of the hierarchy. If the value is set to
True, modeler rolls-up the value of intermediate nodes to the total value of the hier
archy’s root node.
Default Member (English) This value of this property helps modeler identify the default member of the hierarchy.
If you do not provide any value, all members of hierarchy are default members.
Root Node Visibility The value of this property helps modeler know if it needs to add an additional root
node to the hierarchy. For more information, see Root Node Visibility [page 74].
Node Style The value of this property specifies the node ID format of the level hierarchy. For more
information, see Node Style [page 71]
Node style is applicable for level hierarchies, and helps modeler identify the format the node ID. For example, if
the node ID must comprise of the level name and the node name in the reporting tools.
Level Name For this node style, the node ID comprises of the level name and the node name.
For example, for a fiscal hierarchy, the Level Name node style implies: MONTH.JAN
Name Only For this node style, the node ID comprises of the level name only. For example, for
a fiscal hierarchy, the Name Only node style implies: JAN
Name Path For this node style, the node ID comprises of the node name and the names of all
ancestors apart from the (single physical) root node. For example, for a fiscal hier
archy, the Level Name node style implies: FISCAL_2015.QUARTER_1.JAN
In parent-child hierarchies, you use a parent attribute that determines the relationship among the view
attributes. Parent-child hierarchies have elements of the same type and do not contain named levels.
Context
Parent-child hierarchies are value-based hierarchies, and you create a parent-child hierarchy from a single
parent attribute. You can also define multiple parent-child pairs to support the compound node IDs. For
example, you can create a compound parent-child hierarchy that uniquely identifies cost centers with the
following two parent-child pairs:
A parent-child hierarchy is always based on two table columns and these columns define the hierarchical
relationships amongst its elements. Others examples of parent-child hierarchies are bill of materials hierarchy
(parent and child) or employee master (employee and manager) hierarchy.
Note
The value of Aggregate All Nodes property is interpreted only by the SAP HANA MDX engine. In the
BW OLAP engine, the modeler always counts the node values. Whether you want to select this
property depends on the business requirement. If you are sure that there is no data posted on
aggregate nodes, you should set the option to false. The engine then executes the hierarchy faster.
b. If you want the parent-child hierarchy to support multiple parents for its elements, select the Multiple
Parent checkbox.
c. In the Default Member textbox, enter a value for the default member.
This value helps modeler identify the default member of the hierarchy. If you do not provide any value,
all members of hierarchy are default members.
d. In the Root Node Visibility dropdown list, select a value.
The value helps modeler know if it needs to add an additional root node to the hierarchy.
e. In the Orphan Nodes dropdown list, select a value.
This value helps modeler know how to handle orphan nodes in the hierarchy.
10. If you want to add additional attributes to execute the hierarchy, then
a. In Additional Attributes section, choose the add icon.
b. In the dropdown list, select an attribute value.
11. Order and sort hierarchy elements.
If you want to order and sort elements of a parent child hierarchy based on a column value,
a. In the Order By section, choose the add icon.
b. In the Order By dropdown list, select a column value that modeler must use to order the hierarchy
members.
c. In Sort Direction dropdown list, select a value that modeler must use to sort and display the hierarchy
members.
12. Enable hierarchy for time dependency
If elements in your hierarchy are changing elements (time-dependent elements), you can enable your
parent-child hierarchy as a time dependent hierarchy. In other words, if you are creating hierarchies that
are relevant for specific time period, then enable time dependency for such hierarchies. This helps you
display different versions on the hierarchy at runtime.
Note
Not all reporting tools support time dependent hierarchies. For example, time dependent hierarchies
does not work with BI clients such as MDX or Design Studio.
a. In the Time Dependency section, select the Enable Time Dependency checkbox.
b. In the Valid From Column dropdown list, select a column value.
c. In the Valid To Column dropdown list, select a column value.
SAP HANA modeler uses Valid From Column and Valid To Column values as the validity time for the
time dependent hierarchies.
13. If you want to use an input parameter to specify the validity of the time dependent hierarchy at runtime,
a. Select Interval.
b. In the From Date Parameter dropdown list, select an input parameter that you want to use to provide
the valid from date at runtime.
c. In the To Date Parameter dropdown list, select an input parameter that you want to use to provide the
valid to date at run time.
14. If you want to use an input parameter to specify the key date at run time,
a. Select Key Date.
b. In the Key Date Parameter dropdown list, select an input parameter value that you want to use to
provide key date value at runtime.
Based on your business requirements, you can define certain properties of parent-child hierarchies. The value
of these properties determines the characteristics of the hierarchy at runtime.
Open a parent-child hierarchy to view the following properties in the Properties section.
Properties Description
Aggregate All Nodes The value of this property determines whether modeler must roll-up the value of inter
mediate nodes of the hierarchy to the root node of the hierarchy. If the value is set to
True, modeler rolls-up the value of intermediate nodes to the total value of the hier
archy’s root node.
Default Member (English) This value of this property helps modeler identify the default member of the hierarchy.
If you do not provide any value, all members of hierarchy are default members.
Root Node Visibility The value of this property helps modeler know whether it needs to add an additional
root node to the hierarchy. For more information, see Root Node Visibility [page 74].
Based on your business requirement, choose to add an additional root node to the hierarchy and place all other
nodes as its descendants.
Add Root Node If Defined This is applicable only for parent-child hierarchies. Modeler adds a
root node only if you have defined a root node value, while creating
the parent child hierarchy.
Add Root node The modeler adds an additional root node to the hierarchy and all
other nodes are placed as descendants to this node. Select this value
if your hierarchy does not have a root node, but needs one for report
ing purposes. Modeler creates a root node with the technical name
ALL.
Do Not Add Root Node The modeler does not add an additional root node to the hierarchy.
For orphan nodes in a hierarchy, SAP HANA modeler provides different options to handle them. For example,
you can treat orphan nodes as root nodes or treat them as errors.
Options Description
If measures in your calculation views represent currency or unit values, associate them with currency codes or
unit of measures. This helps you display the measure values along with currency codes or unit of measures at
data preview or in reporting tools.
Associating measures with currency code or unit of measure is also necessary for currency conversion or unit
conversions respectively.
Modeler performs currency conversions based on the source currency value, target currency value, exchange
rate, and date of conversion. Similarly, it performs unit conversions based on the source unit and target unit.
Use input parameters in currency conversion and unit conversion to provide the target currency value, the
exchange rate, the date of conversion or the target unit value at runtime.
If measures in your calculation views or analytic views represent currency or unit values, associate them with
currency codes or unit of measures. This helps you display the measure values along with currency codes or
unit of measures at data preview or in reporting tools.
Prerequisites
You have imported the currency tables TCURC, TCURF, TCURN, TCURR, TCURT, TCURV, TCURW, and TCURX.
Context
Associating measures with currency codes is also necessary for currency conversions. For example, consider
that you want to generate a sales report for a region in a particular currency code and you have the sales data
in the database table with a different currency code. In such cases, create a calculation view by using the table
column containing the sales data in different currency as a measure and associate the measure with your
desired currency to perform currency conversion. Activate the calculation view to generate required reports.
Procedure
Modeler displays the measure values with this currency code in reporting tools.
a. In the Currency field, choose the value help.
b. In the Type dropdown list, select a value.
Value Description
Fixed Associate the measure with a currency code available in the currency table TCURC.
Column Associate the measure with an attribute column available in the information view.
By default the precision of all values is 2 digits in SAP ERP tables. As some currencies require accuracy in
value, modeler shifts the decimal points according to the settings in the TCURX currency table. For
example, if the source currency has 0 valid digits, then each value needs to be multiplied by 100 because in
SAP ERP systems values are stored using 2 digits.
a. If you want to enable a decimal shift for the source currency that you select, select the Decimal shift
checkbox.
9. Enabling conversion.
a. If you want to convert the measure value to another currency, select the Conversion checkbox.
10. Enabling rounding.
a. If you want to round the result value after currency conversion to the number of digits of the target
currency, select the Rounding checkbox.
Note
You should use this step carefully if subsequent aggregations will take place on the number as rounding
errors could accumulate.
Decimal shift back is necessary if the result of the calculation views are interpreted in ABAP. The ABAP
layer, by default, always executes the decimal shift. In such cases, decimal shift back helps avoid wrong
numbers due to a double shift.
a. If you want to shift back the result of a currency conversion according to the decimal places that you
use for the target currency, select Decimal shift back.
12. If you have enabled conversion to convert a measure value to another, provide details for conversion.
a. In the value help of Schema for currency conversion, select the required schema that has the currency
tables necessary for conversion.
b. In the value help of Client for currency conversion, select the required value that modeler must use for
currency conversion rates.
Value Description
Fixed/ Session Cli Fixed client value or to select a session client for currency conversions. Provide the required
ent value in the value help.
Column Attribute column available in the calculation view to provide the client value. Select the re
quired value from the value help.
Input Parameter Input parameter to provide the client value to modeler at runtime. Select the required input
parameter from the value help.
Value Description
Fixed Select the source currency from the currency table TCURC. Provide the required value in
the value help.
Column Attribute column available in the calculation view to provide the source currency value. Se
lect the required value from the value help.
Value Description
Fixed Select the target currency from the currency table TCURC. Provide the required value in the
value help.
Column Attribute column available in the calculation view to provide the target currency value. Se
lect the required value from the value help.
Input Parameter Input parameter to provide the target currency value to modeler at runtime. Select the re
quired input parameter from the value help.
Value Description
Fixed Select the exchange rate from the currency table TCURC. Provide the required value in the
value help.
Column Attribute column available in the calculation view to provide the exchange rate value. Select
the required value from the value help.
Input Parameter Input parameter to provide the exchange rate value to modeler at runtime. Select the re
quired input parameter from the value help.
Value Description
Column Attribute column available in the calculation view to provide the date for currency conver
sion. Select the required value from the value help.
Input Parameter Input parameter to provide the date for currency conversion to modeler at runtime. Select
the required input parameter from the value help.
g. If you want to use value from a column in the information view to specify the exchange rate, in
Exchange Rate value help, select a column value.
Note
The result currency column is not available in reporting tools. You can only consume them using other
calculation views to perform any calculations.
In the Upon Conversion Failure dropdown list, select the required value that specifies how modeler must
populate data if conversion fails.
Value Description
Set to NULL Modeler sets the values for corresponding records to NULL at data preview.
Ignore Modeler displays unconverted value for the corresponding records at data preview.
If measures in calculation views represent unit values, associate the measures with a unit of measure. This
helps you display the measure values along with the unit of measures at data preview or in reporting tools.
Prerequisites
You have imported the unit tables T006, T006D, and T006A.
Context
Associating measures with unit of measures is also necessary for unit conversions. For example, if you want to
convert a unit of a measure from cubic meters to barrels to perform volume calculations, then associate the
unit of measure with the sematic type Quantity with Unit of Measure and perform unit conversions.
Procedure
Modeler displays the measure values with this unit in reporting tools.
a. In the Display Unit dropdown list, select a value.
Value Description
Fixed Associate the measure with a unit of measure available in the unit tables T006, T006A or
T006D.
Column Associate the measure with an attribute column available in the calculation view.
b. In the value help, select the required value based on the selected unit type.
c. Choose OK.
8. If you want to convert the unit value to another unit, select the Enable for Conversion checkbox.
a. In the value help of Schema for Unit Conversion, select the required schema that has the unit tables
necessary for conversion.
b. In the Client for Currency Conversion dropdown list, select the required value that modeler must use
for unit conversion factors.
Value Description
Fixed Fixed client value or to select a session client for unit conversion factors. Provide the re
quired value in the value help.
Column Attribute column available in the calculation view to provide the client value. Select the re
quired value from the value help.
Input Parameter Input parameter to provide the client value to modeler at runtime. Select the required input
parameter from the value help.
Value Description
Fixed Select the source unit from the unit tables T006, T006A or T006D. Provide the required
value in the value help.
Column Attribute column available in the calculation view to provide the source unit value. Select
the required value from the value help.
Fixed Select the target unit from the unit tables T006, T006A or T006D. Provide the required
value in the value help.
Column Attribute column available in the calculation view to provide the target unit value. Select the
required value from the value help.
Input Parameter Input parameter to provide the target unit value to modeler at runtime. Select the required
input parameter from the value help.
Note
The result unit column is not available in reporting tools. You can only consume them using other
calculation views to perform any calculations.
In the Upon failure dropdown list, select the required value that specifies how modeler must populate data
if conversion fails.
Value Description
Set to NULL Modeler sets the values for corresponding records to NULL at data preview.
Ignore Modeler displays unconverted value for the corresponding records at data preview.
By default, the tool lets you to drilldown the attributes or calculated attributes in the reporting tools. You can
disable this behavior for selected attributes.
Procedure
Set the value to blank if you want to disable drilldown for the selected attribute.
Enable attributes in information views for drilldown or disable them for drilldown in reporting tools.
SAP HANA modeler supports the following drilldown types for attributes in calculation views.
<blank> Attributes are not available for drilldown operations and the tool
does not generate an additional flat hierarchy.
Drill Down with flat hierarchy (MDX) This drilldown option is available for the attributes in calculation
views (with data category as dimension) and also for the attrib
utes in attribute views.
If you are using attribute data to provide values to variables and input parameters at runtime, you can assign a
value help to that attribute in order to use values from other attributes, which are available within the same
calculation view or in other tables or other calculation views.
Context
For example, consider you have defined an input parameter in calculation view CV1 using the attribute
CUSTOMER_ID. If you want to provide values to the input parameter using the attribute CUSTOMER_ID of
calculation view CV2, then assign the value to attribute in CV1 with the reference column CUSTOMER_ID of
CV2.
Modeler displays attributes that are available in the selected table or calculation view.
a. a. In the Reference Column dropdown list, select an attribute.
Results
At runtime, modeler provides a value help that has values from the selected attribute. You can use these values
for input parameters and variables.
In an information view, you can associate an attribute or a column having texts, as a label column to another
attribute or column.
Context
Based on user settings like KEY, TEXT, KEY(TEXT), TEXT(KEY), some of the reporting tools displays attribute
or dimension values in combination with their texts, For such scenarios, in your information view, you can
associate an attribute having texts, for example, PRODUCT TEXT, as a label column to another attribute, for
example, PRODUCT. In data preview, the attribute column and its label column, which contains its descriptions,
appear next to each other.
Procedure
If you have created an object using the old editor (which supported the old style of description mapping),
and if you try to open it using the new editor, then you will see a new column <attribute>.description (as an
attribute), which is hidden. You can rename the value and use it like other attributes based on your
requirements.
In your analytic views or calculation views, if you are using multiple measures and if you want to organize them,
for example, to segregate the planned measures with the actual measures, then you can create a folder and
group all related measures within this folder.
Context
SAP HANA modeler helps you to create a Display Folder, which essentially is a folder that you can use to group
related measures of attribute views and calculation views.
Note
A measure can exist in multiple display folders.
Procedure
SAP HANA modeler allows you to define certain properties for calculation views. The modeler refers to the
values of these properties, for example, to access the data from the database or identify how to execute the
calculation view.
This section describe the different calculation view properties, the possible values for each property and how
these values help modeler determine the activation or execution behavior of the calculation view.
For defining the view properties, select the Semantics node and define the properties in the View Properties tab.
Related Information
Obtain data from all clients or filter the calculation view data either with fixed client value or with session client
value set for the user.
Context
In SAP Web IDE, for filtering data for specific clients, explicitly specify the client filter column for each data
source in the calculation view. Select the required data source in the calculation view, and in the Mapping tab,
use the Client Column value help list to explicitly specify the client filter value for the selected data source.
Procedure
Related Information
Assign a default client to a calculation view and filter data at runtime based on the default client value. The
following table lists the default client value types you can assign and their description.
<blank> If you do not set any default client value, the tool does not filter the table data against any
client and you see values relevant to all clients.
Session Client If you use session client as the default client value, then at runtime, the tool filters the table
data according to the value you specify as the session client in the user profile.
Fixed Client If you want to use a fixed client value, for example, 001, then the tool filters the table data for
this client value.
Time travel queries are queries against the historical states of the database. When you execute a time travel
query on your information view, you can query the data at a specified time in past.
Context
If you have enabled time travel for information views, you can view data for a specific time in the past using the
AS OF SQL extension. For example, you can execute the following SQL statement on information views as a
timestamp query:
Procedure
Note
You must use input parameters with data type DATE or SECONDDATE or TIMESTAMP or
VARCHAR(8) of semantic type DATE to specify the timestamp.
In order to maintain the significance of data cached for your calculation views, the tool supports time-based
cache invalidation and transaction-based cache invalidation.
Prerequisites
You have enabled support for cache invalidation for the required calculation view.
Context
In time-based cache invalidation, the system invalidates or removes the data from the cache after specific time
intervals. Time-based cache invalidation is necessary to refresh data after every specific time period. By
default, the cache invalidation period is null. This means, the result of the complex query that you execute
resides in the cache until you execute the next query. Similarly, if you set your cache invalidation period as one
hour, the result of the query resides in the cache for one hour, and system does not clear the cache for all other
queries that you execute until this time period.
In transaction-based cache invalidation, the system invalidates the cache whenever the underlying data is
modified.
Procedure
Enable cache invalidation for your SAP HANA system to invalidate or remove data from the cache after specific
time intervals or when underlying data is modified.
Context
You enable support for cache invalidation on your SAP HANA system. This action, by default, enables cache
invalidation support for all views in the system.
Procedure
Note
You can also enable cache invalidation support for specific information views. Open the information view
in the view editor, and in the View Properties tab, select the Cache checkbox.
Considering different business scenarios, SAP HANA modeler allows you to define certain properties for
calculation views. The value of these properties determines the characteristics of the view at runtime.
When you are modeling your calculation views, in the View Properties tab of the Semantics node, SAP HANA
modeler allows you to define the following properties.
Properties Description
Data Category The value of this property determines whether your calculation view supports analysis with mul
tidimensional reporting. For more information, see Supported Data Categories for Information
Views [page 42].
Default Client The value of this property determines whether modeler must filter data for a fixed client or a ses
sion client or a cross client (does not filter data). For more information, see Filter Data for Spe
cific Clients [page 86].
Apply Privileges The value of this property specifies the analytic privilege type selected for data access restric
tions on the calculation view. For more information, see Defining Data Access Privileges [page
92].
Default Schema The value of this property helps modeler identify the default schema, which contains the tables
necessary for currency or unit conversions. For more information, see Using Currency and Unit
of Measure Conversions [page 75].
Default Member This value of this property helps modeler identify the default member for all hierarchies in the
calculation views.
Enable History The value of this property determines whether your calculation view supports time travel quer
ies. For more information see, Enable Calculation Views for Time Travel Queries [page 87].
History Input Parameter Input parameter used to specify the timestamp in time travel queries.
Execute In The value of this property impacts the output data. It determines whether modeler must execute
the calculation view in SQL engine or column engine. For more information see SAP Note
1857202 .
Cache Invalidation Pe The value of this property impacts the output data. It determines the time interval to invalidate or
riod remove the cached content. For more information, see Invalidate Cached Content [page 88].
Execution Hints Execution hints impacts the output data. SAP HANA provides different execution hints. Execution
hints are name-value pairs, which helps the optimizer to optimize the execution process dynami
cally based on specific criteria. In other words, the hints instruct the optimizer on the access
paths to execute the calculation view.
Properties Description
Data Category The value of this property determines whether your calculation view supports analysis with mul
tidimensional reporting. For script-based calculation views, modeler supports only data cate
gory of type cube or blank. For more information, see Supported Data Categories for Informa
tion Views [page 42].
Default Client The value of this property determines whether modeler must filter data for a fixed client or a
session client or a cross client (does not filter data). For more information, see Filter Data for
Specific Clients [page 86].
Apply Privileges The value of this property specifies the analytic privilege type selected for data access restric
tions on the calculation view. For more information, see Defining Data Access Privileges [page
92].
Default Schema This value of this property helps modeler identify the default schema, which contains the tables
used in the script-based calculation views.
Enable History The value of this property determines whether your calculation view supports time travel quer
ies. For more information, see Enable Calculation Views for Time Travel Queries [page 87] .
History Input Parameter Input parameter used to specify the timestamp in time travel queries.
Run With The value of this property helps modeler identify the authorization to use for selecting the data
from the database, and for executing the calculation view or procedure. If the property is set to
Definer’s rights, then modeler uses the authorizations of the user who defines the view or pro
cedure. Similarly, if the property is set to Invoker’s right, modeler uses the authorizations of the
current user to access data from the database.
Cache Invalidation Pe The value of this property impacts the output data. It determines the time interval to invalidate
riod or remove the cached content. For more information, see Invalidate Cached Content [page 88].
This section describes how to create analytic privileges and assign them to different users to provide selective
data access control to activated information views.
Analytic privileges grant different users access to different portions of data in the same view based on their
business role. Within the definition of an analytic privilege, the conditions that control which data users see is
either contained in an XML document or defined using SQL.
Standard object privileges (SELECT, ALTER, DROP, and so on) implement coarse-grained authorization at
object level only. Users either have access to an object, such as a table, view or procedure, or they don't. While
this is often sufficient, there are cases when access to data in an object depends on certain values or
combinations of values. Analytic privileges are used in the SAP HANA database to provide such fine-grained
control at row level of which data individual users can see within the same view.
Example
Sales data for all regions are contained within one analytic view. However, regional sales managers should
only see the data for their region. In this case, an analytic privilege could be modeled so that they can all
query the view, but only the data that each user is authorized to see is returned.
SAP HANA modeler supports creating the following two types of analytic privileges, the classical XML-based
analytic privileges and the SQL analytic privileges.
Before you implement row-level authorization using analytic privileges, you need to decide which type of
analytic privilege is suitable for your scenario. In general, SQL-based analytic privileges allow you to more easily
formulate complex filter conditions that might be cumbersome to model using XML-based analytic privileges.
The following are the main differences between XML-based and SQL-based analytic privileges:
● Attribute views
● Analytic views
● Calculation views
Design-time modeling in the Editor tool of the SAP HANA Yes Yes
Web Workbench
All column views modeled and activated in the SAP HANA modeler and the SAP HANA Web-based
Development Workbench automatically enforce an authorization check based on analytic privileges. XML-
based analytic privileges are selected by default, but you can switch to SQL-based analytic privileges.
Column views created using SQL must be explicitly registered for such a check by passing the relevant
parameter:
SQL views must always be explicitly registered for an authorization check based analytic privileges by passing
the STRUCTURED PRIVILEGE CHECK parameter.
Note
It is not possible to enforce an authorization check on the same view using both XML-based and SQL-based
analytic privileges. However, it is possible to build views with different authorization checks on each other.
Related Information
Create analytic privileges for information views and assign them to different users to provide selective access
that are based on certain combinations of data.
Prerequisites
If you want to use a classical XML-based analytic privilege to apply data access restrictions on information
views, set the Apply Privileges property for the information view to Classical Analytic Privileges.
Context
Analytic privileges help restrict data access to information views based on attributes or procedures. You can
create and apply analytic privileges for a selected group of models or apply them to all models across
packages.
After you create analytic privileges, assign it to users. This restricts users to access data only for certain
combinations of dimension attributes.
Procedure
Use attributes from the secured models to define data access restrictions.
Note
Select a model if you want to use all attributes from the model to define restrictions.
c. Choose OK.
Modeler uses the restrictions defined on the attributes to restrict data access. Each attribute
restriction is associated with only one attribute, but can contain multiple value filters. You can create
more than one attribute restrictions.
e. In the Restriction Type dropdown list, select a restriction type.
f. Select the required operator and provide a value using the value help.
g. For catalog procedure or repository procedure, you can also provide values using the syntax <schema
name>::<procedure name> or <package name>::<procedure name> respectively.
10. Activate analytic privileges.
a. If you want to activate the analytic privilege, in the menu bar, choose Save.
b. If you want to activate the analytic privilege along with all objects, in the menu bar, choose Save All.
Note
Activate the analytic privilege only if you have defined at least one restriction on attributes in the
Associated Attributes Restrictions section.
If you want to assign privileges to an authorization role, execute the following steps:
This opens a new tab in the browser where you can assign the analytic privileges to users.
c. Expand Users.
d. Select a user.
Related Information
Define data access restrictions on information views using fixed restrictions or dynamic restrictions.
Fixed Value A fixed value or static value fil- For example, a value filter (EQ 2006) can be defined for an attrib
ter consists of an operator and ute YEAR in a dimension restriction to filter accessible data using
either a list of values as the filter the condition YEAR=2006 for potential users.
operands or a single value as
the filter operand. All data types
are supported except those for
LOB data types (CLOB, BLOB,
and NCLOB).
Catalog Procedure or Catalog Procedures or Reposi For example, a value filter (IN (GET_MATERIAL_NUM
Repository Proce tory Procedures are dynamic BER_FOR_CURRENT_USER())) is defined for the attribute MATE
dure. value filters, which consists of RIAL_NUMBER. This filter indicates that a user with this analytic
an operator and a stored proce privilege is only allowed to access material data with the numbers
dure call that determines the returned by the procedure GET_MATERIAL_NUMBER_FOR_CUR
operand value at runtime. RENT_USER.
SQL based analytic privileges provides you the flexibility to create analytic privileges within the familiar SQL
environment. You can create and apply SQL analytic privileges for a selected group of models or apply them to
all models across packages.
Prerequisites
If you want to use a SQL analytic privilege to apply data access restrictions on information views, set the Apply
Privileges property for the information view to SQL Analytic Privileges.
Context
SAP HANA modeler support types SQL analytic privileges, the static SQL analytic privileges with predefined
static filter conditions, and dynamic SQL analytic privileges with filter conditions determined dynamically at
runtime using a database procedure.
Procedure
If you want to create an analytic privilege and apply the data access restrictions for selected list of models,
in the Secured Models section,
a. Choose Add.
b. In the Find Data Sources dialog, select the models for which you want apply the analytic privilege
restrictions.
c. Choose OK.
9. Defining static SQL analytic privileges.
Note
You can also use hierarchy nodes in SQL analytic privilege definitions. For example,
"SalesRepHierarchyNode" = "MAJESTIX".
Note
Activate the analytic privilege only if you have defined at least one restriction on attributes in the
Associated Attributes Restrictions section.
If you want to assign privileges to an authorization role, execute the following steps:
This opens a new tab in the browser where you can assign the analytic privileges to users.
c. Expand Users.
d. Select a user.
e. In the Analytic Privileges tab page, choose the add icon to add the privilege.
f. In the editor toolbar, choose Activate.
Note
For SQL analytic privileges, you can also define the attribute restrictions and dynamic restrictions
without using the SQL editors. If you want to define attribute restrictions, select the Attributes radio
button and define the attribute restrictions. Similarly, if you want to define dynamic analytic privileges,
select the Dynamic radio button and use a repository procedure or a catalog procedure, which
dynamically determines the restrictions on information models.
Related Information
An analytic privilege consists of a set of restrictions against which user access to a particular attribute view,
analytic view, calculation view, or SQL view is verified. In an SQL-based analytic privilege, these restrictions are
specified as filter conditions that are fully SQL based.
SQL-based analytic privileges are created using the CREATE STRUCTURED PRIVILEGE statement:
The FOR clause is used restrict the type of access (only the SELECT action is supported). The ON clause is
used to restrict access to one or more views with the same filter attributes.
The <filter condition> parameter is used to restrict the data visible to individual users. The following
methods of specifying filter conditions are possible:
A fixed filter clause consists of an WHERE clause that is specified in the definition of the analytic privilege
itself.
You can express fixed filter conditions freely using SQL, including subqueries.
By incorporating built-in SQL functions into the subqueries, in particular SESSION_USER, you can define an
even more flexible filter condition.
Example
country IN (SELECT a.country FROM authorizationtable a WHERE SESSION_USER=
a.user_name)
Note
A calculation view cannot be secured using an SQL-based analytic privilege that contains a complex filter
condition if the view is defined on top of analytic and/or attributes views that themselves are secured with
an SQL-based analytic privilege with a complex filter condition.
Remember
If you use a subquery, you (the creating user) must have the required privileges on the database objects
(tables and views) involved in the subquery.
Comparative conditions can be nested and combined using AND and OR (with corresponding brackets).
With a dynamically generated filter clause, the WHERE clause that specifies the filter condition is generated
every time the analytic privilege is evaluated. This is useful in an environment in which the filter clause changes
very dynamically. The filter condition is determined by a procedure specified in the CONDITION PROVIDER
clause, for example:
Sample Code
CREATE STRUCTURED PRVILEGE dynamic_ap FOR SELECT ON schema1.v1 CONDITION PROVIDER
schema2.procedure1;
Procedures in the CONDITION PROVIDER clause must have the following properties:
Tip
A procedure that returns the filter condition 1=1 or 1>1 can be used to create an analytic privilege that
allows access to all data or no data in a view.
● The procedure must be executable by _SYS_REPO, that is, either_SYS_REPO must be the owner of the
procedure or the owner of the procedure has all privileges on the underlying tables/views with GRANT
OPTION and has granted the EXECUTE privilege on the procedure to the _SYS_REPO user.
If errors occur in procedure execution, the user receives a Not authorized error, even if he has the analytic
privileges that would grant access.
Use the CREATE STRUCTURED PRIVILEGE statement to create SQL-based analytic privileges for different
scenarios.
Context
The examples provided here take you through the following scenarios:
● Example 1: Securing a column view using an SQL-based analytic privilege with a fixed filter clause [page
101]
● Example 2: Securing an SQL view using an SQL-based analytic privilege with a complex filter clause
(subquery) [page 103]
● Example 3: Securing a column view using an SQL-based analytic privilege with a dynamically generated
filter clause [page 105]
Note
The analytic privileges in these example are created using the CREATE STRUCTURED PRIVILEGE statement.
Under normal circumstances, you create SQL-based analytic privileges using the SAP HANA Web-based
Development Workbench. Analytic privileges created using CREATE STRUCTURED PRIVILEGE are not
owned by the user _SYS_REPO. They can be granted and revoked only by the actual database user who
creates them.
Prerequisites
The database user TABLEOWNER has set up a calculation scenario based on the table SALES_TABLE, which
contains the data to be protected.
Context
All sales data is contained in a single view. You want to restrict user access so that sales managers can see only
information about the product "car" in the sales region UK and Germany. You want to do this by creating an
analytic privilege with a fixed filter clause.
A fixed filter clause consists of an SQL WHERE clause that is specified in the definition of the analytic privilege
itself.
Note
You can see above that the authorization check using XML-based analytic privileges is disabled with
'REGISTERVIEWFORAPCHECK'='0', while the authorization check using SQL-based analytic privileges
is enabled with STRUCTURED PRIVILEGE CHECK. Both checks cannot be enabled at the same time.
Remember
When specifying filters, remember the following:
○ You can specify only the SELECT action in the FOR clause.
○ You can specify one or more views with the same filter attributes in the ON clause
○ You can specify comparative conditions between attributes and constant values using only the
following operators:
○ =, <=, <, >, >=
○ LIKE
○ BETWEEN
○ IN
○ You can create complex filter conditions by including SQL statements as subqueries inside the
WHERE clause. Example 2 illustrates how you do this. But remember: A calculation view cannot be
secured using an SQL-based analytic privilege that contains a complex filter condition if the view is
defined on top of analytic and/or attributes views that themselves are secured with an SQL-based
analytic privilege with a complex filter condition.
Also remember that if you use a subquery, you must have the required privileges on the database
objects (tables and views) involved in the subquery.
3. Grant the SELECT privilege on the view TABLEOWNER.VIEW_SALES to the relevant users/roles:
Remember
Only the view owner or a user who has the SELECT privilege WITH GRANT OPTION on the view can
perform the grant.
Remember
Only the owner of the analytic privilege can grant it.
Prerequisites
The database user TABLEOWNER has created a table TABLEOWNER.SALES, which contains the data to be
protected.
Context
All sales data is contained in a single view. You want to restrict access of user MILLER so that he can see only
product information from the year 2008. You want to do this by creating an analytic privilege with a complex
filter clause.
With a complex filter clause, the SQL WHERE clause that specifies the filter condition includes an SQL
statement, or a subquery. This allows you to create complex filter conditions to control which data individual
users see.
Procedure
1. Create the view containing the sales data which needs to be secured:
Remember
The user creating the view must have the SELECT privilege WITH GRANT OPTION on the table
TABLEOWNER.SALES.
Remember
○ Subqueries allow you to create complex filter conditions, but remember: A calculation view cannot
be secured using an SQL-based analytic privilege that contains a complex filter condition if the view
is defined on top of analytic and/or attributes views that themselves are secured with an SQL-based
analytic privilege with a complex filter condition.
○ The user creating the analytic privilege must have the SELECT privilege on the objects involved in
the subquery, in this case table VIEWOWNER.AUTHORIZATION_VALUES.
○ The session user is the database user who is executing the query to access a secured view. This is
therefore the user whose privileges must be checked. For this reason, the table containing the
authorization information needs a column to store the user name so that the subquery can filter on
this column using the SQL function SESSION_USER.
Caution
Do not map the executing user to the application user. The application user is unreliable because it is
controlled by the client application. For example, it may set the application user to a technical user or it
may not set it at all. In addition, the trustworthiness of the client application cannot be guaranteed.
Remember
Only the view owner or a user who has the SELECT privilege WITH GRANT OPTION on the view can
perform the grant.
Remember
Only the owner of the analytic privilege can grant it.
Prerequisites
The database user TABLEOWNER has set up a calculation scenario based on the table SALES_TABLE, which
contains the data to be protected.
Context
All sales data is contained in a single view. You want to restrict access of user ADAMS so that he can see only
information about cars bought by customer Company A or bikes sold in 2006. You want to do this by creating
an analytic privilege with a dynamically generated filter clause.
With a dynamically generated filter clause, the SQL WHERE clause that specifies the filter condition is
generated every time the analytic privilege is evaluated. This is useful in an environment in which the filter
clause changes very dynamically.
Procedure
INSERT
INTO "AUTHORIZATION"."AUTHORIZATION_FILTERS" VALUES('(CUSTOMER=''Company A''
AND PRODUCT=''Car'') OR (YEAR=''2006'' AND PRODUCT=''Bike'')',
'ADAMS')
;
Remember
Filters containing comparative conditions must be defined as specified in example 1.
Remember
When using procedures as the condition provider in an SQL-based analytic privilege, remember the
following:
On evaluation of the analytic privilege for user ADAMS, the WHERE clause (CUSTOMER='Company A' AND
PRODUCT='Car') OR (YEAR='2006' AND PRODUCT='Bike'), as provided by the procedure
GET_FILTER_FOR_USER, will be used.
6. Grant the SELECT privilege on the view TABLEOWNER.VIEW_SALES to user ADAMS:
Remember
Only the owner of the analytic privilege can grant it.
After modeling calculation views or at design time you can perform certain additional functions, which helps
improve the efficieny of modeling calculation views.
This section describes the different additional functions that SAP HANA modeler offers and how you can use
these functions to efficiently model views.
Related Information
Open calculation views in performance analysis mode and obtain information on the catalog tables. This
information helps you analyze the possible performance impacts on information views at runtime. For example,
you can obtain information on table partitions, number of rows in tables, and so on.
In performance analysis mode, you obtain following key information and much more depending on data
sources in your calculation view.
Identify those data sources that have number of rows above a certain threshold value. You can configure this
threshold value in the modeling settings.
If you have partitioned tables, identify the partitioned tables along with partition type (Hash, Range, Round
Robin) and columns used for partitioning the tables. In addition, you can also obtain information on the table
type. For example, if you are using virtual tables, then modeler provides information on the virtual table
properties (remote DB, remote source, remote owner, and remote object) and its values.
Procedure
The Web-based Editor tool is available on the SAP HANA XS Web server at the following URL: http://
<WebServerHost>:80<SAPHANAinstance>/sap/hana/ide/editor
2. Open the required graphical calculation view in the view editor.
Note
Performance analysis is not supported for script-based calculation views.
Note
You cannot analyze the performance of the Semantics node.
4. In the menu bar, choose the icon to enable performance analysis mode.
The modeler displays the following information in the Performance Analysis tab.
○ Join Details
○ Data Source Details
Note
You can choose the same icon to hide performance analysis mode for a calculation view.
Note
If you want to always open a calculation view in performance analysis mode by default, configure the
modeling settings.
If you have enabled the performance analysis mode by default, open an information view and select a join node
with catalog tables to obtain join details.
For a selected join node, the JOIN DETAILS section in Performance Analysis tab provides the following
information:
Note
Only users with SELECT privileges on the catalog tables participating in the join can view join validation
status. If the participating catalog tables are virtual tables, then you can view the join validation status only if
the user has SELECT privileges on the virtual table and also if the user credential to remote source has
SELECT privileges on the remote table.
If you have enabled the performance analysis mode, open an information view and select a view node with
catalog tables to obtain data source details.
For a selected view node, the DATA SOURCE DETAILS section in Performance Analysis tab provides the
following information:
Note
Only users with system privilege INIFILE ADMIN can idenitfy whether a system is using a scale-out
architecture.
When you are modeling a calculation view, you can also maintain comments for the view or for its objects such
as parameters, hierarchies, view nodes and so on. The comments can include, for example, information that
provides more clarity on the calculation view or its objects for data modelers accessing the same view or its
objects.
Context
Maintaining comments helps your store more information related to the calculation view or to store and
provide reference information for other data modelers working on the same calculation view. You can also use
the comments for documentation purposes.
Note
You cannot translate comments that you maintain for the modeler objects.
Procedure
The Web-based Editor tool is available on the SAP HANA XS Web server at the following URL: http://
<WebServerHost>:80<SAPHANAinstance>/sap/hana/ide/editor
2. Open the graphical calculation view for which you want to maintain comments in view editor.
d. Choose .
e. Enter a new comment or edit an existing comment.
5. Maintain comments for view nodes.
a. Select the view node other than the Semantics node and the default view node.
b. Choose .
c. Enter a new comment or edit an existing comment.
6. Maintain comments for input parameters and variables.
a. Select the Semantics node.
b. Choose the Parameters/Variables tab.
c. Select an input parameter or variable for which you want to maintain comments.
d. Choose .
e. Enter a new comment or edit an existing comment.
7. Maintain comments for hierarchies.
a. Select the Semantics node.
b. Choose the Hierarchies tab.
c. Select a hierarchy for which you want to maintain comments.
d. Choose .
e. Enter a new comment or edit an existing comment.
8. Maintain comments for calculated columns.
a. Select a view node with a calculated column.
b. Choose the Calculated Columns tab.
c. Select a calculated column for which you want to maintain comments.
d. Choose .
e. Enter a new comment or edit an existing comment.
9. Maintain comments for restricted columns.
a. Select a default aggregation node.
b. Choose the Restricted Columns tab.
c. Select a restricted column for which you want to maintain comments.
d. Choose .
e. Enter a new comment or edit an existing comment.
This section describes the functions, which you can use in expressions of column engine language. You create
expressions, for example, while creating expressions for calculated attributes or calculated measures.
You can create expressions, for example in calculated columns using the column engine (CS) language or the
SQL language.
Note
Related SAP Notes. The SAP Note 2252224 describes the differences between the CS and SQL string
expression with respect to Unicode or multibyte encoding. The SAP Note 1857202 describes the SQL
execution of calculation views.
Related Information
Data type conversion functions are used to convert arguments from one data type to another, or to test
whether a conversion is possible.
fixed fixed fixed (arg, int, int) arg2 and arg3 are the fixed(3.2, 8, 2) + fixed(2.3, 8,
intDigits and fractdigits 3)
parameters, respectively.
Convert arg to a fixed type of
date date date(stringarg) convert arg to date type. The date(2009) -> date('2009')
first version parses a string
date date(fixedarg) in the format "yyyy-mm-dd date(2009, 1, 2) ->
hh:mi:ss" where trailing date('2009-01-02')
date date(int, int) components except for the
year may be omitted. The date(fixed(2000020313502
date date(int, int, int)
version with one fixed 6.1234567, 10, 4)) ->
date date(int, int, int, int) number arg strips digits date('2000-02-03
behind the comma and tries 13:50:26')
date date(int, int, int, int, int) to make a date from the rest.
The other versions accept
date date(int, int, int, int, int,
the individual components
int)
to be set.
secondtime(string, string)
String functions are scalar functions that perform an operation on a string input value and return a string or
numeric value.
midstr string midstr(string, int, int) Returns a part of the string starting at
arg2, arg3 bytes long.
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 is 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 is
returned.
rightsru string rightstru(string, int) return arg2 characters from the right
of string. If arg1 is shorter than arg2
characters, the complete string is
returned.
- trim(s) = ltrim(rtrim(s))
rightstru string rightstru(string, int) return arg2 characters from the right
of string. If arg1 is shorter than arg2
characters, the complete string is
returned.
Scalar math functions perform a calculation, based on input values that are provided as arguments, and return
a numeric value.
time abs(time)
round(-123.456, 1) = -123.5
Date and time functions are scalar functions that perform an operation on a date and time input value and
returns either a string, numeric, or date and time value.
component component(date, int) The int argument may be int the range
1..6, the values mean year, month, day,
hour, minute, second, respectively. If a
component is not set in the date, the
component function returns a default
value, 1 for the month or the day, 0 for
other components. You can also apply
the component function to longdate
and time types.
adddays(longdate, int)
The following table lists the miscellaneous functions that you can use while creating expressions.
max max(arg1, arg2, arg3, ...) return the maximum value of max(0, 5, 3, 1)
the passed arguments list.
An arbitrary number of
arguments is allowed.
Arguments must be at least
convertible into a common
type.
min min(arg1, arg2, arg3, ...) return the minimum value of min(1, 2, 3, 4)
the passed arguments list.
An arbitrary number of
arguments is allowed.
Arguments must be at least
convertible into a common
type.
If objects within a calculation view are missing, for example, if the objects or its references are deleted, then
such calculation views are referred to as broken models. By using proxies, SAP HANA modeler helps you work
with broken models and fix inconsistencies.
When you open broken models, modeler displays red decorators for all missing objects that are essential to
successfully activate the calculation view.
If you have defined a calculation view CV1 on table T1 (C1, C2, C3) such that Attributes A1, A2, A3 is defined on
columns C1, C2, C3 respectively. Now, if you remove column C3 from the table T1, then the attribute A3
becomes inconsistent. In such cases, modeler injects proxies for C3, and when you open the calculation view
CV1 in the editor, modeler displays a red decorator for C3 and an error marker for A3 to indicate that it
is inconsistent.
Note
If the connection to SAP HANA system is not available, and if you try to open a calculation view, then
modeler uses proxies for all required objects and opens the calculation view in read-only mode. But, since
the model is not broken, the red decorators and the error markers are not shown.
You can resolve inconsistencies in analytic views or attribute views or calculation views by performing one of
the following:
● Deleting those missing objects that the calculation view requires. This action clears all references of
missing object.
● Adjusting mappings of inconsistent objects.
● Deleting inconsistent objects.
You can assign one or more alternate names (or aliases) to tables. For example, if you want to improve the
readability of a table name or if you want to add the same table again to your data foundation node, then you
can use aliases to avoid name conflicts.
Procedure
Replace a view node with any of the other underlying view nodes or replace a data source in view node with
other available data sources in the catalog object.
The column view for complex calculation views may contain multiple levels of view nodes. If you manually
delete a node in column view (without using the replace view node feature) and add new node, you lose the
semantic information of the deleted node. However, if your requirement is to replace the deleted view node
with its underlying view node, then you can use the replace feature to replace the view node with its underlying
node and retain the semantic information of the changed node. Similarly, you can also replace a data source in
a view node with other available data sources in the catalog object.
Related Information
Replace a view node in a calculation view with any of its underlying nodes without performing a delete
operation, and retain the semantic information of the changed node.
Context
For example, in the following calculation view, if you want to replace the node Union_1 with the node,
Projection_1, then you can do it by executing the following procedure.
Note
It is necessary to delete all unmapped target columns and references.
6. If you want to remove the node from the column view, select the Delete the node after replace checkbox.
If you do not select this checkbox, the view node appears as an orphan node in the column view.
7. Choose Finish.
Replace a data source in a calculation view with another data source in the catalog object without performing a
delete operation, and retain the semantic information of the changed node.
Context
For example, in the following calculation view, if you want to replace the data source, Projection_1 of Union_1
with another data source in the catalog object, then you can do it by executing the following procedure.
Restriction
You cannot replace a data source in a join view node that has more than two data sources.
4. In the Find Data Sources dialog box, enter the name of the new data source.
5. Select the data source from the list.
6. Choose Next.
7. Manage the source and target mappings.
8. Choose Finish.
For information about the capabilities available for your license and installation scenario, refer to the Feature
Scope Description (FSD) for your specific SAP HANA version on the SAP HANA Platform webpage.
Coding Samples
Any software coding and/or code lines / strings ("Code") included in this documentation are only examples and are not intended to be used in a productive system
environment. The Code is only intended to better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and
completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, unless damages were caused by SAP
intentionally or by SAP's gross negligence.
Gender-Neutral Language
As far as possible, SAP documentation is gender neutral. Depending on the context, the reader is addressed directly with "you", or a gender-neutral noun (such as
"sales person" or "working days") is used. If when referring to members of both sexes, however, the third-person singular cannot be avoided or a gender-neutral noun
does not exist, SAP reserves the right to use the masculine form of the noun and pronoun. This is to ensure that the documentation remains comprehensible.
Internet Hyperlinks
The SAP documentation may contain hyperlinks to the Internet. These hyperlinks are intended to serve as a hint about where to find related information. SAP does not
warrant the availability and correctness of this related information or the ability of this information to serve a particular purpose. SAP shall not be liable for any
damages caused by the use of related information unless damages have been caused by SAP's gross negligence or willful misconduct. All links are categorized for
transparency (see: https://help.sap.com/viewer/disclaimer).