Sie sind auf Seite 1von 98

1/10/2020

SAP Web IDE Full-Stack Modeling Guide


Generated on: 2020-01-10

SAP Cloud Platform | Cloud

PUBLIC

Original content: https://help.sap.com/viewer/3746eb56b77943b699df025ab2bc7552/Cloud/en-US

Warning

This document has been generated from the SAP Help Portal and is an incomplete version of the official SAP product
documentation. The information included in custom documentation may not re ect the arrangement of topics in the SAP Help
Portal, and may be missing important aspects and/or correlations to other topics. For this reason, it is not for productive use.

For more information, please visit the https://help.sap.com/viewer/disclaimer.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b4… 1/98
1/10/2020

Creating a Graphical Calculation View


A calculation view allows users to de ne more advanced slices on the data available in the SAP HANA database.

Calculation views are mainly used for analyzing operational data marts or running multidimensional reports on revenue,
pro tability, and more. Calculation views consume various combinations of content data (that is, non-metadata) to model a
business use case. You can classify content data as:

Attributes: Descriptive data - such as customer ID, city, and country.

Measures: Quanti able data - such as revenue, quantity sold, and counters.

Calculation views simulate entities (such as customer, product, sales, and more) and their relationships. Data visualization and
analysis applications such as SAP BusinessObjects Explorer and Microsoft Office based reporting tools consume these calculation
views and help decision makers in their decision process.

You can create calculation views with layers of calculation logic, which include measures sourced from multiple source tables, or
advanced SQL logic, and much more. The data sources in a calculation view can include any combination of tables and calculation
views. You can create joins, unions, projections, and aggregations 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. Calculation views can do the following:

Support both OLAP and OLTP models.

Support complex expressions (for example, IF, Case, Counter).

Support analytic privileges (for example, restricting a user for a certain cost center).

Support SAP ERP speci c features (for example, client handling, language, currency conversion).

Combine facts from multiple tables.

Support additional data processing operations (for example, Union, explicit aggregation).

Leverage both Column and Row tables.

Related Information
Attributes and Measures
Create Graphical Calculation Views
Preview Calculation View Output

Working With Attributes and Measures


Attributes and measures form content data that you use for data modeling. Attributes represent the descriptive data, such as
product and region, and measures represent quanti able data such as revenue and quantity sold.

Columns in calculation views are either a measure or attribute. Measures are columns where you de ne an aggregation. If
calculation views are used in SQL statements, 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 because they
don't need to be aggregated.

This section describes the various operations you can perform with attributes and measures. For example, you can create
calculated attributes or calculated measures.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b4… 2/98
1/10/2020

Related Information
Create Counters
Create Calculated Columns
Assign Semantics
Create Input Parameters
Assign Variables
Using Currency and Unit of Measure Conversions
Enable or Disable Attributes for Drilldown in Reporting Tools
Create Restricted Columns
Handle Null Values in Columns
Convert Attribute Values to Required Formats
Group Related Measures and Attributes
Using Hierarchies for Reporting
Associate Attributes with Other Related Attributes
Assign Value Helps for Attributes

Create Counters
Use counters to count the number of distinct values in one or more attribute columns. Counters are columns that display 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, the counter
displays the count of distinct combinations of both columns.

Procedure
1. Open the required calculation view in the view editor.

2. Select the default aggregation node or the star join node.

 Note
You can create counters for attribute columns in the default aggregation node or star join node only.

3. In the editor toolbar, choose (Expand Details Panel).

4. In the Calculated Columns tab, choose (Add) and select the Counter menu option.

5. De ne the counter.

a. Select and expand the new counter.

b. In the General section, provide a name and description for the new counter.

c. If you want to hide the counter for data preview, select Hidden.

d. In the Counter section, choose + (Add).

e. In the value help list, choose an attribute column.

 Note
Transparent Filter Flag

Set the transparent lter ag on attribute columns to True to get correct counter results in the following
scenarios:
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b4… 3/98
1/10/2020
Calculation views are stacked on top of other dependent calculation views, and you have de ned count-
distinct measures in the dependent views.

Queries on main calculation views let you lter column that you do not want to project.

For these scenarios, set the transparent lter ag to True on the ltered, nonprojected columns. You must set
the lter for these columns in all view nodes of the upper calculation view, and also in the default node of the
lower dependent calculation view. This ag helps correct unexpected counter numbers.

Create Calculated Columns


Create calculated columns as new output columns for a view, and calculate the column 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
1. Open the required calculation view in the view editor.

2. Select the view node in which you want to create the calculated column.

3. In the editor toolbar, choose (Expand Details Panel).

4. In the Calculated Columns tab, choose + (Add).

5. Select and expand the new calculated column.

6. In the General section, enter a name for the new calculated column.

7. In the Data Type dropdown list, select the data type for the calculated column.

8. Enter values for length and scale based on the selected data type.

The tool ignores the length for VARCHAR data type. If you want to, for example, truncate length, use the relevant string
functions in calculated column expression.

9. (Optional) De ne the calculated column.

If you are creating calculated columns in the default view nodes of cubes (calculation views of type cube), you can de ne
the semantics for the calculated column. In this view node, you can create calculated attributes or calculated measures
using attributes or measures respectively.

a. Select the default view node.

In the Semantics section, provide semantics information for the new calculated column.

b. In the Column Type dropdown list, select a value.

c. If you want to create a calculated measure and enable client-side aggregation for the calculated measure, select
Enable client side aggregation and, in the Aggregation Type dropdown list, select an aggregation type that the
client must perform on calculated measures.

 Note
After selecting the Enable client side aggregation checkbox, in the Aggregation Type dropdown list, select an
aggregation type that client must perform on the calculated measures.

d. Drilldown in the calculated attributes in the reporting tools.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b4… 4/98
1/10/2020
By default, the tool lets 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.

e. If you want to hide the calculated column in reporting tools, select Hidden.

10. Provide an expression.

You can create an expression using the SQL language or the column engine language.

a. In the Expression section, choose Expression Editor.

b. In the Language dropdown list, select the language you want to use to create the expression.

c. In the expression editor, enter a valid expression.

The tool computes this expression at runtime to obtain values of calculated columns.

For example, if("PRODUCT" = 'NOTEBOOK', "DISCOUNT" * 0.10, "DISCOUNT"), which is


equivalent to, if attribute PRODUCT equals the string ‘NOTEBOOK’ then DISCOUNT equals to DISCOUNT
multiplied by 0.10 should be returned. Else use the original value of the attribute DISCOUNT.

 Note
You can drag and drop the expression elements, operators, and functions to the editor and create expressions.
When providing values to the element in the expression, you can use the value help to provide values.

d. Choose Validate Syntax to identify any inconsistencies in the expression.

e. Choose Back.

Create Restricted Columns


Create restricted columns as an additional measure based on attribute restrictions. For example, you can choose to restrict the
values for the REVENUE column only to REGION = APJ, and YEAR = 2012.

Context
You can also use the capbilities of restricted measures to create a simple pivoting of your data.

For restricted columns, the tool uses the aggregation type of the base column. You can de ne restrictions on measures using any
of the following approaches:

De ne restrictions on measures using values from other attribute columns.

De ne restriction on measures using expressions based on SQL language or column engine language.

Procedure
1. Open the required graphical calculation view in the editor.

2. Select the required aggregation node.

 Note
You can create restricted columns in star join nodes or aggregation nodes only.

3. In the editor toolbar, choose (Expand Details Panel).

4. Choose the Restricted Columns tab.

5. Choose + (Add).

6. Select and expand the new restricted column.

7. In the General section, provide a name and label for the new restricted column.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b4… 5/98
1/10/2020
8. In the Base Measure dropdown list, choose a base measure value on which you want to apply restrictions.

9. If you want to hide the restricted column in reporting tools, select the Hidden checkbox.

10. De ne restrictions.

You can de ne restrictions on the base measure using constant values, xed values from other attribute columns, or input
parameters.

a. In the Restrictions section, select Columns.

b. Choose + (Add).

c. In the Column value help list, select an attribute column.

d. In the Operator dropdown list, select a required operation to de ne the condition.

If you are using BETWEEN operator, enclose strings that contain hyphen (-) character within double quotes.
Example, "HT-100".

e. In the Value eld, use the value help to select a value type.

You can provide a xed value from the attribute column or use an input parameter to provide value at runtime.
Provide or select the required value and choose OK.

 Note
The tool populates the value help list only if the calculation view in which you are de ning the restricted column
is built at least once.

f. If you want to apply restrictions based only on the de ned conditions, choose Include.

 Note
You can de ne multiple conditions using the same attribute columns or different attribute columns. For example,
the expression, ("CUSTOMER_ID" = '10' OR "CUSTOMER_ID" = '2010') AND
("CUSTOMER_NAME" = '' ") has three conditions.

11. Apply restrictions using expressions.

If you do not want to use a column value, but instead create and use an expression using the SQL language or the column
engine language to de ne restrictions.

 Note
Only a limited lists of SQL functions are supported for expressions in SQL language.

a. In the Restrictions section, select Expression.

b. In the Language dropdown list, select an expression language.

c. In the Expression Editor, enter a valid expression.

 Note
You can also use input parameters in your expressions to create restricted columns.

d. (Optional) Select Validate Syntax to validate the expression.

Example: Using Restricted Measures for


Pivoting
You can also use the capabilities of restricted measures to create a simple pivoting of your data.

For example, if you have data like the below sample data:

Sample Data

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b4… 6/98
1/10/2020

Year Measure_1 Measure_2

2015 10.1 100

2015 12.3 99

...

...

2015 13.12 120

2016 9.8 130

...

2017 11.23 103

...

and for the above example, if you want to have a separate measure for each year as a column in a key gure model.

2015_Measure1 2015_Measure_2 2016_Measure_1 2016_Measure_2 ...

then for each intended column, you can create this by using a restricted measure that is based on the measure and lters on the
respective year. For example, the de nition of the restricted measure 2015_Measure_1 will be as seen below:

Assign Semantics
Assigning semantics to measures or attributes in calculation views helps de ne output structure of views. Assigning semantics
help attach information on the type of attributes and measures in the calculation view.

Context
Client tools use semantic types to represent data in appropriate format. Assigning semantics to attributes or measures at design
time helps provide meaning to attributes and measures.

Procedure
1. Open the required calculation view in the view editor.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b4… 7/98
1/10/2020
2. Select the Semantics node.

3. In the editor toolbar, choose (Expand Details Panel).

4. Choose the Columns tab.

5. Select a measure or attribute.

6. Choose (Assign Semantics).

7. Choose the Assign Semantics menu option.

8. In the Semantic Type dropdown list, select the required semantic type.

9. Choose OK.

Related Information
Extract and Copy Semantics From Underlying Data Sources
Propagate Columns to Semantics
Supported Semantic Types for Measures
Supported Semantic Types for Attributes

Extract and Copy Semantics From


Underlying Data Sources
De ning semantics for calculation views include de ning the output columns, variables, or hierarchies of the calculation views and
their aggregation type. While de ning the semantics for a calculation view, you can extract and copy the semantic de nitions of
columns (or variables and hierarchies) from their underlying data sources.

Context
For example, let's say you are modeling a complex calculation view with multiple underlying data sources, and these data sources
have their own semantic de nitions for their columns. In this case, you can extract and copy the semantic de nitions of columns
from their underlying data sources to de ne the semantics of the calculation view. Extracting and copying the semantic de nitions
this way helps you save the effort of manually de ning the semantics of the calculation view.

Procedure
1. Open the required calculation view in view editor.

2. Select the Semantics node.

3. In the editor toolbar, choose (Expand Details Panel).

4. In the Columns tab, choose (Extract Semantics).

In the Extract Semantics dialog box, the tool displays the output columns from the underlying data sources.

5. Select the columns.

By default, the column properties, Label, Label Column, Aggregation Type, and Semantic Type, is enabled. This means
that the values of these column properties are extracted from the underlying views to the semantic de nition of the
calculation view. If you want to avoid copying the de nition, in the Columns tab you can clear the Aggregation Type
checkbox.

 Note

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b4… 8/98
1/10/2020
If the same column is available in two or more data sources specify the data source that the tool must use to extract
and copy the semantic de nition. In the Data Sources dropdown list, select the data source.

6. (Optional) Select and extract the hierarchies.

If you want to extract and copy hierarchies de ned in the underlying views to the semantic de nition of the target
calculation view,

a. In the Extract Semantics dialog box, select the Hierarchies tab.

 Note
If the nodes in the hierarchies are also the output columns of the calculation view, you can extract and copy
hierarchies.

b. Select the hierarchies de ned in the underlying views.

c. If the target calculation view already has hierarchies with same name, in the New Name eld, provide a different
name.

7. (Optional) Select and extract the variables.

If you want to extract and copy variables de ned in the underlying views to the semantic de nition of the target calculation
view,

a. In the Extract Semantics dialog box, select the Variables tab.

b. Select the variables de ned in the underlying views.

c. If the target calculation view already has variables with same name, in the New Name eld, provide a different
name.

 Note
You can extract only those variables to the calculation view whose reference column or hierarchy (used in the variable
de nition) are also part of the calculation view.

8. (Optional) Extract execution hints.

If you have de ned execution hints in the underlying views, you can extract them and use the execution hints to execute the
target (consuming) calculation view.

a. In the Extract Semantics dialog box, select the Execution Hints tab.

b. Select the execution hints de ned in the underlying views that you want to extract.

 Note
You cannot exctract the execution hint if the target view already has an execution hint with the same name. In
such cases, in the New Name text eld, provide a new name for the hint.

9. If you want to override the existing semantic de nition of the calculation view with the extracted semantics, select the
Overwrite semantics already de ned checkbox.

10. Choose OK.

Propagate Columns to Semantics


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 columns from underlying view nodes as output columns in all view nodes and up to the semantic node.

Context
The tool lets you propagate columns from an underlying view node to all nodes in the joined path up to the semantics node. This
means that you don't have to de ne the output columns of each node, if the same columns are already de ned in its underlying
node and you need these output columns in the above nodes up to the semantic node. Propagating columns are useful in complex
calculation views that many levels of view nodes.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b4… 9/98
1/10/2020

Procedure
1. Open the required calculation view in the view editor.

2. Select a view node.

 Note
You cannot select the default view node and propagate columns to the semantics node.

3. In the editor toolbar, choose (Expand Details Panel).

4. In the Mapping tab, select an output column that you want to propagate to the semantics node.

5. In the context menu, choose Propagate to Semantics.

Results
The tool propagates the columns you select to all view nodes and up to the semantics node. If some columns are already available
in any of the view nodes in the propagated path, the tool does not propagate columns to those nodes.

Supported Semantic Types for Measures


The following semantic types are supported for measures.

Amount with Currency Code

Quantity with Unit of Measures

Supported Semantic Types for Attributes


The following semantic types are supported for attributes.

Amount with Currency Code

Quantity with Unit of Measures

Currency Code

Unit of Measure

Date

Date – Business Date From

Date – Business Date To

Geo Location - Longitude

Geo Location - Latitude

Geo Location - Carto ID

Geo Location – Normalized Name

Hyperlinks - Attribute values as navigable hyperlinks

For associating attributes with Quantity with Unit of Measures or Amount with Currency Code, specify the unit column and
currency column respectively.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 10/98
1/10/2020

Assign Variables
Calculation views contain variables that are bound to speci c attributes within the calculation view. Variables are runtime lters
that help to lter attributes, based on values that users provide.

Context
You assign variables to attributes in calculation views to, for example, lter the results. At runtime, you can provide values to
variables by manually entering a value or by selecting them from the value help list.

Procedure
1. Create a variable.

a. Select the Semantics node.

b. In the editor toolbar, choose (Expand Details Panel).

c. Choose the Parameters tab.

d. Choose (Add).

e. Choose the Variable menu option.

f. Select and expand the new variable.

2. De ne 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 con gure 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 un ltered data.

d. If you want to con gure 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. De ne 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 ltered 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). In addition, hierarchical value helps are supported only for variables of
type Single.

4. Provide a default value.

Provide a default value that the tool must consider as the variable value when you do not provide any value to the variable.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 11/98
1/10/2020
a. In the Default Value section, provide default values using constant values or expressions.

Default Value Meaning

Constant If you want to use a constant as the default variable value, do the following:

a. In the Type dropdown list, select Constant.

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

a. In the Type dropdown list, select Expression.

You use the column engine language or the SQL language to provide the expression.

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

c. In the From Value eld or To Value eld, choose the value help icon to open the expression
editor.

d. In the Expression Editor, provide a valid expression.

e. Choose Validate Syntax to identify any inconsistencies in the expression.

f. Choose Back.

 Note
Providing multiple default values.
If you have con gured 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.

5. Assign variables to attributes.

Assign the variable to an attribute to lter its data at runtime.

a. In the Apply Filter section, choose + (Add) to add an attribute.

b. In the Attribute value help, select an attribute.

Related Information
Supported Variable Types

Use Session Variables


The calculation view editor allows you to use prede ned session variables or user-de ned session variables in lter expressions or
calculated columns.

Prerequisites
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 12/98
1/10/2020
You have set the user-de ned session variable in the context, M_SESSION_CONTEXT. Use the SQL Script statement SET to de ne
the variable in the context. For example, SET SESSION <'variable_name'>=<'value'>.

 Note
You have to de ne the variable in the current session and is available for the current session only.

Context
The session variables provide information on the current context.

 Restriction
You cannot use session variables in restricted columns.

Procedure
1. Open the required calculation view in the view editor.

2. Double-click the view node in which you want to lter columns with session variables.

3. In the Parameters tab, choose .

4. Choose the Session Variable menu option.

5. Select and expand the new session variable.

6. De ne the required session variable.

a. To use a prede ned session variable, in the Session Variable dropdown list, select the required prede ned session
variable.

b. If you want to use a custom session variable, in the Session Variable text eld, enter the required variable name.

Next Steps
After you have de ned the session variable, in lter expressions or calculated columns, you can access and use the session
variable in the expression editor.

Supported Variable Types


Graphical calculation views support the following variable types for assigning variables to attributes.

Type Description

Single value Filter and view output data, based on a single attribute value. For example, to view the sales of a product, where
the month is equal to January.

Interval Filter and view a speci c set of output data. For example, to view the expenditure of a company from March to
April.

Range Filter view output 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.

Supported Session Variables


The calculation view editor supports using prede ned session variables to lter columns.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 13/98
1/10/2020
The table lists the session variable that you can use in lter expresssion or calculated columns.

Supported Predefined Session Variables

Variable Value Constraint Set by Description

APPLICATION NVARCHAR(256) User/Client Speci es the application name.

APPLICATIONSTACK NVARCHAR(256) User/Client

APPLICATIONUSER NVARCHAR(256) User/Client Speci es the application-de ned


user name.

APPLICATIONVERSION NVARCHAR(256) User/Client Speci es the application version


information.
Applications can use their "own"
version naming, no format is
prede ned

DRIVERVERSION Speci es the version number of


the driver being used to connect

PROTOCOL_VERSION - Server Speci es the protocol version of


the client interface libraries,
formatted as: <protocol_version>
(<distribution_protocol_version>,
<data_format_version>). For
example, 4.1 (1,1) For example,
4.1(1,1).

XS_APPLICATIONUSER - server:XS client with security Writable XS_APPLICATIONUSER


token variable. The value has to be a
security token. For example, saml-
assertion.

The value is internally validated


and the user name is stored as
variable value. The X Sengine will
still set the user name directly.

The session variable


XS_APPLICATIONUSER are
always shown in
M_SESSION_CONTEXT, defaulting
to SQL user.
.

Create Input Parameters


Input parameters help you parameterize calculation views and execute them based on the values that users provide to the input
parameters at query runtime. The engine considers values provided for the input parameters as the PLACEHOLDER clause of the
SQL statement.

Context
You create an input parameter at design time (while modeling a calculation view), and provide values to the input parameter
placeholder at runtime to execute the calculation view. For example, if you want the calculation view to provide data for a speci c
region, then REGION is a possible input parameter. Create the input parameter, REGION and use it in a lter expression. At
runtime, the data is ltered based on the value provided to the input parameter, REGION.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 14/98
1/10/2020

Procedure
1. Open the required calculation view in the view editor.

2. Select a view node in which you want to create the input parameter.

 Note
Input parameters are not speci c to the view nodes and are de ned at the view level.

3. In the editor toolbar, choose (Expand Details Panel).

4. Choose the Parameters tab.

5. Choose (Add).

6. Select Input Parameter.

7. Maintain input parameter details

a. Select and expand the new input parameter.

b. In the General section, provide the input parameter name and description.

a. If you want to con gure the input parameter to mandatorily accept a value at runtime, select the Is Mandatory
checkbox.

b. If you want to con gure the input parameter to accept multiple values at runtime, 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.

8. De ne input parameter type.

a. In the Parameter Type dropdown list, select an input parameter type.

Input Parameter Type Description Next Steps

Direct Specify the data type and length and scale a. (Optional) In the Semantic Type dropdown list,
of the input parameter value that you want specify the semantic type for the input parameter.
to use at runtime.
b. In the Data Type dropdown list, select the data
You can also de ne an input parameter type.
with semantic type as Currency or Unit of
c. Provide the Length and Scale for the data type
Measure or Date.
you choose.
For example, in currency conversions, you
can specify the target currency value at
runtime by creating an input parameter of
type Direct with a semantic type as
Currency.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 15/98
1/10/2020

Input Parameter Type Description Next Steps

Column At runtime, the tool provides a value help a. If you want to use attribute data from another
list with attribute data. You can choose a calculation view as the reference column, use a
value from the attribute data as an input View/Table for value help to select the calculation
parameter value. view that contains the required attribute.

If you have used the attribute data in a b. In the Reference Column value help list, select an
hierarchy de nition, then select the attribute.
required hierarchy from the calculation
c. If you have used the reference column in a
view to populate the values in input
hierarchy, and if you want to use a hierarchy from
parameter value help list at runtime with
the calculation view to organize the data in
hierarchical representations.
reporting tools, in Hierarchy dropdown list, select
the required hierarchy.
 Note
The hierarchy must contain the
reference column of the variable at the
leaf level (in level hierarchies) or as a
parent attribute (in parent-child
hierarchies).

Static List At runtime, the tool provides a value help a. In the Data Type dropdown list, select the data
list with the static list. You can choose a type for the list values
value from this list as an input parameter
b. Provide the Length and Scale for the data type
value.
you choose.

c. In the List of Values section, choose + (Add) to


provide the list values.

Derived From Table At runtime, the tool uses the value from the a. Use the Table Name to select a table.
reference column of the table as the input
b. For the table you selected, in the Reference
parameter value. This means that it is not
Column dropdown list, select a column value.
necessary to provide any values to the
input parameter at runtime. c. In the Filters section, de ne lter conditions to
lter the values of the return column.
Input parameters of this type are typically
used to evaluate a formula. For example, d. If you want to provide a different value to the
you calculate a discount for speci c clients parameter at runtime (overriding the default value)
by creating an input parameter, which is and do not want the tool to automatically use the
derived from the SALES table and value returned by the table as the input parameter,
reference column REVENUE with a lter set select Input Enabled checkbox.
on the CLIENT_ID.

 Note
You can con gure input parameters of type,
Derived from table to mandatorily accept a
value at runtime only if it is input enabled.

If this checkbox is enabled, at runtime the tool


displays the value returned by the table as the
default value, but you can override this value based
on your requirements.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 16/98
1/10/2020

Input Parameter Type Description Next Steps

Derived From At runtime, the tool uses the value a. In the Procedure/Scalar Function eld, provide
Procedure/Scalar returned from the procedure or scalar as the name of procedure or scalar function.
Function the input parameter value.
b. If you want to provide a different value to the
parameter at runtime (override the default value)
and don't want the tool to automatically use the
value returned by the procedure, select Input
Enabled checkbox.

 Note
You can con gure input parameters of type,
Derived from Procedure/Scalar Function to
mandatorily accept a value or multiple values at
runtime only if it is input enabled.

If this checkbox is enabled, then at runtime the tool


displays the value returned by the procedure or
scalar function as the default value, but you can
override this value based on your requirements.

 Note
You cannot con gure input parameters of type, Derived from table to accept multiple values at runtime.

9. Provide default values.

Provide a default value that the tool must consider as the input parameter value if no value is provided to the input
parameter at runtime.

a. In the Default Value(s) section, provide default values using constant values or expressions.

 Note
The tool cannot accept a combination of expressions and constants as default values for input parameters.

Default Value Meaning

Constant If you want to use a constant value as the default input parameter value,

i. In the Default Value(s) section, choose + (Add).

ii. In Type dropdown list, select Constant.

iii. In Value value help list, provide a constant value.

Expression You can create an expression in SQL language or the column engine language. If you want to use the
result of an expression as the default input parameter value:

i. In the Default Value(s) section, choose the add icon.

ii. In Type dropdown list, select Expression.

iii. In the Value value help list, choose the value help to open the expression editor.

iv. In the Expression Editor, enter a valid expression.

v. Choose Validate Syntax to identify any inconsistencies in the expression.

vi. Choose Back.

For example, you can evaluate the expression date(Now()), and use the result as the default input
parameter value at runtime.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 17/98
1/10/2020

 Note
Providing multiple default constant values. If you have con gured the input parameter to accept multiple values
at the runtime by selecting the Multiple Entries checkbox, then you can provide multiple default constant values
to the input parameter. In the Default Value(s) section, choose + to add multiple default constant values. These
values appear on the selection screen when you run the calculation view.

Related Information
Map Input Parameters
Input Parameters

Map Input Parameters


If you are modeling calculation views on top of other calculation views that have input parameters de ned for them, you can map
the input parameters of underlying data sources to the input parameters of calculation views that you are modeling.

Context
When you map parameters of the current view to the parameters of the underlying data sources, the lters are moved down to the
underlying data sources at runtime. This reduces the amount of data transferred across them.

 Note
Input parameters are available for mapping only when used in the dependent data sources.

Procedure
1. Open the required calculation view in the view editor.

2. Select the Semantics node.

3. In the editor toolbar, choose (Expand Details Panel).

4. Choose the Parameters tab.

5. Choose (Manage Parameter Mapping).

6. In the Type dropdown list, select the required value.

Value Description

Data Sources If you are using other calculation views as data sources in a calculation view, and if you want to map input
parameters of the underlying data sources to the input parameters of the calculation view.

Procedures/Scalar If you are using input parameters of type procedure/scalar functions, and if you want to map the input
functions for input parameters de ned in the procedures or scalar functions to the input parameters of the calculation view.
parameters

Views for value help If you are using input parameters or variables that refer to external views for value help references, and if
for variables/input you want to map input parameters of external views to the input parameters of the calculation view.
parameters

Views for value help If you are ltering the attributes in the underlying data sources using other calculation views or tables as
for attributes value help, and if you want to map the input parameters in these value help views to the input parameters
of the calculation view.

7. Manage mappings for the source and target input parameters by dragging a value from the source to a value in the target.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 18/98
1/10/2020
8. If you want to auto-map, based on the source and target input parameter names,

a. On the toolbar, choose (Auto Map by Name).

 Note
If you are using auto-map, to map all unmapped parameters at the source, the system creates input parameters
with same name at the target.

9. If you want to create a constant value at the target calculation view,

a. Select (Create Constant).

b. Enter a constant value.

c. Choose OK.

Related Information
Create Input Parameters
Input Parameters

Input Parameters
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
de ned 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 lter expressions of calculation views, you can pass several values as an IN List. When de ning the expression, quote
the expression as described here:

For numerical type parameters

The lter expression of a calculation view CV1 is de ned as follows:

in("attr", $$param$$)

Then pass several values as:

select ... from CV1( 'PLACEHOLDER' = ('$$var$$' = 'VAL1, VAL2, VAL3')

For string type parameters

The lter expression of a calculation view CV1 is de ned as:

in("attr", $$param$$)

Then pass several values (with double quotes) as:

select ... from CV1( 'PLACEHOLDER' = ('$$var$$' = '''VAL1'',''VAL2'',''VAL3''')

The table here summarizes with some examples the input parameter expressions at design time and the query at runtime.

Input Parameter Multiple Expression In Query


Data Type Values

Integer False in("ID",$$IP_1$$) (placeholder."$$IP_1$$"=>1)

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 19/98
1/10/2020

Input Parameter Multiple Expression In Query


Data Type Values

Varchar False in ("elem_2",'$$IP_1$$') (placeholder."$$IP_1$$"=>'test')

Varchar False "elem_2" = '$$IP_1$$' (placeholder."$$IP_1$$"=>'test')

Integer True in("elem_3",$$IP_1$$) (placeholder."$$IP_1$$"=>'2,3')

Varchar True in("elem_2",$$IP_1$$) (placeholder."$$IP_1$$"=>'''test''')

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:

Default Value Expected Behavior

Yes Calculates the formula based on the default value

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.

Using Hierarchies for Reporting


The graphical calculation view editor in SAP Web IDE supports creating hierarchies using graphical modeling tools. Hierarchies
help 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-related hierarchy comprises of levels such as Fiscal Year, Fiscal Quarter,
Fiscal Month, and more. You can graphically create the following two types of hierarchies:

Level Hierarchies

Parent-Child Hierarchies

Related Information
Create Level Hierarchies
Create Parent-Child Hierarchies
Root Node Visibility
Orphan Nodes

Create Level Hierarchies


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.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 20/98
1/10/2020

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 more, until they reach the highest level. A
hierarchy typically comprises of several levels, and you can include a single level in more than one hierarchy. A level hierarchy is
rigid in nature, and you can access the root and child node in a de ned order only.

Procedure
1. Start SAP Web IDE in a Web browser.

2. Open the required calculation view in the view editor.

3. Select the Semantics node.

4. In the editor toolbar, choose (Expand Details Panel).

5. Choose the Hierarchies tab.

6. Choose (Add).

7. Choose the Level Hierarchy menu option.

8. Provide hierarchy details

a. Select and expand the new level hierarchy.

b. In the General section, provide a name and label to the new hierarchy.

9. De ne node style

The node style determines the node ID for the level hierarchy.

a. In the Node Style dropdown list, select a value.

10. Create levels.

a. In the Nodes tab, choose + (Add) to create a level.

b. In the Column value help list, select the required column value for each level.

c. In Level Type dropdown list, select a required level type.

The level type speci es 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 value help list, select a column value that the tool must use to order the hierarchy members.

 Note
MDX client tools use attribute values to sort hierarchy members.

e. In the Sort Direction dropdown list, select a value that the tool must use to sort and display the hierarchy members.

11. De ne level hierarchy properties.

For supporting different business scenarios, the tool allows you to de ne certain additional properties for the hierarchy. In
the Properties section, de ne the required values.

a. Select the Aggregate All Nodes checkbox to include the values of intermediate nodes of the hierarchy to the total
value of the root node of the hierarchy. If you do not select the Aggregate All Nodes checkbox, the tool does not
roll-up the values of intermediate nodes to the root node.

 Note
The value of Aggregate All Nodes property is interpreted only by the SAP HANA MDX engine. In the BW OLAP
engine, the tool 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, do not select the
checkbox. This helps the engine to execute the hierarchy more efficiently.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 21/98
1/10/2020
b. If you want to cache the hierarchy data after executing a query on the hierarchy, select the Cache checkbox.

c. If you want to convert the empty string values to NULL in client tools, select the Convert empty string values to
NULL checkbox.

The empty values are replaced with NULL in reporting tools.

d. In the Default Member text eld, enter a value for the default member.

This value helps the tool identify the default member of the hierarchy. If you do not provide any value, all members
of hierarchy are default members.

e. In the Root Node Visibility dropdown list, select a value.

This value helps the tool identify whether it is necessary to add an additional root node to the hierarchy.

f. In the Orphan Nodes dropdown list, select a value.

This value helps the tool identify how to handle orphan nodes in the hierarchy.

 Note
If you select Step Parent option to handle orphan nodes, in the Step Parent text eld, 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 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 step parent node ID can be [Level2].[B2]. The tool assigns all orphan nodes under this node.

12. (Optional) Handle values in fact table, which do not have corresponding values in master table.

In calculation views of type dimensions or shared dimensions (dimensions in star join calculation views), you can create a
new Not Assigned Member in the level hierarchy and use this hierarchy member to captures all values in fact table, which
do not have corresponding values in the master table. In level hierarchies, the not assigned member appears at each level
of the hierarchy.

a. Expand the NULL HANDLING section.

b. If you want to capture values in the fact tables that do not have corresponding values in the master table, then in the
Not Assigned Members dropdown list, select Enable.

By default, the tool does not provide a hierarchy member to capture such values. This means that, Not Assigned
Members is disabled. You can either enable or choose Auto Assign to handle unassigned members.

 Note
Selecting Auto Assign to handle not assigned members impacts the performance of your calculation view.
Select Auto Assign with caution.

c. Provide a name and label to the hierarchy member.

This label value appears in reporting tools or client tool along with the unassigned members.

d. If you want to drilldown this member in reporting tool, select the Enable Drilldown checkbox.

e. If you want to use null convert values to process NULL values in the fact table, which do not have any corresponding
records in the master table, select the Null Value Processing checkbox.

By default, the tool uses the string, _#_ as the null convert value. You can change this value in the Name eld under
the Null Value Member Properties section.

f. Provide a label for the null value member.

This value appears in the reporting tools to capture null values.

Related Information
Node Style
Query Shared Hierarchies
Orphan Nodes
Root Node Visibility

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 22/98
1/10/2020

Node Style
Node style value de ned for a level hierarchy helps the tool identify the format of the node ID in reporting tools. For example,
whether the node ID must comprise of the level name or node name or both in the reporting tools.

Node Style Description

Level Name For this node style, the node ID comprises of the level name and the node name. For example,
for a scal 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 scal
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 scal hierarchy, the Level Name
node style implies: FISCAL_2015.QUARTER_1.JAN

Create Parent-Child Hierarchies


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 de ne multiple parent-child pairs to support the compound node IDs. For example, you can create a compound parent-
child hierarchy that uniquely identi es cost centers with the following two parent-child pairs:

CostCenter and ParentCostCenter and

ControllingArea and ParentControllingArea,

A parent-child hierarchy is always based on two table columns and these columns de ne the hierarchical relationships among its
elements. Others examples of parent-child hierarchies are bill of materials hierarchy (parent and child) or employee master
(employee and manager) hierarchy.

Procedure
1. Start SAP Web IDE in a Web browser.

2. Open the required calculation view in the view editor.

3. Select the Semantics node.

4. In the editor toolbar, choose (Expand Details Panel).

5. Choose the Hierarchies tab.

6. Choose (Add).

7. Choose the Parent Child Hierarchy menu option.

8. Provide hierarchy details

a. Select and expand the new parent-child hierarchy.

b. In the General section, provide a name and label to the new hierarchy.

9. Create parent-child elements

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 23/98
1/10/2020
a. In the Nodes tab, choose + (Add).

b. In the Child value help list, select the required column value as the child attribute.

c. In the Parent value help list, select the required column value as a parent attribute of the child column that you have
selected.

d. If you want to place orphan nodes in the hierarchy under a step parent node, then in the Step Parent text eld, enter
a value (node ID) for the step parent node.

e. If you want to place the parent-child hierarchies under a root node, select the Root Node value help.

You can provide the Root Node value either as a xed value or as an input parameter. In the Type dropdown list,
select the required input parameter, or select Fixed and provide the required threshold value. Choose OK.

 Note
If you have selected root node visibility value as Add Root node, it is mandatory to provide the root node value.

10. De ne parent-child hierarchy properties.

For supporting different business scenarios, the tool allows you to de ne certain additional properties for the hierarchy. In
the Properties section, de ne the required values.

a. Select the Aggregate All Nodes checkbox to include the values of intermediate nodes of the hierarchy to the total
value of the root node of the hierarchy. If you do not select the Aggregate All Nodes checkbox, the tool does not
roll-up the values of intermediate nodes to the root node.

 Note
The value of Aggregate All Nodes property is interpreted only by the SAP HANA MDX engine. In the BW OLAP
engine, the tool 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, do not select the
checkbox. This helps the engine to execute the hierarchy more efficiently.

b. If you want the parent-child hierarchy to support multiple parents for its elements, select the Multiple Parent
checkbox.

c. If you want to cache the hierarchy data after executing a query on the hierarchy, select the Cache checkbox.

d. If you want to convert the empty string values in the fact table that do not have corresponding values in the master
table to NULL, select the Convert empty string values to NULL checkbox.

The empty values are replaced with NULL in reporting tools.

e. In the Default Member textbox, enter a value for the default member.

This value helps the tool identify the default member of the hierarchy. If you do not provide any value, all members
of hierarchy are default members.

f. In the Root Node Visibility dropdown list, select a value.

This value helps the tool identify whether to add an additional root node to the hierarchy.

g. In the Orphan Nodes dropdown list, select a value.

This value helps the tool identify how to handle orphan nodes in the hierarchy.

 Note
If you select Step Parent option to handle orphan nodes, then in the Nodes section, enter a value (node ID) for
Step Parent. The step parent node must already exist in the hierarchy at the root level.

h. In the Cycles dropdown list, select the required cycle.

If the parent-child relationships in the hierarchy have a circular reference, then a parent-child hierarchy is said to
contain cycles. You can use any of the following options to handle the behavior of such hierarchies at load time.

Options Description

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 24/98
1/10/2020

Options Description

Break up at load time The nodes are traversed until a cycle is encountered. The cycles are broken-up at load
time.

Traverse completely, then The nodes in the parent-child hierarchy are traversed once completely and then the
breakup cycles broken up.

Error Displays error when a cycle is encountered.

11. If you want to add additional attributes to the hierarchy view de nition and use them to execute the hierarchy, then

a. In the Additional Attributes section, choose + (Add).

b. In the Attributes value help list, select the required attribute value.

12. 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 + (Add).

b. In the Order By value help list, select the required column value that the tool must use to order hierarchy members.

c. In Sort Direction dropdown list, select the required value that the tool must use to sort and display the hierarchy
members.

 Note
MDX client tools use attribute values to sort hierarchy members.

13. Enable hierarchy for time dependency

In some business cases, the elements in a hierarchy are changing elements (time dependent elements). In such cases, you
can enable the parent-child hierarchy as a time dependent hierarchy. This helps to create hierarchies that are relevant for
speci c time periods and to 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 value help list, select the required column value.

c. In the Valid To Column value help list, select the required column value.

The tool uses the Valid From Column and Valid To Column values as the required validity time for time dependent
hierarchies.

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

15. If you want to use an input parameter to specify the key date at runtime,

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.

16. (Optional) Handle values in fact table, which do not have corresponding values in master table.

In calculation views of type dimensions or shared dimensions (dimensions in star join calculation views), you can create a
new Not Assigned Member in the parent-child hierarchy and use this hierarchy member to captures all values in fact table,

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 25/98
1/10/2020
which do not have corresponding values in the master table.

a. Expand the NULL HANDLING section.

b. If you want to capture values in the fact tables that do not have corresponding values in the master table, then in the
Not Assigned Members dropdown list, select Enable.

By default, the tool does not provide a hierarchy member to capture such values. This means that, Not Assigned
Members is disabled. You can either enable or choose Auto Assign to handle unassigned members.

 Note
Selecting Auto Assign to handle not assigned members impacts the performance of your calculation view.
Select Auto Assign with caution.

c. Provide a name and label to the hierarchy member.

This label value appears in reporting tools or client tool along with the unassigned members.

d. If you want to drilldown this member in reporting tool, select the Enable Drilldown checkbox.

e. If you want to use null convert values to process NULL values in the fact table, which do not have any corresponding
records in the master table, select the Null Value Processing checkbox.

By default, the tool uses the string, _#_ as the null convert value. You can change this value in the Name eld under
the Null Value Member Properties section.

f. Provide a label for the null value member.

This value appears in the reporting tools to capture null values.

Related Information
Query Shared Hierarchies
Orphan Nodes
Root Node Visibility

Query Shared Hierarchies


Enable SQL access to shared hierarchies and query them using SQL statements at runtime. This is necessary to obtain correct
aggregation results for hierarchy nodes.

Context
Calculation views in star join nodes are referred to as shared dimensions. The tool includes all attributes and hierarchies of a
shared dimension to the output of the star join calculation view. You can enable SQL access to shared hierarchies and query them
at runtime.

 Note
Not all reporting tools support SQL access to shared hierarchies. For example, this feature does not work with BI clients such
as MDX or Design Studio.

Procedure
1. Open the required star join calculation view.

2. Select the Semantics node.

3. If you want to enable SQL access to only a selected list of shared hierarchies, then:

a. In the editor toolbar, choose (Expand Details Panel).

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 26/98
1/10/2020
b. Choose the Hierarchies tab.

c. In the Shared section, select a hierarchy to which you want to enable SQL access.

d. Expand the SQL Access section

e. Select the Enable SQL access checkbox.

4. If you want to enable SQL access to all shared hierarchies of the current version of the calculation view, then:

a. Select the View Properties tab.

b. In the General section, select the Enable Hierarchies for SQL access checkbox.

Results
After you enable SQL access to shared hierarchies, the tool generates a Node column and a Hierarchy Expression Parameter for
the shared hierarchy with certain default names. You can use the node column to lter and perform SQL GROUP BY operation and
use the hierarchy expression parameter to lter the hierarchy nodes (for example, if you want query only the children nodes of a
parent-child hierarchy).

 Caution
Hierarchy Expression Parameter has been deprecated. We recommend you to not use this parameter in your calculation view.

For example, the following query shows uses the node column to lter and perform SQL GROUP BY operation:

 Sample Code
select "HierarchyNodeColumn",
sum("Revenue") as "Revenue"
FROM "_SYS_BIC"."mini/CvSalesCubeHier" group by "HierarchyNodeColumn";

Orphan Nodes
The tool provides different options to handle orphan nodes in hierarchies. For example, you can specify whether the orphan nodes
are treated as error or root nodes or more.

Options Description

Root Node Treat orphan nodes as root nodes.

Error Stop processing the hierarchy and show an


error.

Ignore Ignore orphan nodes.

Step Parent Put orphan nodes under a step parent node.

Root Node Visibility


Based on your business requirement, choose to add an additional root node to the hierarchy and place all other nodes as its
descendants.

Root Node Visibility Description

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 27/98
1/10/2020

Root Node Visibility Description

Add Root Node If De ned This is applicable only for parent-child hierarchies. The tool adds a root node
only if you have de ned a root node value.

Add Root node The tool 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 requires a root node for reporting purposes. The tool
creates a root node with the technical name ALL.

Do Not Add Root Node The tool does not add any additional root node to the hierarchy.

Using Currency and Unit of Measure


Conversions
If measures in calculation views represent currency or unit values, associate them with currency codes or unit of measures
respectively in the calculation view.

Associating measures help 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.

The tool performs currency conversions based on the source currency value, target currency value, exchange rate, and date of
conversion. It also performs unit conversions based on the source unit and target unit. In addition, you can also perform banking
currency conversion based on the market data area, conversion type, and the system time.

You can also use input parameters in currency conversion or unit of measure conversion to provide values at runtime. For example,
you can provide the target currency value or the target unit value at runtime.

Related Information
Associate Measures with Currency
Associate Measures with Unit of Measure
Reuse a Currency Conversion or Unit Conversion De nition
Tag Measures as Converted or Unconverted Values

Associate Measures with Currency


If measures in calculation views represent currency values, associate the measures with a currency code. This helps to display the
measure values along with the currency code at data preview or in reporting tools.

Prerequisites
The SAP HANA Database Module that contains the calculation view in which you are performing currency conversions also has all
tables necessary for currency conversions or has synonyms that refer to the currency conversion tables.

For ERP currency conversions, you have the standard SAP currency tables or synonyms of the tables, TCURC, TCURF,
TCURN, TCURR, TCURT, TCURV, TCURW, and TCURX.

For banking currency conversions, you have the tables or synonyms of the tables, F4_FXRATES, TF4_FXCVFCT,
TF4_FXRTTYP, TCURX and TCURN.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 28/98
1/10/2020

 Caution
If you are not using synonyms, the structure of the tables (table de nition) in the SAP HANA Database Module that you are
using for currency conversions must be similar to the standard currency tables listed in the prerequisites.

Context
Associating measures with currency codes is also necessary for currency conversions. For example, let's say you want to generate
a sales report for a region in a particular currency code, but you have the sales data in the database table with a different currency
code. In this case, create a calculation view by using the table column containing the sales data in the different currency as a
measure, and associate the measure with your desired currency to perform the currency conversion. Activate the calculation view
to generate the reports you need.

Procedure
1. Open the required calculation view in the view editor.

2. Select the Semantics node.

 Note
You can also assign associate measures in any of the Aggregation nodes with currency code values and perform
currency conversion.

3. In the editor toolbar, choose (Expand Details Panel).

4. In the Columns tab, select a measure to associate it with currency code.

5. In the menu bar, choose (Assign Semantics).

6. Choose the Assign Semantics menu option.

7. In the Semantic Type dropdown list, select Amount with Currency Code.

8. In the Application Type dropdown list, select a value.

Application Type Description

ERP To use R/3 ERP currency conversion functions as con gured in the tables TCURR, TCURF, TCURX,
TCURN and TCURV.

Banking To use the banking currency conversion functions as con gured in the tables F4_FXRATES,
TF4_FXCVFCT, TF4_FXRTTYP, TCURX and TCURN.

9. (Optional) Reuse currency conversion de nition.

You can reuse the currency code values and currency conversion de nition from a selected measure.

a. In the Reuse Semantics dropdown list, select the required measure.

The tool reuses the conversion semantics of the selected measure.

b. Select a reuse type.

Reuse Type Description

Reference Select to reuse conversion semantics of the selected measure as a reference in the currency
conversion de nition of the target measure. In this reuse type, when you modify the conversion
semantics of the reference measure, the conversion semantics of the target measure automatically
points to the updated conversion semantics.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 29/98
1/10/2020

Reuse Type Description

Copy Select to reuse by copying the conversion semantics of the selected measure to the conversion
de nition of the target measure. In this reuse type, modifying the conversion semantics of the
selected measure does not modify the conversion semantics of the target measure.

The tool populates the Assign Semantics dialog box with currency code values and currency conversion de nition
associated with the selected measure.

10. Select a display currency code value.

The tool displays the measure values with this currency code in reporting tools.

a. In the Display Currency dropdown list, select a value.

Value Description

Fixed Associate the measure with a currency code available in the currency table. This table either is a
synonym to the SAP currency table, TCURC, or has a structure similar to the standard SAP
currency table, TCURC.

Column Associate the measure with an attribute column available in the calculation view.

b. In the value help list, select the required value based on the selected display currency type.

For Fixed display currency type, if you have TCURC and TCURT tables (or its synonyms) in the same SAP HANA
Database Module, you can view the currency code values in the value help list along with its description.

 Note
The tool populates the value help list only if:

You have the TCURC table or its synonym in the same SAP HANA Database Module or

You have de ned a TCURR table as the Rates table in the Conversion Table section

If the value help list is not populated, you can manually enter the required display currency code.

c. Choose OK.

11. Enable decimal shift.

By default, the precision of all values is two digits in SAP ERP tables. Because some currencies require accuracy in value,
the tool shifts the decimal points according to the settings in the TCURX currency table. For example, if the source
currency has 0 valid digits, it is necessary to multiply each value by 100 because in SAP ERP systems values are stored
using two digits.

a. If you want to enable a decimal shift for the selected display currency, select the Decimal Shifts checkbox.

12. Enable conversion.

a. If you want to convert the measure value to another currency, select the Conversion checkbox.

13. Enable rounding.

If you have enabled conversion, and you want to round the result value after currency conversion to the number of digits of
the target currency, do the following:

a. Select the Rounding checkbox.

 Note
Use rounding cautiously because rounding errors could accumulate after subsequent aggregations.

14. Enable decimal shift back.

Decimal shift back is necessary if the result of the calculation views is interpreted in ABAP. The ABAP layer, by default,
always executes the decimal shift. In such cases, decimal shift back helps avoid wrong numbers caused by a double shift.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 30/98
1/10/2020
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 Shift back.

15. Enable reverse lookup.

If you have enabled conversion, you can use reverse lookup method for currency conversion. This method determines the
conversion rates with swapped units and inverts the rate before conversion. For example, if a user wants to convert EUR to
USD but TCURR only has an entry for USD to EUR, then reverse lookup method will nd a rate (USD to EUR), invert it and
nally convert EUR to USD.

a. If you wan to use the reverse lookup method in currency conversion, select Reverse Look Up.

16. Specify the conversion tables.

Specify the conversion tables that the tool must refer to for currency conversion

Table Application Type Table Description

ERP In the value help list, select a table that provides the exchange rate information or the
conversion rates.

This table either is a synonym to the SAP currency table, TCURR, or has a structure
similar to standard SAP currency table, TCURR.
Rates
Banking In the value help list, select a table that provides the exchange rate information or the
conversion rates.

This table either is a synonym to the SAP table, F4_FXRATES, or has a structure similar
to standard SAP table, F4_FXRATES.

ERP In the value help list, select a table that provides the exchange rate types.

This table either is a synonym to the SAP currency table, TCURV, or has a structure
similar to standard SAP currency table, TCURV.
Con guration
Banking In the value help list, select a table that provides the exchange rate types.

This table either is a synonym to the SAP table, TF4_FXRTTYP, or has a structure similar
to standard SAP table, TF4_FXRTTYP.

ERP In the value help list, select a table that provides the conversion factors information.

This table either is a synonym to the SAP currency table, TCURF, or has a structure
similar to standard SAP currency table, TCURF
Prefactors
Banking In the value help list, select a table that provides the conversion factors information.

This table either is a synonym to the SAP table, TF4_FXCVFCT, or has a structure similar
to standard SAP table, TF4_FXCVFCT.

ERP In the value help list, select a table that provides the quotations information.

This table either is a synonym to the SAP currency table, TCURN, or has a structure
similar to standard SAP currency table, TCURN.
Notations
Banking In the value help list, select a table that provides the quotations information (price or
amount quoted).

This table either is a synonym to the SAP currency table, TCURN, or has a structure
similar to standard SAP currency table, TCURN.

Precisions ERP In the value help list, select a table that provides information on decimal places in
currencies.

This table either is a synonym to the SAP currency table, TCURX, or has a structure
similar to standard SAP currency table, TCURX.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 31/98
1/10/2020

Table Application Type Table Description

Banking In the value help list, select a table that provides information on decimal places in
currencies.

This table either is a synonym to the SAP currency table, TCURX, or has a structure
similar to standard SAP currency table, TCURX.

17. Provide additional details for currency conversions.

a. Choose the De nition tab.

b. In the Client dropdown list, select the required value that the tool must use for currency conversion rates.

Value Description

Fixed Set a xed client value or select a session client for currency conversions. Provide the required
value in the value help list.

Column Attribute column available in the calculation view to provide the client value. Select the required
value from the value help list.

Input Parameter Set an input parameter to provide the client value at runtime. Select the required input parameter
from the value help list.

c. Specify the source currency.

In the Source Currency dropdown list, select the required value.

Value Description

Fixed Select the source currency value from the currency table. Provide the required value in the value
help list.

Column Attribute column available in the calculation view to provide the source currency value. Select the
required value from the value help list.

For Fixed source currency type, if you have TCURC and TCURT tables (or its synonyms) in the same SAP HANA
Database Module, you can view the currency code values in the value help list along with its description.

 Note
The tool populates the value help list only if:

You have the TCURC table or its synonym in the same SAP HANA Database Module or

You have de ned a TCURR table as the Rates table in the Conversion Table section

If the value help list is not populated, you can manually enter the required display currency code.

d. Specify the target currency.

In the Target Currency dropdown list, select the required value.

Value Description

Fixed Select the target currency value from the currency table. Provide the required value in the value
help list.

Column Attribute column available in the calculation view to provide the target currency value. Select the
required value from the value help list.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 32/98
1/10/2020

Value Description

Input Parameter Input parameter to provide the target currency value at runtime. Select the required input
parameter from the value help list.

For Fixed target currency type, if you have TCURC and TCURT tables (or its synonyms) in the same SAP HANA
Database Module, you can view the currency code values in the value help list along with its description.

 Note
The tool populates the value help list only if:

You have the TCURC table or its synonym in the same SAP HANA Database Module or

You have de ned a TCURR table as the Rates table in the Conversion Table section

If the value help list is not populated, you can manually enter the required display currency code.

e. Specify the exchange rate type.

In the Exchange Type dropdown list, select the required value.

Value Description

Fixed Select the exchange rate value from the currency table. Provide the required value in the value help
list.

Column Attribute calculated column available in the calculation view to provide the exchange rate value.
Select the required value from the value help list.

Input Parameter Input parameter to provide the exchange rate value at runtime. Select the required input parameter
from the value help list.

For Fixed exchange type, if you have TCURW table or its synonym in the same SAP HANA Database Module, you can
view the exchange codes in the value help list along with its description.

 Note
The tool populates the value help list only if:

You have de ned a TCURV table as the Con guration table in the Conversion Table section

If the value help list is not populated, you can manually enter the required display currency code.

f. Specify the date for currency conversion.

In the Conversion Date dropdown list, select the required value.

Value Description

Fixed Select the xed conversion date from the calendar.

Column Attribute value available in the calculation view to provide the date for currency conversion. Select
the required value from the value help list.

Input Parameter Input parameter to provide the date for currency conversion at runtime. Select the required input
parameter from the value help list.

g. Specify the exchange rate

If you want to specify the exchange rate using a column value from the calculation view, in the Exchange Rate value
help list, select a column value.

18. Provide details speci c for banking currency conversion.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 33/98
1/10/2020
If you are performing banking currency conversion, then provide these additional details.

a. In the Market Data Area dropdown list, select a value.

The market data area is a component of the primary keys of all market data in Bank Analyzer, and therefore also a
component of every interface that requests market data. This area is used for controlling all visibility and
authorization for market data. All market data is stored with a reference to a market data area.

Value Description

Fixed Provide or select a xed value from the value help list.

Column Attribute value available in the calculation view to provide the market data area. Select the required
value from the value help list.

For Fixed market data area, if you have F4_FXRATES table (or its synonym) in the same SAP HANA Database
Module, you can view the market data area values in the value help list.

b. In the Conversion Type dropdown list, select a value.

Value Description

Fixed Select the required conversion type from the value help list.
Mid: The average exchange rate calculated using the bid rate and ask rate.

Bid: The rate that a bank is willing to pay for goods, foreign currency, or securities.

Ask: The rate at which goods, foreign currency, or securities are offered for sale.

Column Attribute value available in the calculation view to provide the conversion type. Select the required
value from the value help list.

Input Parameter Input parameter to provide the required conversion type at runtime. Select the required input
parameter from the value help list.

c. In the System Time dropdown list, select a value.

Value Description

Fixed Select the xed system time from the calendar that de nes the system timestamp for time travel
functionality. The default value is the current system timestamp in GMT.

Column Attribute value available in the calculation view to provide the system time for conversion. Select
the required value from the value help list.

19. Provide the data type of value after currency conversion.

a. In the Data Type dropdown list, select the required data type.

b. Provide the length and scale for the selected data type.

20. Generate a result currency column.

a. If you want the tool to generate a column to store the result currency conversion values, select the Generate
Column checkbox.

 Note
The result currency column isn't available in reporting tools. You can only consume them using other calculation views
to perform calculations.

21. Conversion accuracy.

In the Accuracy dropdown list, select a value to set the behavior or intermediate conversions.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 34/98
1/10/2020

Value Description

Intermediate rounding If you want the intermediate conversions to mimic ERP behavior. Intermediate rounding is
the default behavior and limits the number of digits in the intermediate currency
conversions to eleven (11) digits.

Retain all possible digits If you want high accuracy in conversion results, and to retain all possible digits in the
intermediate currency conversions.

22. Manage error handling.

In the Upon Failure dropdown list, select the required value that speci es how the tool must populate data if conversion
fails.

Value Description

Fail The tool displays error for conversion failures at data preview.

Set to NULL The tool sets the values for corresponding records to NULL at data preview.

Ignore The tool displays unconverted values for the corresponding records at data
preview.

23. Choose OK.

Associate Measures with Unit of Measure


If measures in calculation views represent unit values, associate the measures with a unit of measure. This helps to display the
measure values along with the unit of measures at data preview or in reporting tools.

Prerequisites
The SAP HANA Database Module that contains the calculation view in which you are performing unit conversions either has all
tables necessary for unit conversions or has synonyms referring to the standard SAP unit tables T006, T006D, and T006A
available in other schemas.

 Note
If you are not using synonyms, the structure of the tables (table de nition) in the SAP HANA Database Module for unit
conversions must be similar to the standard SAP unit tables.

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 semantic type
Quantity with Unit of Measure and perform unit conversions.

Procedure
1. Open the required calculation view in the view editor.

2. Select the Semantics node.

 Note

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 35/98
1/10/2020
You can also assign associate measures in any of the Aggregation nodes with unit code values and perform unit
conversion.

3. In the editor toolbar, choose (Expand Details Panel).

4. In the Columns tab, select a measure to associate it with unit code.

5. In the menu bar, choose (Assign Semantics).

6. Choose the Assign Semantics menu option.

7. In the Semantic Type dropdown list, select Quantity with Unit Of Measure.

8. (Optional) Reuse unit conversion de nition.

You can reuse the unit code values and unit conversion de nition from a selected measure.

a. In the Reuse Semantics dropdown list, select the required measure.

The tool reuses the conversion semantics of the selected measure.

b. Select a reuse type.

Reuse Type Description

Reference Select to reuse conversion semantics of the selected measure as a reference in the unit conversion
de nition of the target measure. In this reuse type, when you modify the conversion semantics of
the reference measure, the conversion semantics of the target measure automatically points to the
updated conversion semantics.

Copy Select to reuse by copying the conversion semantics of the selected measure to the conversion
de nition of the target measure. In this reuse type, modifying the conversion semantics of the
selected measure does not modify the conversion semantics of the target measure.

The tool populates the Assign Semantics dialog box with unit code and unit conversion de nition associated with the
selected measure.

9. Select a display unit value.

The tool 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 code available in the unit table. This table has a structure
similar to any of the standard SAP unit tables, T006, T006A, or T006D.

Column Associate the measure with an attribute column available in the calculation view.

b. In the value help list, select the required value based on the selected display unit type.

For Fixed display unit type, if you have T006 and T006A tables (or its synonyms) in the same SAP HANA Database
Module, you can view the unit code values in the value help list along with its description.

 Note
The tool populates the value help list only if:

You have de ned a T006 table as the Rates table in the Conversion Table section or in the same SAP
HANA Database Module.

If the value help list is not populated, you can manually enter the required display currency code.

c. Choose OK.

10. Enable conversion.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 36/98
1/10/2020
a. If you want to convert the unit measure value to another unit, select the Conversion checkbox.

11. Specify the unit tables to refer for unit conversion.

a. In the Rates value help list, select a table that provides the unit conversion information.

This table either is a synonym to the SAP unit table, T006, or has a structure similar to standard SAP unit table,
T006.

b. In the Dimension value help list, select a table that provides information on dimensions.

This table either is a synonym to the SAP unit table, T006D, or has a structure similar to standard SAP unit table,
T006D.

12. Provide additional details for unit conversions.

a. Choose the De nition tab.

b. In the Client dropdown list, select the required value that the tool must use for unit conversion factors.

Value Description

Fixed Set a xed client value or select a session client for unit conversion factors. Provide the required
value in the value help list.

Column Attribute column available in the calculation view to provide the client value. Select the required
value from the value help list.

Input Parameter Input parameter to provide the client value to the tool at runtime. Select the required input
parameter from the value help list.

c. Specify the source unit.

In the Source Unit dropdown list, select the required value.

Value Description

Fixed Select the source unit value from the unit tables. Provide the required value in the value help list.

Column Attribute column available in the calculation view to provide the source unit value. Select the
required value from the value help list.

For Fixed source unit type, if you have T006 and T006A tables (or its synonyms) in the same SAP HANA Database
Module, you can view the unit code values in the value help list along with its description.

 Note
The tool populates the value help list only if:

You have de ned a T006 table as the Rates table in the Conversion Table section or in the same SAP
HANA Database Module.

If the value help list is not populated, you can manually enter the required display currency code.

d. Specify the target unit.

In the Target Unit dropdown list, select the required value.

Value Description

Fixed Select the target unit value from the unit tables. Provide the required value in the value help list.

Column Attribute column available in the calculation view to provide the target unit value. Select the
required value from the value help list.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 37/98
1/10/2020

Value Description

Input Parameter Input parameter to provide the target unit value to the tool at runtime. Select the required input
parameter from the value help list.

For Fixed target unit type, if you have T006 and T006A tables (or its synonyms) in the same SAP HANA Database
Module, you can view the unit code values in the value help list along with its description.

 Note
The tool populates the value help list only if:

You have de ned a T006 table as the Rates table in the Conversion Table section or in the same SAP
HANA Database Module.

If the value help list is not populated, you can manually enter the required display currency code.

13. Error handling.

In the Upon Failure dropdown list, select the required value that speci es how the tool must populate data if conversion
fails.

Value Description

Fail The tool displays error for conversion failures at data preview.

Set to NULL The tool sets the values for corresponding records to NULL at data preview.

Ignore The tool displays unconverted value for the corresponding records at data
preview.

14. Generate result unit column.

a. If you want the tool to generate a column to store the result unit conversion values, select the Generate checkbox.

 Note
The result unit column isn't available in reporting tools. You can only consume them using other calculation views to
perform calculations.

15. Choose OK.

Reuse a Currency Conversion or Unit


Conversion De nition
Reuse the currency conversion or unit conversion de nition of a selected measure in multiple other measures.

Context
When reusing the conversion semantics of a measure, you apply it as a reference to multiple other measures at a time.

Procedure
1. Open the required calculation view in the view editor.

2. Select the Semantics node.

3. In the editor toolbar, choose (Expand Details Panel).

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 38/98
1/10/2020
4. In the Columns tab, select a measure for which you have already enabled and de ned currency conversion or unit
conversion.

5. In the menu bar, choose (Assign Semantics).

6. Choose Apply Conversion Reference.

The tool displays the conversion semantics for the selected measure.

 Note
If you have not de ned any conversion semantics for the selected measure, rst de ne conversion semantics for the
measure. You can then reuse it to de ne conversion semantics of other target measures. In the Reuse Semantics
dropdown list, select a measure and reuse the conversion semantics of that measure, or de ne new conversion
semantics.

7. Choose Next.

8. Select all target measures in which you want to reuse the conversion semantics.

9. (Optional) Override conversion semantics.

For any of the selected target measure, if you have already de ned currency conversion or unit conversion (conversion
semantics already exists), you can override the conversion semantics.

a. Select the Override Existing Conversion Properties checkbox.

10. Choose Finish.

Tag Measures as Converted or Unconverted


Values
If you have associated a measure with a currency code to perform a decimal shift or currency conversion, the tool tags the
measure as converted value. Tagging helps other client tools that consume the calculation view to identify all such converted
values in the calculation view.

Context
The tool allows you to tag measures as converted or unconverted. Tagging help users depending on how the client tools consume
the measures with conversion semantics. For example, composite BW providers that consume the calculation view performs
decimal back shifting. So, if you have already de ned conversion semantics with decimal shifting for certain measures in the
calculation view, it could lead to double shifting (once in the SAP HANA view, then back shifting in the composite provider and
nally shifting again in the BW ABAB stack).

Procedure
1. Open the required calculation view in the view editor.

2. Select the Semantics node.

3. In the editor toolbar, choose (Expand Details Panel).

4. Choose the Columns tab.

By default, for all measures, the column property, Unconverted is selected. But, if you have de ned any currency
conversion semantics for a measure, then tool sets the Unconverted column property of that measures as False
(deselected).

 Tip
If this column property is not visible in the display, in the menu bar, choose (Customize Column Display) to select

and customize the display with the required column properties.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 39/98
1/10/2020
5. (Optional) Select or unselect the column property for a measure depending on whether you want to tag them as
unconverted or converted.

 Remember
You can also tag a measure for which you have de ned conversion semantics as unconverted. It depends on how you
want the client tools to consume the measures.

ORDER BY and Sort the Result Set


Users can use one or more output columns of a calculation view to ORDER BY and sort the result set of a calculation view.

Context
After modeling a calculation view and de ning its output columns, the tool allows you to specify a set of output columns as ORDER
BY columns. It also allows you to de ne a sort direction (Ascending or Descending) to sort the result set. When you execute a
query on a calculation view or at data preview, the tool uses these ORDER BY columns to sort the result set.

Procedure
1. Open the required calculation view in the view editor.

2. Select the Semantics node.

3. In the editor toolbar, choose (Expand Details Panel).

4. Choose the Columns tab.

5. In the menu bar, choose (Sort Result Set).

6. De ne the ORDER BY columns and the sort direction.

In the Sort Result Set dialog box, you can select one or more output columns of a calcution view as ORDER BY columns
and specify the sort direction.

a. In the menu bar, choose + to add an ORDER BY column.

You can add one or more output columns as ORDER BY columns.

b. In the Name dropdown list, select an output column as an ORDER BY.

c. In the Sort Direction dropdown list, select a value.

The tool uses ascending as the default sort direction.

d. Choose OK.

Mask Column Values in Client Tools


De ne data masking for column values when modeling a calculation view. It helps to mask con dential column values in the client
tools. The tool supports de ning data masking for column values in a way that they appear either completely masked or partially
masked in the client tools.

Context
For example, if you want the credit card details to be con dential and not be visible in client tools, then de ne data masking for the
column that contains credit card details.

Example for complete data masking of column values

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 40/98
1/10/2020
Unmasked Data: 1234-5678-9101-1121

Masked Data: XXXX-XXXX-XXXX-XXXX

Example for partial data masking of column values

Unmasked Data: 1234-5678-9101-1121

Masked Data: 1234-5678-XXXX-XXXX

 Note
You can apply data masking for columns of type VARCHAR and NVARCHAR only.

You de ne data masking for individual columns using an expression, and based on the masking expression, the query results
contain only masked values. You can de ne data masking only for visible columns and not for any hidden columns in the
calculation view.

 Note
Only users with the object privilege, UNMASKED can view unmasked (original) column values.

Procedure
1. Open the required calculation view in the view editor.

2. In the view editor, select the Semantics node.

3. Choose the Columns tab.

4. Select the required column for which you want to de ne data masking.

5. In the toolbar, choose (Data Masking).

6. Provide data masking expression.

In the Data Masking Expression dialog box, provide the masking expression. The masking expression can be a simple SQL
expression, or can also be based on built-in functions or scalar user-de ned functions.

a. In the expression editor, provide the SQL expression, which de nes the data masking required for the selected
column.

Use the elements and built-in functions (SQL functions) from the dialog box to de ne your expression.

7. (Optional) Select Validate Syntax to validate the expression or the scalar user-de ned function.

8. Choose OK.

 Note
You cannot use nested expressions to de ne data masking for columns.

Example
Consider a column, ACCOUNTNUMBER that contains account numbers of customers. The account number is an eleven digit
number, and assume that you want to partially mask the column values in client tools. The expression
CONCAT(LEFT("ACCOUNTNUMBER",4),'XXXXXXX') help to mask the last seven digits of account number values and only
displays the rst four digits.

Account Number: 12345678965 (Before masking)

Account Number: 1234XXXXXXX (After data masking)

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 41/98
1/10/2020

Assign Value Helps for Attributes


Assign a value help to an attribute column in a calculation view at design time. The value help can include attribute values from the
same calculation view or from a different calculation view.

Context
Assigning value helps for attributes are useful, especially in multidimensional calculation views. For example, consider you have
de ned 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, assign a value help to the attribute in CV1 with the
reference column, CUSTOMER_ID of CV2.

Procedure
1. Select the Semantics node.

2. In the editor toolbar, choose (Expand Details Panel).

3. Choose the Columns tab.

4. Select an attribute.

5. Choose (Assign Semantics).

6. Choose the Assign Value Help menu option.

7. Select a calculation view or table.

a. In the View/Table Value Help eld, select the required calculation view or table that you want to use for providing
values.

8. Select an attribute.

The tool displays attributes that are available in the selected table or calculation view.

a. In the Reference Column dropdown list, select an attribute.

b. Choose OK.

Results
At runtime, the tool provides a value help, which has values from the selected attribute. You can use these attribute values for
input parameters and variables.

Enable or Disable Attributes for Drilldown in


Reporting Tools
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
1. Open the required calculation view in the view editor.

2. Select the Semantics node.

3. In the editor toolbar, choose (Expand Details Panel).

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 42/98
1/10/2020
4. Choose the Columns tab.

5. Select an attribute.

6. In the Drill Down Enablement dropdown list, select a value.

Set the value to blank if you want to disable drilldown for the selected attribute.

Handle Null Values in Columns


De ne default values for columns (both attributes and measures) when no value is provided during a SQL INSERT operation. The
system uses these default values in the reporting tools to replace any null values in columns.

Context
Columns, both attributes and measures can contain unde ned values or null values. You can handle such cases by de ning default
values that replaces the null values in reporting tools. For example, you can replace the column values that appear with null value
representation, ? (question mark) with default value Null or with any other user de ned value.

Procedure
1. Open the calculation view in the view editor.

2. Select the Semantics node.

3. In the editor toolbar, choose (Expand Details Panel).

4. Choose the Columns tab.

5. Select a measure or attribute.

6. Select the Null Handling checkbox.

 Note
Con gure default column properties display.
Null handling is a column property. Use the horizontal scroll bar to view all available column properties for a column. If
you do not see Null Handling checkbox, choose the (Customize Column Display) icon in the menu bar and ensure
that you have selected the Null Handling column property.

7. In the Default Value text eld, provide a default value.

 Note
If you have enabled null handling for columns, and if you have not provided any default value, the tool considers the
integer 0 as the default value for columns. For columns of data type VARCHAR and NVARCHAR, if you have not de ned a
default value after enabling null handling, the tool considers empty string as the default value.

Set Presentation Scale for Measures


For measures with numerical data types, you can set the scaling factor that the client tools can interpret and use to present
measure values.

Context
The tool stores the presentation scale value for measures in the SCALE column of the BIMC_DIMENSION_VIEW_HDI table. It is
just a static metadata that the client tools can interpret. For example, if the presentation scale is set to 6, it means a value of
12000000 would be displayed as 12 in the client tools. This value is arrived at by computing 12000000/10^6.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 43/98
1/10/2020

 Note
The presentation scale that you set when modeling a calculation view does not impact the data preview in the SAP HANA
Database Explorer.

Procedure
1. Open the required calculation view in the view editor.

2. Select the Semantics node.

3. In the editor toolbar, choose (Expand Details Panel).

4. Choose the Columns tab.

5. Select the required measure.

6. In the Presentation Scale text eld, set a value.

If the Presentation Scale column property is not visible in the display, in the menu bar, choose (Customize Column
Display) to select and customize the display with the required column properties.

Convert Attribute Values to Required


Formats
Assign conversion functions to attribute columns. These functions help maintain conversion from any internal to external format
and from any external to internal format.

Context
For each attribute column, or input parameters or variables, you can assign two scalar functions. These functions help maintain
conversion of values to required formats. For example, the ABAP table stores data in YYYYMMDD format. You can use a scalar
function that converts the internal value, 20160503 to 2016.05.03 and use the new formatted value for reporting purposes.

You can also preserve the order of value, for example, see the following table:

Stored Data Type Format Stored Value Formatted Value Preserving Order

ABAP Date 20160503 05.03.2016 No

ABAP Date 20160503 2016.05.03 Yes

The following are example scenarios where you can use scalar functions to convert and format values

If you want to display attribute values in the reporting tools in a speci c format, but these values are stored internally in a
different format.

If you want to provide values to lters, variables or parameters in a speci c format, but internally these values are stored in
different formats.

Procedure
1. Open the required calculation view in the view editor.

2. Select the Semantics node.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 44/98
1/10/2020

3. In the editor toolbar, choose (Expand Details Panel).

4. Choose the Columns tab.

5. Select an attribute.

6. In the Semantics pane, choose (Conversion Function).

7. Assign conversion functions.

a. If you want to use a scalar function to format any internally stored value, in the Internal to External eld provide the
required scalar function.

Use the Find Data Sources dialog box to search for the required scalar function.

b. If you want to format an external value, for example, variables or input parameters, in the External to Internal eld
provide the required scalar function.

Use the Find Data Sources dialog box to search for the required scalar function.

Variables and parameters of type column implicitly inherit the conversion properties.

c. If you want to preserve the order, for example, 20150305 as 2015.03.05, select the Preserve Order checkbox.

d. Choose OK.

8. Assign conversion functions to parameters and variables.

You can also explicitly assign conversion functions to input parameters and variables. For example, for input parameters of
type derived, static list, direct, and more.

a. Select the Parameters tab.

b. Select the required input parameter or variable.

c. In the Conversion Function section, assign the required function.

d. If you want to preserve the order, for example, 20150305 as 2015.03.05, select the Preserve Order checkbox.

 Note
These functions are not applied in the database layer. It is used for providing hints to analytic clients on how to convert
values before displaying them in the client user interface (UI).

Associate Attributes with Other Related


Attributes
Associate attribute columns in a calculation view with its one or more related attributes from the same calculation view.

Context
Associating an attribute column with other related attribute columns help tag a set of attributes that provide additional
information for the target attribute column. For example, you can associate the attribute column PRODUCT_ID with attributes
such as Width, Height, Length, Price, and so on. The system internally stores the attribute relations in the
BIMC_ATTRIBUTE_RELATIONS table.

 Remember
Associating attributes with other related attributes does not impact the output of a calculation view. It is only relevant for the
interpretation of client tools (frontend tools) that consume the calculation view.

Procedure
1. Open the required calculation view in the view editor.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 45/98
1/10/2020
2. Select the Semantics node.

3. In the editor toolbar, choose (Expand Details Panel).

4. Choose the Columns tab.

5. Select an attribute.

6. Select the Related Attributes value help.

 Note
Con gure default column properties display.

Related attributes are a column property. Use the horizontal scroll bar to view all available column properties for a
column. If you do not see Related Attributes value help, choose the (Customize Column Display) icon in the menu
bar and ensure that you have selected the Related Attributes column property.

7. Select the required attributes with which you want to associate the target attribute.

8. Choose OK.

Group Related Measures and Attributes


Create folders in calculation views to logically group related measures or related attributes in a calculation view. For example, you
can group planned measures and actual measures in separate folders.

Context
A single calculation view contains multiple measures and multiple attributes. While modeling your calculation view, you can create
a Display Folder to group the related measures and related attributes within them. You can also create multiple folders within a
single display folder.

Procedure
1. Open the required calculation view in the view editor.

2. Select the Semantics node.

3. In the editor toolbar, choose (Expand Details Panel).

4. Choose the Columns tab.

5. In the Semantics pane menu bar, choose (Display Folder).

The Display Folder dialog box displays the list of measures and attributes in the calculation view and a folder structure.

6. Create a new display folder.

a. In the Display Folder dialog box, select the folder and choose (Display Folder).

You can create more than one display folder. If you want to create a folder within another display folder, select the
required folder and choose (Display Folder).

b. Double-click the folder to edit the folder name.

7. Group related measures

a. From the Measure section, drag and drop the required measures to the folder in which you want to group them.

8. Group related measures

a. From the Attributes section, drag and drop the required attributes to the folder in which you want to group them.

9. Choose OK.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 46/98
1/10/2020

Working With Calculation View Properties


While modeling calculation views, you can de ne certain properties for the calculation views so that the tool can refer to those
values and run the view respectively.

For example, you can de ne a property, which controls how the tool must access the data from the database or identify how to
execute the calculation view, and more. This section describes the commonly used calculation view properties, the possible values
for each property, and how these values help the tool determine the activation or execution behavior of the calculation view.

For de ning the view properties, select the Semantics node and de ne the properties in the View Properties tab.

Related Information
Filter Data for Speci c Clients
Invalidate Cached Content
Deprecate Calculation Views
Quick Reference: Calculation View Properties
Enable Calculation Views for Time Travel Queries

Filter Data for Speci c Clients


Obtain data from all clients or lter the calculation view data either with xed client value or with session client value set for the
user.

Context
In SAP Web IDE, for ltering data for speci c clients, explicitly specify the client lter 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 lter value for the selected data source.

Procedure
1. Open the calculation view in the view editor.

2. Edit view properties.

a. Select the Semantics node.

b. In the editor toolbar, choose (Expand Details Panel).

c. Choose the View Properties tab.

d. Choose General.

e. In the Default Client dropdown list, select a value.

Related Information
Default Client Values

Default Client Values


Assign a default client to a calculation view and lter data at runtime based on the default client value. The following table lists the
default client value types you can assign and their description.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 47/98
1/10/2020

Default Client Value Description

<blank> If you do not set any default client value, the tool does not lter 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 lters the table data
according to the value you specify as the session client in the user pro le.

Fixed Client If you want to use a xed client value, for example, 001, then the tool lters the table data for this client
value.

Enable Calculation Views for Time Travel


Queries
Time travel queries are queries against the historical states of the database. You can execute a time travel query on a calculation
view to query data for a speci ed time in past.

Context
If you have enabled time travel for calculation views, you can view data for a speci c time in the past using the AS OF SQL
extension. For example, you can execute the following SQL statement on calculation views as a timestamp query:

select * from <calculation_view> AS OF TIMESTAMP <timestamp>

SAP HANA supports creating history tables. These tables help associate time-related information to your data.

When you use history tables as data sources in calculation views, it is necessary to specify a parameter that you want to use to
provide the timestamp to the time-travel queries at runtime.

Procedure
1. Open the required calculation view in the view editor.

2. Edit view properties.

a. Select the Semantics node.

b. In the editor toolbar, choose (Expand Details Panel).

c. Choose the View Properties tab.

d. Choose General.

e. If you want to enable the history, select Enable History checkbox.

f. In the History Input Parameter dropdown list, choose an input parameter.

You use input parameters to specify the timestamp in time travel queries.

 Note
Use input parameters with data type DATE or SECONDDATE or TIMESTAMP or VARCHAR(8) of semantic type
DATE to specify the timestamp.

Invalidate Cached Content


https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 48/98
1/10/2020
In order to maintain the signi cance 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 speci c time intervals. Time-
based cache invalidation is necessary to refresh data after every speci c 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 modi ed.

 Note
Cache invalidation is applicable only to complex SQL queries that are executed on top of your calculation views.

Procedure
1. Open the calculation view in the editor.

2. Edit view properties.

a. Select the Semantics node.

b. In the editor toolbar, choose (Expand Details Panel).

c. Choose the View Properties tab.

d. Choose Advanced.

e. In the Cache Invalidation Period dropdown list, select a value.

Related Information
Enable Support for Cache Invalidation

Enable Support for Cache Invalidation


Enable cache invalidation for a calculation view to invalidate or remove data from the cache after speci c time intervals.

Context
You enable support for cache invalidation at the view level. This mean that, for every calculation view, it is necessary to enable
cache invalidation.

Procedure
1. Open the calculation view in the editor.

2. Edit view properties.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 49/98
1/10/2020
a. Select the Semantics node.

b. In the editor toolbar, choose (Expand Details Panel).

c. Choose the View Properties tab.

d. Choose Advanced.

e. Select the Cache checkbox.

Enabling or Disabling Result Set Caching


You can enable or disable the result set caching using the SAP HANA database explorer.

Use the following SQL queries to enable or disable caching in the system con guration.

Enabling result set caching

 Source Code

ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM')


SET ('cache', 'resultcache_enabled') = 'yes' WITH RECONFIGURE;

Disabling result set caching

 Source Code

ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'SYSTEM')


SET ('cache', 'resultcache_enabled') = 'no' WITH RECONFIGURE;

Deprecate Calculation Views


Deprecated calculation views signify that although a calculation view is supported for modeling activities within the tool, we
recommend not to use it in other calculation views or in analytic privileges.

Context
As a data modeler, because of various reasons, you can deprecate calculation views, which you do not recommend for use in other
calculation views or analytic privileges. This helps other users or data modelers using this calculation view know that the view is
deprecated or not recommended for use.

Procedure
1. Open the required calculation view in the view editor.

2. Edit view properties.

a. Select the Semantics node.

b. In the editor toolbar, choose (Expand Details Panel).

c. Choose the View Properties tab.

d. Choose General.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 50/98
1/10/2020
e. Select the Deprecate checkbox

Results
The tool displays a warning in the menu bar of the view editor for those calculation views or analytic privileges that are either
deprecated or modeled with deprecated calculation views.

Quick Reference: Calculation View Properties


While modeling a calculation view, you can de ne values for calculation view properties. These values determine the behavior of a
calculation view at runtime.

When you are modeling calculation views, you can de ne the following properties in the View Properties tab of the Semantics
node.

General Properties Description

Data Category The value of this property determines whether your calculation view supports analysis with multidimensional
reporting. For more information, see Supported Data Categories for Calculation Views.

Run With The value of this property helps the tool identify the authorization it has to use while selecting the data from
the database and for executing the calculation view or procedure. If the property is set to De ner’s Rights,
the tool uses the authorizations of the user who de nes the view or procedure. Similarly, if the property is set
to Invoker’s Rights, then the tool uses the authorizations of the current user to access data from the
database.

Default Client The value of this property determines whether the tool must lter the calculation view data based on a xed
client value, a session client value, or <blank> (does not lter data) at runtime. For more information, see
Filter Data for Speci c Clients

Apply Privileges The value of this property speci es the analytic privilege type selected for data access restrictions on the
calculation view. For more information, see De ning Data Access Privileges.

Default Member The value of this property helps the tool identify the default member for all hierarchies in the calculation view.

Count Star Column The value of this property is set to row.count in calculation views, which were created by migrating analytic
views having the row.count column. The row.count column was used internally to store the result of SELECT
COUNT(*) queries.

You can also select a column from the calculation view as Count Star Column. In this case, the column you
select is used to store the result of SELECT COUNT(<column_name>).

Deprecate The value of this property determines whether a user does not recommend using the calculation view in
other modeler objects. If the value is set to True, it indicates that although the calculation view is supported
for modeling activities, we recommend not to use. For more information, Deprecate Calculation Views.

Enable Hierarchies for SQL This view property is applicable only for calculation views with star join. The value of this property helps the
access tool identify whether you have enabled SQL access to shared hierarchies. For more information, see Query
Shared Hierarchies

Enable History The value of this property determines whether you can execute time travel queries on the selected
calculation view. If the property is set to True, you can execute time travel queries on the calculation view. For
more information, see Enable Calculation Views for Time Travel Queries.

History Input Parameter Input parameter that speci es the timestamp in time-travel queries.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 51/98
1/10/2020

General Properties Description

Partition by Local For data source (tables only) and union view nodes, you can set the Partition Local Execution ag. Select the
Execution data source and in the Properties section, you can set the Partition Local Execution ag and select the
required partition column..

When the ag is set to True, the engine executes the calculation view in parallel threads based on the
partition de ned for the tables. These parallel threads are combined in the union view node.

 Remember
The ag is applicable only for tables as data sources (or synonyms pointing to tables).

The table data source is part of the union view node either directly or through intermediate view
nodes.

The union view node has only one data source.

The ag does not work when used with unfolding behavior.

Advanced Properties Description

Propagate Instantiation to The value of this property helps the tool identify whether it has to propagate the instantiation handled by the
SQL Views calculation engine to the CDS or SQL views built on top of this calculation view. If the value is set to True, the
tool propagates the instantiation to the CDS or SQL views. This means that, attributes that a query (on a
SQL view built on top of this view) does not request are pruned and not considered at runtime.

For information on calculation engine instantiation process, see SAP Note 1764658 .

Cache The value of this property determines whether you have enabled support for cache invalidation. For more
information, see Enable Support for Cache Invalidation

Analyticview Compatibility The value of this property helps the join engine identify whether it has to ignore joins with N:M cardinality,
Mode when executing the join. For a star join in which no lters are de ned, and if the left table and the right table
of the join does not request for any eld, then the join engine prunes the N:M cardinality joins, when the
Analyticview compatibility mode property is set to true.

Pruning Con guration Table The value of this property determines the pruning con guration table that the tool must use to prune data in
union nodes. For more information, see Prune Data in Union Nodes.

Execute In The value of this property impacts the output data. It determines whether the tool must execute the
calculation view in SQL engine or column engine. For more information, see 1857202 .

Cache Invalidation Period The value of this property impacts the output data. It determines the time interval to invalidate or remove
the cached content. For more information, see Invalidate Cached Content.

Execution Hints For more information on execution hints, see 2142945

De ning Data Access Privileges


Use the analytic privilege editor in the SAP Web IDE to create analytic privileges.

You create analytic privileges to grant different users access to different portions of data in the same view based on their business
role. Within the de nition of an analytic privilege, the conditions that control which data users see is de ned using SQL.

Standard object privileges (SELECT, ALTER, DROP, and more) 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 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 ne-grained control at row level of which data individual users can see within the same view.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 52/98
1/10/2020

Example
Sales data for all regions is contained within one calculation 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.

Related Information
Create Static SQL Analytic Privileges
Create Dynamic SQL Analytic Privileges
Create Analytic Privileges Using SQL Expressions
Structure of SQL-Based Analytic Privileges

Create Static SQL Analytic Privileges


For creating static SQL analytic privileges, you use attribute columns from views to de ne xed restrictions on data access. These
restrictions are de ned in the analytic privilege editor at design time.

Prerequisites
1. If you want to use a SQL analytic privilege to apply data access restrictions on calculation views, set the Apply Privileges
property for the calculation view to SQL Analytic Privileges.

a. Open the calculation view in the view editor.

b. Select the Semantics node.

c. In the editor toolbar, choose (Expand Details Panel).

d. Choose the View Properties tab.

e. Choose General.

f. In the Apply Privileges dropdown list, select SQL Analytic Privileges.

2. If you want to use a SQL analytic privilege to apply data access restrictions on CDS views, you have de ned the referenced
CDS views using the WITH STRUCTURED PRIVILEGE CHECK clause.

Procedure
1. Start SAP Web IDE in a Web browser.

2. If you want to create a new project for the calculation view, do the following:

a. In SAP Web IDE, choose File New Project from Template .

b. Choose the project template type.

Currently, there is only one type of project template available, namely: Multi-Target Application Project. Select
Multi-Target Application Project and choose Next.

c. Type a name for the new MTA project (for example, myApp and choose Next to con rm).

d. Specify details of the new MTA project and choose Next to con rm.

e. Create the new MTA project; choose Finish.

3. Select the SAP HANA Database Module in which you want to create the analytic privilege.

4. Browse to the src folder.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 53/98
1/10/2020
5. In the context menu, choose New Analytic Privilege .

6. Enter the details for the new analytic privilege.

a. In the Name eld, enter the name of the analytic privilege.

7. Choose Create.

The tool opens the analytic privilege editor where you can de ne the analytic privilege.

8. Select models to de ne the scope of the analytic privilege.

If you want to create an analytic privilege and apply the data access restrictions for selected list of models, in the Secured
Models section add the required models,

a. Choose + (Add).

b. In the Find Data Sources dialog box, search and select the models for which you want to apply the analytic privilege
restrictions.

 Note
You can only add calculation views and CDS views to the secured models list.

c. Choose Finish.

9. De ne the validity.

In the Attribute pane, expand the PRIVILEGE VALIDITY section to specify the time period for which the analytic privilege is
valid. You can specify multiple time periods for which the analytic privilege is valid.

a. In the PRIVILEGE VALIDITY, choose + (Add).

b. In the Operator dropdown list, select the required operator.

c. Based on the selected operator, specify the time period (From and To) for which the analytic privilege is valid.

10. De ne the attribute restrictions.

The tool uses the restrictions de ned on the attributes to restrict data access. Each attribute restriction is associated with
only one attribute, but can contain multiple value lters. You can de ne more than one attribute restriction.

a. In the Associated Attribute Restrictions section, choose + (Add).

b. In the Attributes dropdown list, select the required attribute.

c. In the Restriction Type dropdown list, choose .

You can add more than one restriction for a single attribute.

d. Select the required operator to de ne the condition.

e. In the Value eld, specify the required value.

11. De ne attribute restrictions using hierarchy node column.

You can de ne hierarchy analytic privileges only if you have enabled SQL access to shared hierarchies.

For example, if you have enabled SQL access to shared hierarchies and if SalesRepHierarchyNode is the node column
that the tool generates for a parent-child hierarchy, then "SalesRepHierarchyNode" = "MAJESTIX" is a possible
lter expression in analytic privileges.

a. In the Hierarchy Privilege section, choose + (Add).

b. In the Hierarchy dropdown list, select a hierarchy.

c. In the Value eld, provide a node column value.

 Note
You can create hierarchical analytic privileges only for the following conditions:

All models in the Secured Models are star join calculation views with shared dimensions.

You have enabled SQL access to the shared hierarchies in star join calculation views.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 54/98
1/10/2020
12. Build an SAP HANA Database Module.

The build process uses the design-time database artifacts to generate the corresponding actual objects in the database
catalog.

a. From the module context menu, choose Build.

13. Assign privileges to a user.

Related Information
Structure of SQL-Based Analytic Privileges

Create Dynamic SQL Analytic Privileges


Dynamic SQL analytic privileges determine the lter condition string to restrict data access at runtime. You use the analytic
privilege editor to de ne the dynamic SQL analytic privilege.

Prerequisites
1. If you want to use a SQL analytic privilege to apply data access restrictions on calculation views, set the Apply Privileges
property for the calculation view to SQL Analytic Privileges.

a. Open the calculation view in the view editor.

b. Select the Semantics node.

c. In the editor toolbar, choose (Expand Details Panel).

d. Choose the View Properties tab.

e. Choose General.

f. In the Apply Privileges dropdown list, select SQL Analytic Privileges.

2. If you want to use a SQL analytic privilege to apply data access restrictions on CDS views, you have de ned the referenced
CDS views using the WITH STRUCTURED PRIVILEGE CHECK clause.

Procedure
1. Start SAP Web IDE in a Web browser.

2. If you want to create a new project for the calculation view, do the following:

a. In the SAP Web IDE, choose File New Project from Template .

b. Choose the project template type.

Currently, there is only one type of project template available, namely: Multi-Target Application Project. Select
Multi-Target Application Project and choose Next.

c. Type a name for the new MTA project (for example, myApp and choose Next to con rm).

d. Specify details of the new MTA project and choose Next to con rm.

e. Create the new MTA project; choose Finish.

3. Select the SAP HANA Database Module in which you want to create the analytic privilege.

4. Browse to the src folder.

5. In the context menu, choose New Analytic Privilege .

6. Enter the details for the new analytic privilege.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 55/98
1/10/2020
a. In the Name eld, enter the name of the analytic privilege.

7. Choose Create.

The tool opens the analytic privilege editor where you can de ne the analytic privilege. By default, it opens the editor to
de ne static SQL analytic privileges.

8. Switch analytic privilege editor view.

a. In the analytic privilege editor, choose (Privilege Types).

b. Choose the Dynamic menu option.

c. In the Procedure value help list, search for the required procedure.

The procedure helps de ne the lter conditions in the dynamic SQL analytic privilege.

d. Choose Finish.

9. Build an SAP HANA Database Module.

The build process uses the design-time database artifacts to generate the corresponding actual objects in the database
catalog.

a. From the module context menu, choose Build.

10. Assign privileges to a user.

Related Information
Structure of SQL-Based Analytic Privileges

Create Analytic Privileges Using SQL


Expressions
The analytic privilege editor provides you the exibility to create SQL based analytic privileges using the familiar SQL environment.
You can create both static and dynamic SQL analytic privileges by writing relevant SQL expressions.

Prerequisites
1. If you want to use a SQL analytic privilege to apply data access restrictions on calculation views, set the Apply Privileges
property for the calculation view to SQL Analytic Privileges.

a. Open the calculation view in the view editor.

b. Select the Semantics node.

c. In the editor toolbar, choose (Expand Details Panel).

d. Choose the View Properties tab.

e. Choose General.

f. In the Apply Privileges dropdown list, select SQL Analytic Privileges.

2. If you want to use a SQL analytic privilege to apply data access restrictions on CDS views, you have de ned the referenced
CDS views using the WITH STRUCTURED PRIVILEGE CHECK clause.

Procedure
1. Start SAP Web IDE in a Web browser.

2. If you want to create a new project for the calculation view, do the following:
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 56/98
1/10/2020
a. In the SAP Web IDE, choose File New Project from Template .

b. Choose the project template type.

Currently, there is only one type of project template available, namely: Multi-Target Application Project. Select
Multi-Target Application Project and choose Next.

c. Type a name for the new MTA project (for example, myApp and choose Next to con rm).

d. Specify details of the new MTA project and choose Next to con rm.

e. Create the new MTA project; choose Finish.

3. Select the SAP HANA Database Module in which you want to create the analytic privilege.

4. Browse to the src folder.

5. In the context menu, choose New Analytic Privilege .

6. Enter the details for the new analytic privilege.

a. In the Name eld, enter the name of the analytic privilege.

7. Choose Create.

The tool opens the analytic privilege editor where you can de ne the analytic privilege. By default, it opens the editor to
de ne static SQL analytic privileges.

8. Switch analytic privilege editor view.

a. In the analytic privilege editor, choose (Privilege Types).

b. Choose the SQL Expression menu option.

c. For creating static SQL analytic privilege, in the SQL editor de ne the attribute restrictions and its validity.

For example:

 Sample Code
(("REGION" = 'EAST') OR ("REGION" = 'NORTH')) AND (("CUSTOMER_ID" =
'SAP')) AND ((CURRENT_DATE BETWEEN 2015-05-15 00:00:00.000 AND 2015-05-15
23:59:59.999))

 Note
If you have enabled SQL access for calculation views (of type dimensions used in a star join calculation view), the
tool generates a node column. You can maintain a lter expression using this node column when creating
analytic privileges. For example, if SalesRepHierarchyNode is the node column that the tool generates for a
parent-child hierarchy, then "SalesRepHierarchyNode" = "MAJESTIX" is a possible lter expression.

d. For creating dynamic SQL analytic privilege, in the SQL editor specify the procedure within the CONDITION
PROVIDER clause.

For example:

 Sample Code
CONDITION PROVIDER schema_name.procedure_name

9. Build an SAP HANA Database Module.

The build process uses the design-time database artifacts to generate the corresponding actual objects in the database
catalog.

a. From the module context menu, choose Build.

10. Assign privileges to a user.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 57/98
1/10/2020

Structure of SQL-Based Analytic Privileges


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 veri ed. In an SQL-based analytic privilege, these restrictions are speci ed as lter conditions that
are fully SQL based.

SQL-based analytic privileges are created using the CREATE STRUCTURED PRIVILEGE statement:

CREATE STRUCTURED PRIVILEGE <privilege_name> FOR <action> ON <view_name> <filter_condition>;

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

The < lter condition> parameter is used to restrict the data visible to individual users. The following methods of specifying lter
conditions are possible:

Fixed lter (WHERE) clause

Dynamically generated lter (CONDITION PROVIDER) clause

Fixed Filter Clauses


A xed lter clause consists of an WHERE clause that is speci ed in the de nition of the analytic privilege itself.

You can express xed lter conditions freely using SQL, including subqueries.

By incorporating built-in SQL functions into the subqueries, in particular SESSION_USER, you can de ne an even more exible
lter 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 lter condition if the view
is de ned on top of analytic and/or attributes views that themselves are secured with an SQL-based analytic privilege with a
complex lter 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).

 Tip
To create an analytic privilege that allows either access to all data or no data in a view, set a xed lter condition such as 1=1 or
1!=1.

Dynamically Generated Filter Clauses


With a dynamically generated lter clause, the WHERE clause that speci es the lter condition is generated every time the
analytic privilege is evaluated. This is useful in an environment in which the lter clause changes very dynamically. The lter
condition is determined by a procedure speci ed in the CONDITION PROVIDER clause, for example:

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 58/98
1/10/2020

 Sample Code
CREATE STRUCTURED PRIVILEGE dynamic_ap FOR SELECT ON schema1.v1 CONDITION PROVIDER schema2.procedur

Procedures in the CONDITION PROVIDER clause must have the following properties:

They must have the security mode DEFINER.

They must be read-only procedures.

They must have a prede ned signature. Here, the following conditions apply:

No input parameter

Only one output parameter for the lter condition string of string type NVARCHAR, VARCHAR, CLOB, or NCLOB

While VARCHAR and NVARCHAR have length limitations of 5000 characters, CLOB and NCLOB can be used to
accommodate longer lter strings.

The procedure may only return conditions expressed with the following operators:

=, <=, <, >, >=

LIKE

BETWEEN

IN

NOT (...)

!=

A complex lter condition, that is a subquery, may not be returned.

 Tip
A procedure that returns the lter 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.

Related Information

Examples: Securing Views Using SQL-Based


Analytic Privileges
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 xed lter clause

Example 2: Securing an SQL view using an SQL-based analytic privilege with a complex lter clause (subquery)

Example 3: Securing a column view using an SQL-based analytic privilege with a dynamically generated lter clause

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 59/98
1/10/2020

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

Example 1: Secure a Column View Using an SQL-Based Analytic


Privilege with a Fixed Filter Clause

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 xed lter clause.

A xed lter clause consists of an SQL WHERE clause that is speci ed in the de nition of the analytic privilege itself.

Procedure
1. Create the view containing the sales data:

CREATE COLUMN VIEW "TABLEOWNER"."VIEW_SALES" TYPE CALCULATION WITH PARAMETERS ('PARENTCALCINDEXS


'PARENTCALCINDEX'='CALCSCEN_SALES',
'PARENTCALCNODE'='SALES_TABLE',
'REGISTERVIEWFORAPCHECK'='0') STRUCTURED PRIVILEGE CHECK
;

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

2. Create the analytic privilege:

CREATE STRUCTURED PRIVILEGE AP_SALES_1 FOR SELECT


ON TABLEOWNER.VIEW_SALES
WHERE REGION IN ('DE','UK')
OR PRODUCT = 'CAR'
;

 Remember
When specifying lters, remember the following:

You can specify only the SELECT action in the FOR clause.

You can specify one or more views with the same lter attributes in the ON clause

You can specify comparative conditions between attributes and constant values using only the following
operators:

=, <=, <, >, >=

LIKE

BETWEEN

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 60/98
1/10/2020
IN

You can create complex lter 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 lter condition if the view is de ned on top of analytic and/or
attributes views that themselves are secured with an SQL-based analytic privilege with a complex lter
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:

GRANT SELECT on TABLEOWNER.VIEW_SALES to <SALES_MANAGERS>;

 Remember
Only the view owner or a user who has the SELECT privilege WITH GRANT OPTION on the view can perform the grant.

4. Grant the analytic privilege to the relevant users/roles:

GRANT STRUCTURED PRIVILEGE AP_SALES_1 TO <SALES_MANAGERS>;

 Remember
Only the owner of the analytic privilege can grant it.

Example 2: Secure an SQL View Using an SQL-Based Analytic


Privilege with a Complex Filter Clause (Subquery)

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

With a complex lter clause, the SQL WHERE clause that speci es the lter condition includes an SQL statement, or a subquery.
This allows you to create complex lter conditions to control which data individual users see.

Procedure
1. Create the view containing the sales data which needs to be secured:

CREATE VIEW "VIEWOWNER"."ROW_VIEW_SALES_ON_SALES" AS SELECT


* FROM "TABLEOWNER"."SALES" WITH STRUCTURED PRIVILEGE CHECK
;

 Remember
The user creating the view must have the SELECT privilege WITH GRANT OPTION on the table TABLEOWNER.SALES.

2. Create the table containing user-speci c authorization data:

CREATE COLUMN TABLE "VIEWOWNER"."AUTHORIZATION_VALUES"("VALUE" VARCHAR(256),


"USER_NAME" VARCHAR(20));

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 61/98
1/10/2020
3. Insert authorization information for user MILLER:

INSERT INTO "VIEWOWNER"."AUTHORIZATION_VALUES" VALUES('2008', 'MILLER);

4. Create the analytic privilege using a subquery as the condition provider:

CREATE STRUCTURED PRIVILEGE AP_ROW_VIEW_SALES_ON_SALES FOR SELECT


ON "VIEWOWNER"."ROW_VIEW_SALES_ON_SALES"
WHERE (CURRENT_DATE BETWEEN 2015-01-01 AND 2015-01-11) AND YEAR IN (SELECT VALUE FROM VIEWOWNER.
;

 Remember
Subqueries allow you to create complex lter conditions, but remember: A calculation view cannot be secured
using an SQL-based analytic privilege that contains a complex lter condition if the view is de ned on top of
analytic and/or attributes views that themselves are secured with an SQL-based analytic privilege with a
complex lter 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 lter 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.

5. Grant the SELECT privilege on the view VIEWOWNER.ROW_VIEW_SALES_ON_SALES to user MILLER.

GRANT SELECT ON "VIEWOWNER"."ROW_VIEW_SALES_ON_SALES" TO MILLER;

 Remember
Only the view owner or a user who has the SELECT privilege WITH GRANT OPTION on the view can perform the grant.

6. Grant the analytic privilege to user MILLER.

GRANT STRUCTURED PRIVILEGE AP_ROW_SALES_ON_SALES TO MILLER;

 Remember
Only the owner of the analytic privilege can grant it.

Example 3: Secure a Column View Using an SQL-Based Analytic


Privilege with a Dynamically Generated Filter Clause

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 lter clause.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 62/98
1/10/2020
With a dynamically generated lter clause, the SQL WHERE clause that speci es the lter condition is generated every time the
analytic privilege is evaluated. This is useful in an environment in which the lter clause changes very dynamically.

Procedure
1. Create the view containing the sales data:

CREATE COLUMN VIEW "TABLEOWNER"."VIEW_SALES" TYPE CALCULATION WITH PARAMETERS ('PARENTCALCINDEXS


'PARENTCALCINDEX'='CALCSCEN_SALES',
'PARENTCALCNODE'='SALES_TABLE',
'REGISTERVIEWFORAPCHECK'='0') STRUCTURED PRIVILEGE CHECK
;

2. Create a table containing user-speci c lter strings:

CREATE COLUMN TABLE "AUTHORIZATION"."AUTHORIZATION_FILTERS"("FILTER" VARCHAR(256),


"USER_NAME" VARCHAR(20))
;

3. Create an authorization lter for user ADAMS:

INSERT
INTO "AUTHORIZATION"."AUTHORIZATION_FILTERS" VALUES('(CUSTOMER=''Company A'' AND PRODUCT=''Car''
'ADAMS')
;

 Remember
Filters containing comparative conditions must be de ned as speci ed in example 1.

4. Create the database procedure that provides the lter clause for the analytic privilege and grant it to user _SYS_REPO:

CREATE PROCEDURE "PROCOWNER"."GET_FILTER_FOR_USER"(OUT OUT_FILTER VARCHAR(5000))


LANGUAGE SQLSCRIPT SQL SECURITY DEFINER READS SQL DATA AS
v_Filter VARCHAR(5000);
CURSOR v_Cursor FOR SELECT "FILTER" FROM "PROCOWNER"."AUTHORIZATION_FILTERS" WHERE "USER
BEGIN
OPEN v_Cursor;
FETCH v_Cursor INTO v_Filter;
OUT_FILTER := v_Filter;
CLOSE v_Cursor;
END;
GRANT EXECUTE ON "PROCOWNER"."GET_FILTER_FOR_USER" TO _SYS_REPO;

 Remember
When using procedures as the condition provider in an SQL-based analytic privilege, remember the following:

Procedures must have the following properties:

They must have the security mode DEFINER.

They must be read-only procedures.

A procedure with a prede ned signature must be used. The following conditions apply:

No input parameter

Only one output parameter for the lter condition string of string type NVARCHAR, VARCHAR,
CLOB, or NCLOB

While VARCHAR and NVARCHAR have length limitations of 5000 characters, CLOB and NCLOB
can be used to accommodate longer lter strings.

The procedure may not return a complex lter condition, that is a subquery.

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.
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 63/98
1/10/2020
The session user is the database user who is executing the query to access a secured view. This is therefore the
user whose privileges must be checked. For this reason, the table or view used in the procedure should contain a
column to store the user name so that the procedure can lter on this column using the SQL function
SESSION_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.

5. Create the analytic privilege using the procedure as condition provider:

CREATE STRUCTURED PRIVILEGE AP_SALES_2 FOR SELECT ON "TABLEOWNER"."VIEW_SALES" CONDITION PROVIDE

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:

GRANT SELECT on TABLEOWNER.VIEW_SALES to ADAMS;

 Remember
Only the view owner or a user who has the SELECT privilege WITH GRANT OPTION on the view can perform the grant.

7. Grant the analytic privilege to user ADAMS:

GRANT STRUCTURED PRIVILEGE AP_SALES_2 TO ADAMS;

 Remember
Only the owner of the analytic privilege can grant it.

Additional Functionality for Calculation Views


After modeling calculation views or during design time itself you can perform certain additional functions to understand the
performance of the view at runtime and to efficiently model calculation views.

This section describes the different additional functions that the tool offers and how you can use these functions to efficiently
model views.

Related Information
Trace Objects with Data Lineage
Trace Dependent Objects to Analyze Impacts
Open Calculation Views in Performance Analysis Mode
Maintain Comments for Calculation View Objects
Replacing Nodes and Data Sources
Using Functions in Expressions
Manage Calculation Views with Missing Objects
Generate Calculation View Documentation
Additional Functionality for Calculation Views

Add an External Service in the mta.yaml File


You can access data sources from external services only if you have created the necessary user-provided service (for non HDI) and
con gured it in the mta.yaml le. Similarly, you can access data sources from HDI containers, only if you have con gured the

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 64/98
1/10/2020
required HDI service in the mta.yaml le

Context
The tool enables you to use a form-based UI to create a user-provided service or to con gure an existing user-provided service in
the mta.yaml le. For objects in HDI containers, use the tool to con gure the required HDI service in the mta.yaml le.

Procedure
1. Start SAP Web IDE in a Web browser.

2. In the Workspace view, right-click the SAP HANA Database Module in which you want to con gure the mta.yaml le.

3. Choose New SAP HANA Service Connection .

4. Con guring the mta.yaml for non HDI containers.

a. In the Add External SAP HANA Service dialog box, select Non HDI Container.

b. If you want to use an existing user-provided service, select Existing User Provided Service and enter the name of
the user-provided service.

c. If you want to create a new user-provided service, in the User Provided Service Name text eld, enter a name.

d. Provide details of the SAP HANA database that the selected user-provided service refers.

e. Choose Finish.

The tool automatically creates the user-provided service and con gures the mta.yaml le.

5. Con guring the mta.yaml le for HDI containers.

a. In the Add External SAP HANA Service dialog box, select HDI Container.

The tool displays the list of all HDI services.

b. Select the required HDI service that you want to con gure in the mta.yaml le.

c. Choose Finish.

Trace Objects with Data Lineage


The graphical calculation view editor in SAP Web IDE supports data lineage to graphically visualize the source of objects used for
modeling a calculation view.

Context
Use data lineage to graphically visualize the ow of an object within a calculation view. With data lineage, you can identify from
where the calculation view gets its data from. For example, for a selected calculation view, you can graphically visualize the source
for its attributes, measures, underlying data sources (tables and views) and more. Data lineage is useful, especially to analyze
impacts, to trace errors, and to debug errors.

The tool supports two types of data lineage. In the rst scenario, you can view the ow of an object from its source and up to the
semantics node within the calculation view. In the second scenario, you can view the source of all data sources (tables and views)
used for modeling a calculation view.

Procedure
1. Trace columns in a calculation view.

a. Start SAP Web IDE in a Web browser.

b. In the Workspace view, select the required calculation view.


https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 65/98
1/10/2020
c. In the context menu, choose Open With Calculation View Editor .

d. Select the Semantics node.

e. In the editor toolbar, choose (Expand Details Panel).

f. Choose the Columns tab.

g. Select a column you want to trace.

h. Choose (Show Lineage).

In the same view editor, the tool highlights the selected column, its source object, and the ow of the selected column from
its source to the Semantics node.

 Note
For calculated columns, the tool displays the source of all columns used in the valid calculated column expression, and
for restricted columns, the tool displays the source of the base measure used in de ning the restricted column.

2. Trace source of all data sources within the calculation view.

a. Start SAP Web IDE in a Web browser.

b. In the Workspace view, select the required calculation views.

c. In the context menu, choose Modeling Actions Data Lineage .

In a new tab, the tool opens a new editor. You use this editor to trace the source of all data sources used for
modeling the selected calculation view. Use the collapse and expand buttons for each such data source to view its
next level details.

Trace Dependent Objects to Analyze Impacts


Modifying a calculation view can impact other calculation views that are modeled on top of the view. It is necessary to identify all
such dependent objects before changing the view, which otherwise may lead to run time errors.

Context
You perform impact analysis at the view level. The tool helps to identify all dependent objects of a target calculation view, one level
at a time. This means that, for each of the dependent object, you can further drilldown and identify the next level of dependent
objects and until the leaf object.

Procedure
1. Start SAP Web IDE in a Web browser.

2. In the Workspace view, select the required calculation view.

3. In the context menu, choose Modeling Actions Impact Analysis .

In a new tab, the tool opens an editor for impact analysis. You use this editor to identify all dependent objects of the target
calculation view. Use the collapse or expand button for each data source to view its next level of dependent object.

4. In the new editor, expand the Properties section (at the bottom of the editor) to view additional details such as the object
type, object name, and more, for a selected object.

Performance Analysis
The SAP Web IDE supports opening a calculation view in performance analysis mode. The objective of the performance analysis
mode is to provide such information to users that helps them understand the performance of the calculation view when it is
executed.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 66/98
1/10/2020
When you open a calculation view in performance analysis mode, you obtain information on the catalog tables modeled in the
view. For example, information on table partitions, number of rows in the tables, and more.

The information that the tool displays in performance analysis mode depends on the view node that you select and the data
sources within this view node. In addition, opening a calculation view in performance analysis mode also helps to:

Identify number of rows in a table

Identify those data sources that have number of rows above a certain threshold value. If you want to con gure the threshold value,

1. In the left sidebar, choose (Preferences).

2. Choose Modeler.

3. In the Threshold Value text eld, provide the required threshold value.

4. Choose Save.

 Note
If the tables have rows more than the threshold value, the tool displays a warning icon across tables in the view editor.

Identify Table Partitions and Table Types

If you have modeled a calculation view with partitioned tables, identify the partitioned tables and its partition type (Hash, Range,
Round Robin).

Related Information
Open Calculation Views in Performance Analysis Mode
Debug Calculation Views

Open Calculation Views in Performance


Analysis Mode
When you open a calculation view in performance analysis mode, you obtain information on joins, join tables, table partitions,
table types, and other such information that to better understand the performance of calculation views when it is executed.

Context
For example, the number of rows in a data source and table partitions impact the performance of your queries. The performance
analysis mode provides information on such details at design time. Based on this information you can model more efficient
calculation views and improve its performance when it is executed.

Procedure
1. Start SAP Web IDE in a Web browser.

2. Open the required calculation view in the view editor.

3. Select a view node that contains catalog tables.

 Note
You cannot analyze the performance of the Semantics node.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 67/98
1/10/2020
4. In the scenario pane toolbar, choose the (Performance analysis) icon to switch to the performance analysis mode.

For the selected view node, the tool displays the following information in the Performance Analysis tab.

Join Details (if the selected view node is a join node.)

Data Source Details

 Note
When you are in performance analysis mode, you can switch to normal mode by choosing the same icon in the toolbar.
If you want to always open a calculation view in performance analysis mode as a default, it is necessary to con gure the
preferences.

a. In the menu bar, choose (Preferences).

b. Choose Modeler.

c. Select Always open Calculation Views in performance analysis mode.

d. Choose Save.

Related Information
Performance Analysis
Join Details
Data Source Details

Join Details
Open a calculation view in performance analysis mode and select a join view node that has catalog tables as data sources.

If you have de ned a join for the catalog tables, then the JOIN DETAILS section in Performance Analysis tab provides the
following information:

Catalog tables participating in the join. The tables include the left table and right table.

The cardinality and join type that you have selected for each join.

Information on whether you have maintained the referential integrity for the join table.

If the cardinality that the tool proposes is different from the cardinality that you select or if you have not maintained
referential integrity, tool displays a warning.

 Note
Only users with SELECT privileges on the catalog tables participating in the join can view join validation status.

 Restriction
The tool does not support performance analysis and debug queries for join view nodes with multi join de nitions.

Data Source Details


Open a calculation view in performance analysis mode and select a view node that has catalog tables as data sources.

For a selected view node, the DATA SOURCE DETAILS section in Performance Analysis tab provides the following information:

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 68/98
1/10/2020
The catalog tables available in a selected view node.

The catalog table type.

If catalog table is partitioned, then tool provides details on the partition type (Hash, Range, Round Robin).

Number of rows in the catalog table. Also, tool displays a warning icon for catalog tables with number of rows more than
the threshold value that you have de ned.

If you are using scale-out architecture with multiple nodes connected to an SAP HANA system, the tool provides
information on the table group name, and the table group type and its subtype.

 Note
Only users with system privilege INIFILE ADMIN can identify whether a system is using a scale-out architecture.

Debug Calculation Views


For debugging calculation views, the graphical modeling tool in SAP Web IDE provides a debugger editor. Open the calculation view
in the debugger editor (in debug mode) by executing a debug query that the tool proposes or by executing your own debug query.

Context
The debugging operation helps analyze the runtime behavior of a calculation view. Based on the analysis, you can make necessary
changes to the view at design time and improve its performance when it is executed. The tool supports several debugging
operations within the debugger editor. For example, write a SQL query for debugging a calculation view and identify those
attributes or data sources in the calculation view that the engine consumes for executing the query, and also those objects that
the engine does not consume.

Procedure
1. Open the required calculation view in the view editor.

2. In the view editor toolbar, choose (Debug this view).

3. Select the Semantics node.

4. Select the Debug Query tab.

The SQL editor in the Debug Query tab by default proposes a query. You can use this query to debug the calculation view or
use your own query in the SQL editor to debug the calculation view. At any point in time, you can reset to the default query.
Choose (Reset Query) to reset the query.

 Note
The tool proposes a query in the SQL editor after analyzing the existing version of your calculation view. If you have
changed the existing version, then ensure to build the calculation view before debugging.

5. Start debugging.

Once you have identi ed the query to debug the calculation view, begin the debugging process.

a. In the SQL editor menu bar, choose (Execute) to start the debugging process.

Results
This operation opens the calculation view in the debugger editor in read-only mode. Use the debugger editor to analyze the
performance of your calculation view at runtime.

 Note
https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 69/98
1/10/2020
You can modify the calculation view only in the standard calculation view editor outside of the debug session.

Related Information
Using the Debugger Editor
Prede ned Validation Rules

Using the Debugger Editor


The debugger editor opens the calculation view in debug mode and helps in analyzing the runtime performance of calculation
views.

The data in the debugger editor largely depends on the query you execute to debug the calculation view. The debugger editor
provides the following information when you debug a selected calculation view.

Helps identify pruned and unpruned data sources in calculation views.

The debugger editor provides information on all pruned and unpruned data sources and columns. Pruned data sources refer to
those underlying calculation views that the engine does not require for executing the debug query on the selected calculation view.
Pruned data sources are greyed out in the debugger editor.

Similarly, pruned columns are those columns in a view node that the engine does not require or consume to execute the debug
query. Select the required view node and choose the Columns tab. The pruned columns are greyed out.

Allows drilldown on underlying data sources for detailed analysis

You can drilldown any underlying data source (calculation view) and analyze its performance. For performing the drilldown
operation, in the debugger editor, select an underlying data source (calculation view) and choose . This operation opens the
selected underlying data source in a new debugger editor. You can perform similar debugging operations on the underlying data
source.

Provides simple intermediate data preview

Select a view node in the debugger editor and choose the Debug Query tab. By default, the SQL editor in the Debug Query tab
displays the subquery relevant to the selected view node. Choose (Reset Query) to preview the output of the selected view
node.

Displays results of executing the performance validation rules on the calculation view.

The graphical modeling tool in SAP Web IDE contains prede ned validation rules with the objective of validating the performance
of a calculation view. When you execute a debug query and open the calculation view in the debugger editor, the tool also
automatically executes these prede ned validation rules. The tool displays the results of the execution at the bottom of the
debugger editor. Hover over the Warning icon for more details. If you want the Warning icon to appear, then the execution must
encounter any prede ned violations.

Prede ned Validation Rules


Executing the prede ned validation rules helps identify speci c design time factors that impact the performance of calculation
views.

The tool automatically executes the prede ned validation rules when you execute the debug query. For example, calculated
columns or aggregated columns in lter expressions impact the performance of calculation views. When you execute the

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 70/98
1/10/2020
validation rule, Calculation in lter expression, you can identify whether you have modeled the calculation view with calculated
columns or aggregated columns in lter expressions. You can change your calculation views at design time respectively.

Prede ned Validation Rule Objective

Calculation in lter expression rule Helps identify whether you have modeled the calculation view with calculated columns
or aggregated columns in lter expressions.

Calculation in joins rule Helps identify whether you have modeled the calculation view with calculated columns
or aggregated columns in join conditions.

Partition types in join rule Helps identify whether the tables participating the join are partition tables and if the 1st
level partition type of these two tables is different.

Maintain Comments for Calculation View


Objects
When you are modeling a calculation view, you can also maintain comments for the view or for its objects such as parameters,
calculated columns, view nodes, and more. 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 help you 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.

Columns in the semantics node

View nodes

Input parameters and variables

Hierarchies

Calculated columns and restricted columns in underlying view nodes

 Note
The tool does not support translating comments maintained for the calculation view or its objects.

Procedure
1. Start SAP Web IDE in a Web browser.

2. Open the required calculation view for which you want to maintain comments.

3. Maintain comments for the calculation view at the view level.

a. Select the Semantics node.

b. In the editor toolbar, choose (Expand Details Panel).

c. Choose the View Properties tab.

d. Choose General.

e. In the Notes text eld, enter a new comment or edit any existing comment.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 71/98
1/10/2020
4. Maintain comments for columns in the semantics node.

a. Select the Semantics node.

b. Choose the Columns tab.

c. Select the column for which you want to maintain comments.

d. In the Notes column property, choose (Add Comment).

 Note
Con gure default column properties.
If you do not see Notes column property, choose the (Customize Column Display) icon in the menu bar and
ensure that you have selected the Notes column property. Use the horizontal scroll bar to view all the available
column properties.

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

b. Choose (Add Comment).

c. Enter a new comment or edit an existing comment.

6. Maintain comments for input parameters or variables.

a. Select the Semantics node.

b. Choose the Parameters tab.

c. Select an input parameter or variable for which you want to maintain comments.

d. In the Notes text eld, enter a new comment or edit any existing comment.

7. Maintain comments for calculated columns or restricted columns.

a. Select the default view node.

b. Choose the Calculated Columns tab or Restricted Columns tab.

c. Select a calculated column or a restricted column for which you want to maintain comments.

d. In the Notes text eld, enter a new comment or edit any existing comment.

8. Maintain comments for hierarchies.

a. Select the default view node.

b. Choose the Hierarchies tab.

c. Select the required hierarchy for which you want to maintain comments.

d. In the Notes text eld, enter a new comment or edit any existing comment.

Replacing Nodes and Data Sources


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.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 72/98
1/10/2020

Related Information
Replace a View Node in Calculation Views
Replace a Data Source in Calculation Views

Replace a View Node in Calculation Views


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.

Procedure
1. Open required calculation view in the view editor.

2. Select a node that you want to replace.

3. In the context menu, choose Replace With Node.

4. In the Select New Node dialog box, select a view node that you want use for replacing.

5. Manage the source and target mappings respectively.

 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 Calculation Views


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.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 73/98
1/10/2020

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.

Procedure
1. Open required calculation view in the view editor.

2. Select a data source you want to replace.

3. In the context menu of the data source, choose Replace With Data Source.

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

Using Functions in Expressions


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
String Functions
Conversion Functions
Mathematical Functions

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 74/98
1/10/2020
Date Functions
Miscellaneous Functions
Using Functions in Expressions
Spatial Functions
Spatial Predicates

Using Column Engine Functions


String Functions
String functions are scalar functions that perform an operation on a string input value and return a string or numeric value.

Function Syntax Purpose

strlen int strlen(string) Returns the length of a string in bytes, as an integer number.

midstr string Returns a part of the string starting at arg2, arg3 bytes long.
midstr(string,
arg2 is counted from 1 (not 0).
int, int)

midstru string Returns a part of the string starting at character or surrugate arg2, arg3 characters, or surrogates long.
midstru(string,
int)

string
midstru(string,
int, int)

leftstr string Returns arg2 bytes from the left of the arg1. If arg1 is shorter than the value of arg2, the complete string is
leftstr(string, returned.
int)

rightstr string Returns arg2 bytes from the right of the arg1. If arg1 is shorter than the value of arg2, the complete string is
rightstr(string, returned.
int)

leftstru string return arg2 characters from the left of the string. If arg1 is shorter than arg2 characters, the complete string
leftstru(string, is returned.
int)

rightsru string return arg2 characters from the right of the string. If arg1 is shorter than arg2 characters, the complete
rightstru(string, string is returned.
int)

instr int instr(string, Returns the position of the rst occurrence of the second string within the rst string (>
string) = 1) or 0, if the second string is not contained in the rst.

instru int instru(string, return the character position of the rst occurrence of the second string within the rst string (>= 1) or 0, if
string) the second string is not contained in the rst. This assumes inputs to be unicode expressed in utf-8, if the
input is not encoded this way, the result is less meaningful.

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

rawtohex string convert a string of bytes to its hexadecimal representation.


rawtohex(string)
The output contains only 0-9 and (upper case) A-F, no spaces and is twice as many bytes as the original
string.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 75/98
1/10/2020

Function Syntax Purpose

ltrim string removes a whitespace pre x from a string. The Whitespace characters may be speci ed in an optional
ltrim(string) argument. This function operates on raw bytes of the UTF8-string and has no knowledge of multi byte codes
(you may not specify multi byte whitespace characters).
string
ltrim(string,
string)

rtrim string removes trailing whitespace from a string. The Whitespace characters may be speci ed in an optional
rtrim(string) argument. This function operates on raw bytes of the UTF8-string and has no knowledge of multi byte codes
(you may not specify multi byte whitespace characters).
string
rtrim(string,
string)

trim string removes whitespace from the beginning and end of a string. These should be equivalent:
trim(string) - trim(s) = ltrim(rtrim(s))

string - trim(s1, s2) = ltrim(rtrim(s1, s2), s2)


trim(string,
string)

lpad string add whitespace to the left of a string. A second string argument speci es the whitespace, which is added
lpad(string, int) repeatedly until the string has reached the intended length. If no second string argument is speci ed,
chr(32) (' ') gets added. This function operated on UTF-8 bytes and has no knowledge of unicode characters
string
(neither for the whitespace string nor for length computation).
lpad(string, int,
string)

rpad string add whitespace to the end of a string. A second string argument speci es the whitespace, which is added
rpad(string, int) repeatedly until the string has reached the intended length. If no second string argument is speci ed,
chr(32) (' ') gets added. This function operated on UTF-8 bytes and has no knowledge of unicode characters
string
(neither for the whitespace string nor for length computation).
rpad(string, int,
string)

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

upper string return an all upper case version of the string. Unlike most other string functions, this also attempts to
upper(string) convert unicode characters in CESU encoding beside the usual a-z.

lower string return an all lower case version of the string. Unlike most other string functions, this also attempts to
lower(string) convert unicode characters in CESU encoding beside the usual A-Z.

chars chars(string) return the number of characters in a string. This returns the number of characters in an UTF-8 encoded
string. In a CESU-8 encoded string, it returns the number of 16-bit words of that string if it were encoded if
UTF-16.

charpos charpos(string, return the position of the nth character in a string (n starting with 1). The string is interpreted as UTF-8 as it
int) is in the preceding chars() function.

Conversion Functions
Data type conversion functions are used to convert arguments from one data type to another, or to test whether a conversion is
possible.

Function Syntax Purpose Example

int int int(arg) convert arg to int type int(2)

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 76/98
1/10/2020

Function Syntax Purpose Example

oat oat oat(arg) convert arg to oat type oat(3.0)

double double double convert arg to double type double(3)


(arg)

sd oat sd oat sd oat convert arg to sd oat type


(arg)

dec oat dec oat dec oat convert arg to dec oat type
(arg)

xed xed xed (arg, int, arg2 and arg3 are the intDigits and fractdigits xed(3.2, 8, 2) + xed(2.3, 8, 3)
int) parameters, respectively. Convert arg to a xed type of
either 8, 12, or 16 byte length, depending on intDigits
and fractDigits

string string string (arg) convert arg to string type

raw raw raw (arg) convert arg to raw type

date date convert arg to date type. The rst version parses a string date(2009) -> date('2009')
date(stringarg) in the format "yyyy-mm-dd hh:mi:ss" where trailing
date(2009, 1, 2) -> date('2009-01-02')
components except for the year may be omitted. The
date date( xedarg)
version with one xed number arg strips digits behind date( xed(20000203135026.1234567, 10,
date date(int, int) the comma and tries to make a date from the rest. The 4)) -> date('2000-02-03 13:50:26')
other versions accept the individual components to be
date date(int, int, set.
int)

date date(int, int,


int, int)

date date(int, int,


int, int, int)

date date(int, int,


int, int, int, int)

longdate longdate convert arg to longdate type, similar to the preceding longdate( xed(20000203135026.1234567,
longdate(stringarg) date function. 10, 5)) -> longdate('2000-02-03
13:50:26.1234500')
longdate
longdate( xedarg) longdate(2011, 3, 16, 9, 48, 12, 1234567) ->
longdate('2011-03-16 09:48:12.1234567')
longdate
longdate(int, int,
int)

longdate
longdate(int, int,
int, int, int)

longdate
longdate(int, int,
int, int, int, int)

longdate
longdate(int, int,
int, int, int, int, int)

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 77/98
1/10/2020

Function Syntax Purpose Example

time time convert arg to time type, similar to the preceding date
time(stringarg) function

time time( xedarg)

time time(int, int)

time time(int, int,


int)

seconddate seconddate(string) Convert to seconddate. One stringargs is a string with


default parsing; two stringargs is a format string in the
seconddate(int,
second arg, numeric args are the date components.
int, int, int, int, int)

secondtime secondtime(string) Converto to secondtime.

secondtime(string,
string)

secondtime(int,
int, int)

Mathematical Functions
Scalar math functions perform a calculation, based on input values that are provided as arguments, and return a numeric value.

Function Syntax Purpose Example

sign int sign(double) Sign returns -1, 0 or 1 depending on the sign of its argument. Sign is
implemented for all numeric types, date, and time.
int sign(time)

int sign(date)

abs double abs(double) Abs returns arg, if arg is positive or zero, -arg else. Abs is implemented for all
numeric types and time.
dec oat
abs(dec oat)

dec oat
abs(dec oat)

time abs(time)

round double Round does rounding of absolute values toward zero while the sign is retained round(123.456, 0) =
round(double, int) 123

round(123.456, 1) =
123.5

round(-123.456, 1) =
-123.5

round(123.456, -1) =
120

rounddown double Rounddown rounds toward negative in nity making rounddown(-1.1, 0) = -2 rounddown(123.456,
rounddown(double, -1) = 120
int)
rounddown(-123.456,
-1) = -130

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 78/98
1/10/2020

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

Function Syntax Purpose

utctolocal utctolocal(datearg, Interprets datearg (a date, without timezone) as utc and convert it to the timezone
timezonearg) named by timezonearg (a string)

localtoutc localtoutc(datearg, Converts the local datetime datearg to the timezone speci ed by the string
timezonearg) timezonearg, return as a date

weekday weekday(date) Returns the weekday as an integer in the range 0..6, 0 is Monday.

now now() Returns the current date and time (localtime of the server timezone) as date

daysbetween daysbetween(date1, date2) Returns the number of days (integer) between date1 and date2. The rst version is an
alternative to date2 - date1.
daysbetween(daydate1,
daydate2) Instead of rounding or checking for exactly 24 hours distance, this truncates both
date values today precision and subtract the resulting day numbers, meaning that if
daysbetween(seconddate1,
arg2 is not the calendar day following arg1, daysbetween returns 1 regardless of the
seconddate2)
time components of arg1 and arg2.
daysbetween(longdate1,
longdate2)

secondsbetween secondsbetween(seconddate1, Returns the number of seconds the rst to the second arg, as a xed point number.
seconddate2) The returned value is positive if the rst argument is less than the second. The return
values are xed18.0 in both cases (note that it may prove more useful to use xed11.7
secondsbetween(longdate1,
in case of longdate arguments).
longdate2)

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.

addseconds addseconds(date, int) Return a date plus a number of seconds. Fractional seconds are used in case of
longdate. If any argument is null, then null handling is (in opposition to the default
addseconds(seconddate,
done with adds) to return null.
dec oat)

addseconds(longdate,
dec oat)

adddays adddays(date, int) Return a date plus a number of days. If any argument is null, then null handling is (in
opposition to the default done with adds) to return null.
adddays(daydate, int)

adddays(seconddate, int)

adddays(longdate, int)

quarter quarter(date) Return a string 'yyyy-Qn', yyyy being the year of the quarter and n the quarter of the
year. An optional start month (of the scal year) may be supplied. For example,
quarter(date, month)
quarter(date('2011-01-01'), 6) is '2010-Q3' and quarter(date('2011-06-01'), 6) is '2011-
Q1'.

format format(longdate, string) Date values may be used together with format strings, as described elsewhere in the
NewDb documentation (look for descriptions of the TO_DATE and TO_CHAR SQL
functions) . For example, format(longdate('2011-06-09 20:20:13.1234567'),
'YYYY/MM/DD"T"HH24:MI:SS.FF7')

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 79/98
1/10/2020

Spatial Functions
The following table lists the supported spatial functions for expressions in the column engine language.

Function Type Description

ST_Area ST_MultiPolygon Computes the area of the multipolygon.

ST_Area ST_Polygon Calculates the area of a polygon.

ST_AsGeoJSON ST_Geometry Returns a string representing a geometry in JSON format.

ST_AsText ST_Geometry Returns the text representation of a ST_Geometry value.

ST_Buffer ST_Geometry Returns the ST_Geometry value that represents all points whose distance from
any point of a ST_Geometry value is less than or equal to a speci ed distance
in the given units.

ST_ConvexHull ST_Geometry Returns the convex hull of the geometry value.

ST_Difference ST_Geometry Returns the geometry value that represents the point set difference of two
geometries.

ST_Distance ST_Geometry Returns the distance between two geometries in the given unit, ignoring z- and
m-coordinates in the calculations.

ST_Envelope ST_Geometry Returns the bounding rectangle for the geometry value.

ST_GeomFromText ST_Geometry Constructs a geometry from a character string representation.

ST_GeometryType ST_Geometry Returns the name of the type of the ST_Geometry value.

ST_Intersection ST_Geometry Returns the geometry value that represents the point set intersection of two
geometries.

ST_IsEmpty ST_Geometry Determines whether the geometry value represents an empty set.

ST_SRID ST_Geometry Retrieves or modi es the spatial reference system associated with the
geometry value.

ST_SRID(INT) ST_Geometry Changes the spatial reference system associated with the geometry without
modifying any of the values.

ST_SymDifference ST_Geometry Returns the geometry value that represents the point set symmetric difference
of two geometries.

ST_Transform ST_Geometry Creates a copy of the geometry value transformed into the speci ed spatial
reference system.

ST_Union ST_Geometry Returns the geometry value that represents the point set union of two
geometries.

The preceding functions are categorized based on the use case as shown:

Geometry Construction Functions

ST_Geometry ST_GeomFromText(String/Clob wkt, Int srid);

Geometry Serialization

String/Clob ST_AsText(ST_Geometry geometry);

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 80/98
1/10/2020
String/Clob ST_AsGeoJson(ST_Geometry geometry);

Geometry Transformation

ST_Geometry ST_Transform(ST_Geometry geometry, Int srid);

Geometry Inspection

String ST_GeometryType(ST_Geometry geometry);

Int ST_SRID(ST_Geometry geometry);

Int ST_IsEmpty(ST_Geometry geometry);

ST_Geometry ST_Envelope(ST_Geometry geometry);

Calculations on a Single Geometry

Double ST_Area(ST_Geometry geometry);

ST_Geometry ST_ConvexHull(ST_Geometry geometry);

ST_Geometry ST_Buffer(ST_Geometry geometry, Double buffer [, String uom]);

Calculations on Two Geometries

Double ST_Distance(ST_Geometry geometry1,

ST_Geometry geometry2 [, String uom]);

ST_Geometry ST_Intersection(ST_Geometry geometry1, ST_Geometry geometry2);

ST_Geometry ST_Union(ST_Geometry geometry1, ST_Geometry geometry2);

ST_Geometry ST_Difference(ST_Geometry geometry1, ST_Geometry geometry2);

ST_Geometry ST_SymDifference(ST_Geometry geometry1, ST_Geometry geometry2);

Spatial Predicates
The following table lists the supported spatial predicates for expressions in the column engine language.

Predicate Type Description

ST_Contains ST_Geometry Tests if a geometry value spatially contains


another geometry value.

ST_CoveredBy ST_Geometry Tests if a geometry value is spatially covered


by another geometry value.

ST_Covers ST_Geometry Tests if a geometry value spatially covers


another geometry value.

ST_Crosses ST_Geometry Tests if a geometry value crosses another


geometry value.

ST_Disjoint ST_Geometry Test if a geometry value is spatially disjoint


from another value.

ST_Equals ST_Geometry Tests if a ST_Geometry value is spatially


equal to another ST_Geometry value.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 81/98
1/10/2020

Predicate Type Description

ST_Intersects ST_Geometry Test if a geometry value spatially intersects


another value.

ST_Overlaps ST_Geometry Tests if a geometry value overlaps another


geometry value.

ST_Touches ST_Geometry Tests if a geometry value spatially touches


another geometry value.

ST_Within ST_Geometry Tests if a geometry value is spatially


contained within another geometry value.

ST_WithinDistance ST_Geometry Test if two geometries are within a speci ed


distance of each other.

Miscellaneous Functions
The following table lists the miscellaneous functions that you can use while creating expressions.

Function Syntax Purpose Example

if if(intarg, arg2, return arg2 if intarg is considered true (not equal to zero), else return arg3. Currently, if("NETWR"
arg3) no shortcut evaluation is implemented, meaning that both arg2 and arg3 are <=500000,'A',
evaluated in any case. This means that you cannot use if to avoid a divide by zero if("NETWR"
error, which has the side effect of terminating expression evaluation when it occurs. <=1000000,'B','C')
)

jf if(intarg, arg2, The function jf behaves similar to if, only with SQL semantic. While if returns NULL if
arg3) the predicate ( rst argument) is NULL (unde ned), jf uses the else-value (arg3) in
that case.

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

case case(arg1, return value1 if arg1 == cmp1, value2 if arg1 == cmp2, and more, default if there no case("CATEGORY",
default) match 'A', 'LV', 'B', 'MV',
case(arg1, cmp1, 'HV')
value1, cmp2,
value2, ...,
default)

box The function box behaves similar to case, only with SQL semantic. While case returns
NULL if arg1 is NULL, box returns the default in that case.

isnull isnull(arg1) return 1 (= true), if arg1 is set to null and null checking is on during Evaluator run
(EVALUATOR_MAY_RETURN_NULL)

max max(arg1, arg2, return the maximum value of the passed arguments list. An arbitrary number of max(0, 5, 3, 1)
arg3, ...) arguments is allowed. Arguments must be at least convertible into a common type.

min min(arg1, arg2, return the minimum value of the passed arguments list. An arbitrary number of min(1, 2, 3, 4)
arg3, ...) arguments is allowed. Arguments must be at least convertible into a common type.

sqladd sqladd(arg1, sqladd behaves like the operator '+', with NULL handling changed to SQL standard. sqladd(if("VAL_B"
arg2) While the operator '+' returns the other argument when one argument is NULL, = 0, int(null),
sqladd returns NULL if any of its arguments is NULL. "VAL_C") /
"VAL_B", -1)

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 82/98
1/10/2020

Using SQL Functions


Conversion Functions
Data type conversion functions convert data from one data type to another data type.

Data type conversion functions are used to convert function arguments from one data type to another, or to test whether a
conversion is possible.

 Note
In both implicit and explicit numeric type conversions, these functions always truncate the least signi cant digits toward zero.

Function Syntax Purpose

TO_ALPHNUM TO_ALPHANUM Converts a given <value> to an ALPHANUM data type.


(<value>)

TO_BIGINT TO_BIGINT If the input <value> has a mantissa, then these digits are truncated during the conversion
(<value>) process.

TO_BINARY TO_BINARY Converts a <value> to a BINARY data type. TO_BINARY (<value>)


(<value>)

TO_BLOB TO_BLOB (<value>) Converts a <value> to a BINARY data type.

TO_CHAR TO_CHAR (value) Converts character data from any supported character set into the CHAR character set for the
database.

TO_CLOB TO_CLOB (<value>) Converts a <value> to a CLOB data type.

TO_DATE TO_BINARY Converts the date string <d> into a DATE data type. If the <format> speci er is omitted, the
(TO_DATE (<d> [, conversion is performed using the date format model.
<format>])

TO_DATS TO_DATS (<d>) Converts the date string <d> into an ABAP DATE string with format 'YYYYMMDD'.

TO_DECIMAL TO_DECIMAL If <precision> and <scale> are not speci ed, then DECIMAL becomes a oating-point decimal
(<value> [, number. In this case, <precision> and <scale> can vary within the range described above: 1-34
<precision>, for <precision> and -6,111-6,176 for <scale> depending on the stored value. Unnecessary least
<scale>]) signi cant digits in the mantissa of the input value are truncated during the conversion
process.

TO_DOUBLE TO_DOUBLE Converts a speci ed <value> to a DOUBLE (double precision) data type.
(<value>)

TO_FIXEDCHAR TO_FIXEDCHAR Converts the speci ed <string> to a CHAR value of xed size as speci ed by <size>, starting at
(<string>, <size>) the rst character. <size> cannot be a variable.

TO_INT TO_INT (<value>) If the input <value> has a mantissa, then the mantissa is truncated during the conversion
process.

TO_INTEGER TO_INTEGER Converts the <value> to an INTEGER data type.If the input <value> has a mantissa, then these
(<value>) digits are truncated during the conversion process.

TO_NCHAR TO_NCHAR( string- The TO_NCHAR function converts a TEXT expression, date, or number to NTEXT in a speci ed
expression [, format. This function is typically used to format output data.
source-charset-
name ] )

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 83/98
1/10/2020

Function Syntax Purpose

TO_NCLOB TO_NCLOB Converts a <value> to an NCLOB data type.


(<value>)

TO_NUMBER TO_NUMBER(value) TO_NUMBER converts expression to a value of NUMBER datatype.

TO_NVARCHAR TO_NVARCHAR If the <format> speci er is omitted, then the conversion is performed using the date format
(<value> [, model. The following data types can be converted to NVARCHAR using the TO_NVARCHAR
<format>]) function: ALPHANUM, BIGINT, DATE, DECIMAL, DOUBLE, FIXED12, FIXED16, FIXED8,
INTEGER, REAL, SECONDDATE, SMALLDECIMAL, SMALLINT, TIME, TIMESTAMP, TINYINT,
VARBINARY, VARCHAR, CLOB, NCLOB, TEXT (if the value is longer than the maximum length
of NVARCHAR, then an exception is thrown)

TO_REAL TO_REAL (<value>) Converts a <value> to a REAL (single precision) data type.

TO_SECONDDATE TO_SECONDDATE If the <format> speci er is omitted, then the conversion is performed using the date format
(<d> [, <format>]) model.

TO_TIME TO_TIME (<t> [, Converts time string <t> to the TIME data type. If the <format> speci er is omitted, then the
<format>]) conversion is performed using the time format model.

TO_TIME TO_TIME (<t> [, Converts time string <t> to the TIME data type. If the <format> speci er is omitted, then the
<format>]) conversion is performed using the time format model.

TO_TIMESTAMP TO_TIMESTAMP Converts date string <d> to the TIMESTAMP data type. If the <format> speci er is omitted,
(<d> [, <format>]) then the conversion is performed using the date format model.

TO_VARBINARY TO_VARCHAR function returns a VARBINARY (varying-length binary string) representation of a string of any
(<value>) data type.

TO_VARCHAR TO_VARCHAR If the <format> speci er is omitted, then the conversion is performed using the date format
(<value> [, model.
<format>])

String Functions
String functions perform extraction and manipulation on strings, or return information about strings.

Function Syntax Purpose

ABAP_LOWER ABAP_LOWER ( string ) Converts all characters in the <string> parameter to lowercase.

ABAP_ALPHANUM ABAP_ALPHANUM ( <string>, The input value, <string>, is checked to nd out if it is numeric or a
<chars> ) mixture of numeric and non-numeric. If <string> is numeric, then it is left-
padded with zeroes up to the length speci ed by <chars>, if necessary. If
<string> is a mixture or numeric and non-numeric, or is empty, then it is
returned unchanged. Strings that start with spaces and contain only digits
after the whitespace pre x are regarded as numeric.

ABAP_NUMC ABAP_NUMC ( <arg1>, <chars> String and numeric values are left-padded with 0s if <arg1> is shorter
) than <chars>. If <arg1> is longer than <chars>, then characters are
truncated from the left. Numeric values are rounded to their integer part
and the sign is discarded.LONGDATE, SECONDDATE, DAYDATE, and
SECONDTIME values are padded and truncated from the right side, as
necessary. SDFLOAT inputs are never truncated but create an over ow
error if they are found to be too long.

ABAP_UPPER ABAP_UPPER ( string ) Converts all characters in the <string> parameter to uppercase.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 84/98
1/10/2020

Function Syntax Purpose

BINTONHEX BINTONHEX ( <expression> ) Converts a binary value to a hexadecimal value as an NVARCHAR data
type. The input value is converted to a binary value rst if it is not a binary
value.

BINTOSTR BINTOSTR (<bstring>) Converts a VARBINARY string <bstring> to a character string with CESU-
8 encoding.

CONCAT CONCAT (<str1>, <str2>) Returns a combined string consisting of <string1> followed by <string2>.
The concatenation operator (||) is identical to this function. The
maximum length of the concatenated string is 8,388,607. If the string
length is longer than the maximum length, an exception is thrown.
Exceptionally, an implicit truncation is performed when converting an
(N)CLOB typed value with a size greater than the maximum length of an
(N)VARCHAR typed value.

CONCAT_NAZ CONCAT_NAZ ( <str1>, <str2> ) Returns a combined, non-null value string consisting of <str1> followed by
<str2>. The maximum length of the concatenated string is 8,388,607. If
the string length is longer than the maximum length, then an exception is
thrown. Exceptionally, an implicit truncation is performed when
converting an (N)CLOB typed value with a size greater than the maximum
length of an (N)VARCHAR typed value.

LEFT LEFT(string, n) Returns the rst <n> characters/bytes from the beginning of
<string>.Returns an empty string value if <n> is less than 1.Returns
<string> (without blank padding) if the value of <n> is greater than the
length of <string>.

LENGTH LENGTH(str) Returns the number of characters in string <str>. If <str> is a VARCHAR,
then the function does not return the number of bytes. In this case, the
number of characters like NVARCHAR-typed strings are returned instead.
Supplementary plane Unicode characters, each of which occupies 6 bytes
in CESU-8 encoding, are counted as two characters.

LIKE_REGEXPR <regex_subject_string> This predicate performs regular expression matching. If any of the
LIKE_REGEXPR <pattern> [ following parameters is NULL: <pattern>, < ag> or
FLAG < ag> ] <regex_subject_string>, then the predicate returns FALSE.

LOCATE LOCATE (<haystack>, <needle>, Returns the position of a substring <needle> within a string
<start_position>, <haystack>.Returns 0 if <needle> is not found within <haystack>, or if
<occurrences>) <occurrences> is set to less than 1. Returns NULL if <haystack> or
<needle> is NULL. If <start_position> is not speci ed or is 0, then the
search starts at the beginning of the string <haystack>. If
<start_position> is negative, then the search starts at the ending of the
string <haystack>. If <occurrences> is not speci ed, then the rst
matched position will be returned.

LOCATE_REGEXPR LOCATE_REGEXPR([ Searches a string for a regular expression pattern and returns an integer
<regex_position_start_or_after> indicating the beginning position, or the ending position plus 1, of one
] <pattern> [ FLAG < ag> ] IN occurrence of the matched substring. If any of the following parameters is
<regex_subject_string> [ FROM NULL: <pattern>, < ag>, <regex_subject_string>, , <start_position>,
<start_position> ] [ <regex_occurrence> or <regex_capture_group>, then the function returns
OCCURRENCE NULL.
<regex_occurrence> ] [ GROUP
<regex_capture_group> ] )

LOWER LOWER(string) Return an all lower case version of the string. Unlike most other string
functions, this also attempts to convert unicode characters in CESU
encoding beside the usual A-Z.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 85/98
1/10/2020

Function Syntax Purpose

LPAD LPAD (<str>, <n> [, <pattern>]) Left-pads the end of <str> with spaces to make a string of <n> characters.
If <pattern> is speci ed, then<str> is padded using sequences of the
given characters until the required length is met.

If the length of <str> is greater than <n>, then no padding is performed


and the resulting value is truncated from the right side to the length
speci ed in <n>.

LPAD returns an empty string value if <n> is less than 1.

LTRIM LTRIM (<str> [, <remove_set>]) Returns string <str>, trimmed of all leading spaces. If <remove_set> is
speci ed, LTRIM removes all the characters contained in this set from the
start of string <str>. This process continues until a character that is not in
<remove_set> is reached.

<remove_set> is treated as a set of characters and not as a search string.

OCCURRENCES_REGEXPR OCCURRENCES_REGEXPR( Returns the number of matches of a regular expression search within a
<pattern> [ FLAG < ag> ] IN string.
<regex_subject_string> [ FROM
<start_position> ] )

REPLACE REPLACE(originalString, Searches in <original_string> for all occurrences of <search_string> and


searchString, replaceString)) replaces them with<replace_string>.

If two overlapping substrings match the <search_string> in the


<original_string>, then only the rst occurrence is replaced.

If <original_string> does not contain an occurrence of


<search_string>, then <original_string> is returned unchanged.

If <original_string>, <search_string>, or <replace_string> are


NULL, then NULL is returned.

REPLACE_REGEXPR REPLACE_REGEXPR (<pattern> Searches a string for a regular expression pattern and returns the string
[ FLAG < ag> ] IN with either one or every occurrence of the regular expression pattern that
<regex_subject_string> [ WITH is replaced using a replacement string. If any of the following parameters
<replacement_string> ] [ FROM is NULL, then the function returns NULL: <pattern>, < ag>, <regex
<start_position> ] [ subject_string>, <replacement_string>, <start_position> or
OCCURRENCE <regex_replace_occurrence>.
<regex_replace_occurrence> ])

RIGHT RIGHT(<str>, <n>) Returns the rightmost <n> characters/bytes of string <str>. Returns an
empty string value if <n> is less than 1. Returns string <str> (without
blank padding) if the value of <n> is greater than the length of string
<str>.

RPAD RPAD (<str>, <n> [, <pattern>]) Right-pads the end of <str> with spaces or characters to make a string of
<n> characters in length. If <pattern> is speci ed, then <str> is padded
using sequences of the given characters until the required length is met.

If the length of <str> is greater than <n>, then no padding is performed


and the resulting value is truncated to the length speci ed in <n>.

RPAD returns an empty string value if <n> is less than 1.

RTRIM RTRIM (<str> [,<remove_set> ]) Returns a string trimmed of all trailing spaces. If <remove_set> is
speci ed, then RTRIM removes all the characters contained in the
speci ed set from the end of the string. This process continues until a
character that is not in the <remove_set> has been reached.

<remove_set> is treated as a set of characters and not as a search string.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 86/98
1/10/2020

Function Syntax Purpose

SUBSTR_AFTER SUBSTR_AFTER (<str>, Returns a substring from the speci ed string that follows the rst
<pattern>) occurrence of the speci ed pattern. If <str> does not contain the
<pattern> substring, then an empty string is returned. If <pattern> is an
empty string, then <str> is returned. If <str> or <pattern> is NULL, then
NULL is returned.

SUBSTR_BEFORE SUBSTR_BEFORE (<str>, Returns a substring from the speci ed string before the rst occurrence
<pattern>) of the speci ed pattern.If <str> does not contain the <pattern> substring,
then an empty string is returned.If <pattern> is an empty string, then
<str> is returned.If <str> or <pattern> is NULL, then NULL is returned.

SUBSTR <str>, <start_position> [, Returns a substring from the speci ed string starting from
<string_length>] <start_position> within the string. SUBSTRING can return the remaining
part of a string from the <start_position>, or optionally, a number of
characters set by the <string_length> parameter.

If <start_position> is less than 1, then it is considered to be 1.

If <string_length> is less than 1, then an empty string is returned.

If <string_length> is greater than the length of remaining part of


<str>, then the remaining part is returned without blank padding.

When used on binary types, SUBSTRING factors in byte length


and interprets the offsets, <start_position>and <string_length>,
as byte positions.

TRIM TRIM(string) Returns a string after removing leading and trailing spaces.

UCASE UCASE(string) Converts all characters in string <str> to uppercase. The UCASE function
is identical to the UPPER function.

UPPER UPPER(string) return an all upper case version of the string. Unlike most other string
functions, this also attempts to convert unicode characters in CESU
encoding beside the usual a-z.

CAST CAST (expression AS Returns the value of an expression converted to a supplied data type.
data_type(length))

Mathematical Functions
Numeric functions perform mathematical operations on numerical data types or return numeric information.

Mathematical functions take numeric values, or strings with numeric characters, as inputs and return numeric values. When
strings with numeric characters are provided as inputs, implicit conversion from a string to a number is performed automatically
before results are computed.

Function Syntax Purpose

ABS ABS(numericArg) Returns the absolute value of a numeric argument.

ACOS ACOS(numericArg) Returns the arc-cosine, in radians, of <numericArg> between -1 and 1.

ASIN ASIN(numericArg) Returns the arc-sine, in radians, of the <numericArg> between -1 and 1.

ATAN ATAN(numericArg) Returns the arc-tangent, in radians, of the <numericArg>. The range of <numericArg> is
unlimited.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 87/98
1/10/2020

Function Syntax Purpose

ATAN2 ATAN2 (<number1>, Returns the arc-tangent, in radians, of the ratio of two
<number2>) numbers <number1> and <number2>.

BINTOHEX BINTOHEX(<expression>) Converts a binary value to a hexadecimal value as a VARCHAR data type. If the input value is
not a binary value, then it is rst converted to a binary value.

BITAND BITAND(nonNegativeArg, Performs an AND operation on the bits of the arguments <n> and <m>. The BITAND
nonNegativeArg) function returns a result along the argument's type.

BITCOUNT BITCOUNT(expression) Counts the number of set bits of the argument <expression>. The BITCOUNT function
returns an INTEGER value.

BITNOT BITNOT(expression) Performs a bitwise NOT operation on the bits of the argument <expression>. The BITNOT
function returns a result along the argument's type.

BITOR BITOR(expression1, This function performs an OR operation on the bits of the arguments <expression1> and
expression2) <expression2>. The BITOR function returns a result along the argument's type.

BITXOR BITXOR(expression1, Performs an XOR operation on the bits of the arguments <expression1> and <expression2>.
expression2) The BITXOR function returns a result along the argument's type.

CEIL CEIL(numericArg) Returns the rst integer that is greater than or equal to the value of <numericArg>.

COS COS(numericArg) Returns the cosine of the angle <numericArg>, in radians.

COSH COSH(numericArg) Computes the hyperbolic cosine of the <numericArg>.

COT COT(numericArg) Computes the cotangent of a number <numericArg>, where <numericArg> is an angle
expressed in radians.

EXP EXP(numericArg) Returns the result of the base of the natural logarithms e raised to the power of the
argument <numericArg>.

FLOOR FLOOR(numericArg) Returns the largest integer that is not greater than the numeric argument <numericArg>.

HEXTOBIN HEXTOBIN(hexadecimalValue) HEXTOBIN returns a VARBINARY value where each byte of the result corresponds to two
characters of <hexadecimalValue>. If <hexadecimalValue> does not contain an even
number of digits, an error is returned. In SAP HANA, lowercase characters in
<hexadecimalValue> are supported and are treated as uppercase.

LN LN(numericArg) Returns the natural logarithm of the numeric argument <numericArg>.

LOG LOG(base, numericArg) Returns the natural logarithm of a number <numericArg> base <base>, where <base> must
be a positive value greater than 1, and <numericArg> must be any positive value.

MOD MOD(numericArg, divisor) Returns the remainder of a number <numericArg> divided by a divisor <divisor>.When
<numericArg> is negative, this function acts differently to the standard computational
modulo operation. The following list shows examples of what the MOD function returns as
the result: If <divisor> is zero, then <numericArg> is returned.If <numericArg> is greater
than 0 and <numericArg> is less than <divisor>, then <numericArg> is returned.If
<numericArg> is less than 0 and <numericArg> is greater than <divisor>, then
<numericArg> is returned.In cases other than those mentioned above, the remainder of the
absolute value of <numericArg> divided by the absolute value of <divisor> is used to
calculate the remainder. If <numericArg> is less than 0, then the returned remainder from
MOD is a negative number, and if <numericArg> is greater than 0, then the returned
remainder from MOD is a positive number.

POWER POWER(numericArg, Calculates <numericArg> raised to the power of <exponent>.


exponent)

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 88/98
1/10/2020

Function Syntax Purpose

ROUND ROUND (<n> [, <pos> [, Rounds argument <n> to the speci ed amount of places (<pos>) after the decimal point. By
<rounding_mode>]]) default, the value <n> is rounded up to the next round gure. If the value is precisely in
halfway between two rounded values, it is rounded up away from zero (commercial
rounding).

SIGN SIGN(numericArg) Returns 1 if <numericArg> is a positive value, -1 if <numericArg> is a negative value, 0


if <n> is equal to zero, and NULL if <numericArg> is equal to NULL.

SIN SIN(numericArg) Returns the sine of <numericArg>, where <numericArg> is an angle expressed in radians.

SINH SINH(numericArg) Returns the hyperbolic sine of <numericArg>, where the argument is an angle expressed in
radians.

SQRT SQRT(numericArg) Returns the square root of the numeric argument <numericArg>.

TAN TAN(numericArg) Returns the tangent of <numericArg>, where <numericArg> is an angle expressed in
radians.

UMINUS UMINUS(numericArg) Returns the negated value of the speci ed numeric argument <numericArg>.

Date Functions
Date and time functions perform operations on date and time data types or return date or time information.

Function Syntax Purpose

ADD_DAYS ADD_DAYS(date,days) Computes the speci ed date plus the


speci ed number of days.

ADD_MONTH ADD_MONTHS(date, months) Computes the speci ed date plus the


speci ed number of months. To compute
the date so that the output date is set to the
last day of the month when the input date is
the last day of the month, use the
ADD_MONTHS_LAST function. The
parameter <date> must be implicitly or
explicitly converted to one of the following
SQL data types:DATE, TIMESTAMP,
SECONDDATE. The SQL data type of the
output parameters is the same as the SQL
data type of the input parameters. For
example, ADD_MONTHS_LAST(DATE)
returns a date, while
ADD_MONTHS_LAST(TIMESTAMP) returns
a timestamp.

ADD_MONTHS_LAST ADD_MONTHS_LAST(date, months) Computes the speci ed date plus the


speci ed number of months. If the input
date is the last day of the input month, then
the output date is set to the last day of the
output month.

ADD_SECONDS ADD_SECONDS(time, seconds) Computes the speci ed time plus the


number of speci ed seconds.

ADD_YEARS ADD_YEARS(date, years) Computes the speci ed date plus the


speci ed number of years.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 89/98
1/10/2020

Function Syntax Purpose

CURRENT_DATE CURRENT_DATE Returns the current local system date. Use


UTC times instead of local timestamps. The
use of local times or conversion between
local time zones can require additional
handling in application code.

CURRENT_TIME CURRENT_TIME Returns the current local system time. Use


UTC times instead of local timestamps. The
use of local times or conversion between
local time zones might require additional
handling in the application code.

CURRENT_TIMESTAMP CURRENT_TIMESTAMP Returns the current local system timestamp


information.Use UTC times instead of local
timestamps. The use of local times or
conversion between local time zones might
require additional handling in the application
code.

CURRENT_UTCDATE CURRENT_UTCDATE Returns the current UTC date.

CURRENT_UTCTIME CURRENT_UTCTIME Returns the current UTC time.

CURRENT_UTCTIMESTAMP CURRENT_UTCTIMESTAMP Returns the current UTC timestamp.

DAYNAME DAYNAME(date) Returns the weekday in English for <date>.

DAYOFYEAR DAYOFYEAR(date) Returns an integer representation of the day


of the year for <date>.

DAYS_BETWEEN DAYS_BETWEEN(date1, date2) Computes the number of days between


<date1> and <date2>.

EXTRACT EXTRACT(part from date) Finds and returns the value of a speci ed
datetime eld from a speci ed date.

EXTRACT_DAY EXTRACT_DAY(date) Finds and returns the value of a speci ed


date eld from a speci ed date.

EXTRACT_HOUR EXTRACT_HOUR(time) Finds and returns the value of a speci ed


hour eld from a speci ed date.

EXTRACT_MINUTE EXTRACT_MINUTE(time) Finds and returns the value of a speci ed


minute eld from a speci ed date.

EXTRACT_MONTH EXTRACT_MONTH(date) Finds and returns the value of a speci ed


month eld from a speci ed date.

EXTRACT_SECOND EXTRACT_SECOND(time) Finds and returns the value of a speci ed


second eld from a speci ed date.

EXTRACT_YEAR EXTRACT_YEAR(date) Finds and returns the value of a speci ed


year eld from a speci ed date.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 90/98
1/10/2020

Function Syntax Purpose

ISOWEEK ISOWEEK(date) Returns the ISO year and week numbers of


date <date>. The week number is pre xed
by the letter W. Both the WEEK and
ISOWEEK functions return the week number
for a speci ed date but the format of the
result is quite different, and the two
functions may handle the rst week of the
new year differently. For example, when
supplied the date 2017-01-01, the WEEK
function considers the date to be part of the
rst week of 2017 and returns 1, whereas
ISOWEEK considers the date to be part of
the last week of 2016 and returns 2016-
W52. ISOWEEK has either 52 or 53 full
weeks, with the extra week considered to be
a leap week

LAST_DAY LAST_DAY(date) Returns the date of the last day of the


month that contains the <date>.

LOCALTOUTC LOCALTOUTC(time, timezone) Interprets <time> (a time, without


timezone) as utc and convert it to the
timezone named by <timezone> (a string)

MONTH MONTH(date) Returns the number of the month from


<date>.

MONTHNAME MONTHNAME(date) Returns the name of the month for <date>.

MONTHS_BETWEEN MONTHS_BETWEEN(date1, date2) Computes the number of months between


<date1> and <date2>. Returns NULL if
either of <date1> or <date2> is NULL.

NANO100_BETWEEN NANO100_BETWEEN(date1, date2) Computes the time difference between date


arguments <date1> and <date2>, to the
precision of 0.1 microseconds.

NOW NOW() Returns the current date and time


(localtime of the server timezone) as date

QUARTER QUARTER(date) Return a string 'yyyy-Qn', yyyy being the


year of the quarter and n the quarter of the
year. An optional start month (of the scal
year) may be supplied. For example,
quarter(date('2011-01-01'), 6) is '2010-Q3'
and quarter(date('2011-06-01'), 6) is '2011-
Q1'.

SECOND SECOND(time) Returns a value of seconds for a given time.


Subseconds are included for TIMESTAMP
datatypes.

SECONDS_BETWEEN SECONDS_BETWEEN(date1, date2) Computes the number of seconds between


date arguments <date1> and <date2>,
which is semantically equal to (<date2> -
<date1>).

UTCTOLOCAL UTCTOLOCAL(time, timezone) Interprets datearg (a date, without


timezone) as utc and convert it to the
timezone named by timezonearg (a string)

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 91/98
1/10/2020

Function Syntax Purpose

WEEK WEEK(date) Returns the week number of the year as an


integer. Weeks start Monday and end
Sunday. The rst days of the year up to the
rst Sunday are week 1; the seven days that
begin with the day after the rst Sunday are
week 2, and so on. Both the WEEK and
ISOWEEK functions return the week number
for a speci ed date but the format of the
result is quite different, and the two
functions may handle the rst week of the
new year differently. For example, when
supplied the date 2017-01-01, the WEEK
function considers the date to be part of the
rst week of 2017 and returns 1, whereas
ISOWEEK considers the date to be part of
the last week of 2016 and returns 2016-
W52.

WEEKDAY WEEKDAY(date) Returns the weekday as an integer in the


range 0..6, 0 is Monday.

YEAR YEAR(date) Returns the year number of date <date>.

YEARS_BETWEEN YEARS_BETWEEN(date1, date2) Computes the number of years between


<date1> and <date2>. Returns NULL if
either of <date1> or <date2> is NULL.

Spatial Functions
Function Syntax Purpose

ST_GeomFromText ST_GeomFromText(Stringwkt,intsrid) Constructs a geometry from a character string representation.

ST_AsText ST_AsText(ST_Geometry) Returns the text representation of a ST_Geometry value.

ST_AsGeoJson ST_AsGeoJson(ST_Geometry) Returns a string representing a geometry in JSON format.

ST_Transform ST_Transform(ST_Geometry , intsrid) Creates a copy of the geometry value transformed into the speci ed
spatial reference system.

ST_GeometryType ST_GeometryType(ST_Geometry) Returns the name of the type of the ST_Geometry value.

ST_SRID ST_SRID(ST_Geometry) Retrieves or modi es the spatial reference system associated with the
geometry value.

ST_IsEmpty ST_IsEmpty(ST_Geometry) Determines whether the geometry value represents an empty set.

ST_Envelope ST_Envelope(ST_Geometry) Returns the bounding rectangle for the geometry value.

ST_Area ST_Area(ST_Geometry) Calculates the area of a polygon.

ST_ConvexHull ST_ConvexHull(ST_Geometry) Returns the convex hull of the geometry value.

ST_Buffer ST_Buffer(ST_Geometry, Doublebuffer , Returns the ST_Geometry value that represents all points whose distance
Stringuom) from any point of a ST_Geometry value is less than or equal to a speci ed
distance in the given units.

ST_Distance ST_Distance(geometry1,geometry2 , Returns the distance between two geometries in the given unit, ignoring z-
Stringuom) and m-coordinates in the calculations.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 92/98
1/10/2020

Function Syntax Purpose

ST_Intersection ST_Intersection((geometry1,geometry2) Returns the geometry value that represents the point set intersection of
two geometries.

ST_Union ST_Union(geometry1,geometry2) Returns the geometry value that represents the point set union of two
geometries.

ST_Difference ST_Difference( geometry1, geometry2) Returns the geometry value that represents the point set difference of two
geometries.

ST_SymDifference ST_SymDifference( geometry1, Returns the geometry value that represents the point set symmetric
geometry2) difference of two geometries.

Spatial Predicates
Function Syntax Purpose

ST_Equals ST_Equals( geometry1, geometry2) Tests if a geometry1 value is spatially equal to another geometry2
value.

ST_Disjoint ST_Disjoint( geometry1, geometry2) Test if a geometry value is spatially disjoint from another value.

ST_Intersect ST_Intersects( geometry1, geometry2) Test if a geometry value spatially intersects another value.

ST_Touches ST_Touches( geometry1, geometry2) Tests if a geometry value spatially touches another geometry value.

ST_Crosses ST_Crosses( geometry1, geometry2) Tests if a geometry value crosses another geometry value.

ST_Within ST_Within( geometry1, geometry2) Tests if a geometry value is spatially contained within another
geometry value.

ST_Contains ST_Contains( geometry1, geometry2) Tests if a geometry value spatially contains another geometry value.

ST_Overlaps ST_Overlaps( geometry1, geometry2) Tests if a geometry value overlaps another geometry value.

ST_Covers ST_Covers( geometry1, geometry2) Tests if a geometry value spatially covers another geometry value.

ST_CoveredBy ST_CoveredBy( geometry1, geometry2) Tests if a geometry value is spatially covered by another geometry
value.

ST_WithinDistance ST_WithinDistance( geometry1, distance, Test if two geometries are within a speci ed distance of each other.
unit_name)

Miscellaneous Functions
Calculation view editor supports many SQL functions that return system values and perform various operations on values,
expressions, and return values of other functions.

Function Syntax Purpose

CASE CASE <expression> WHEN If the expression following the CASE statement is equal to the expression following the
<expression> THEN WHEN statement, then the expression following the THEN statement is returned.
<expression> [{ WHEN Otherwise, the expression following the ELSE statement is returned if it exists.
<expression> THEN
<expression>}…] [ ELSE
<expression>] END

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 93/98
1/10/2020

Function Syntax Purpose

COALESCE COALESCE(expression_list) Returns the rst non-NULL expression from a list. At least two expressions must be
contained in <expression_list>, and all expressions must be comparable. The result is
NULL if all the expressions are NULL.

GREATEST GREATEST(expression_list) Returns the greatest value among the speci ed arguments.

HASH_MD5 HASH_MD5(argument) Returns a 32 byte VARBINARY hash value of the concatenated arguments. The hash is
calculated using a MD5 algorithm.To ensure unique results from concatenated
arguments, delimit the arguments with another string

HASH_SHA256 HASH_SHA256(argument) Returns a 32 byte VARBINARY hash value of the concatenated arguments. The hash is
calculated using a SHA256 algorithm.To ensure unique results from concatenated
arguments, delimit the arguments with another string

IFNULL IFNULL(expression1, IFNULL returns the rst non-NULL input expression. If the data types of <expression1>
expression2) and <expression2> are different, then SAP HANA chooses the data type with the higher
precedence.For example, between TIMESTAMP and STRING, TIMESTAMP has the higher
precedence.

LEAST LEAST(expression_list) Returns the least value among the speci ed arguments.

NULLIF NULLIF(expression1, NULLIF compares the values of two expressions and returns NULL if <expression1>
expression2) equals <expression2>.If <expression1> does not equal <expression2>, then NULLIF
returns <expression1>. If <expression2> is NULL, then NULLIF returns <expression1>.
NULLIF returns the same data type as <expression1>. However, if <expression1> is either
TINYINT or SMALLINT, then NULLIF returns an INTEGER.

SYSUUID SYSUUID Each time you call the SYSUUID function, it returns a new UUID value. SYSUUID calls from
multiple connections are internally serialized to guarantee unique value generation.

NOT NOT(expression) The NOT operator is placed before a condition to negate the condition. The NOT
condition is TRUE if condition is FALSE, FALSE if condition is TRUE, and UNKNOWN if
condition is UNKNOWN.

in in(value1, value2) Returns values that matches values in a list or subquery.

Manage Calculation Views with Missing


Objects
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. The modeling tool in SAP Web IDE uses proxies to help you work with broken models and x
inconsistencies.

When you open broken models, the tool displays red decorators for all missing objects that are essential to successfully activate
the calculation view.

Example:

If you have de ned a calculation view CV1 on table T1 (C1, C2, C3) such that Attributes A1, A2, A3 is de ned 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, the tool

injects proxies for C3, and when you open the calculation view CV1 in the editor, tool displays a red decorator for C3 and an

error marker for A3 to indicate that it is inconsistent.

You can resolve inconsistencies in calculation views by performing any of the following:

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 94/98
1/10/2020
Adjusting mappings of inconsistent objects.

Deleting inconsistent objects.

Rename and Refactor Calculation Views


Rename a calculation view, its output columns, or input parameters and the tool will automatically adjust the references of the
impacted objects.

Context
Refactoring views or its objects (output columns and input parameters) help automatically adjust the references of the view in
impacted objects. The impacted objects are those objects that have dependencies with the target calculation view. Thus,
refactoring helps retain the behavior of the impacted objects.

For example, if you have created a calculation view using other calculation views as data sources, then renaming the data source
impacts the calculation view that consumes the data source.

 Note
You cannot refactor objects that may have dependencies with other objects in different SAP HANA Database Modules. The tool
can automatically adjust references only for impacted objects within the same SAP HANA Database Module.

Procedure
1. Start SAP Web IDE in a Web browser.

2. Rename and refactor calculation views.

a. In the Workspace view, right-click the calculation view that you want to rename and choose Rename.

b. Provide a new name for the calculation view.

c. Choose Rename.

d. If you want to rename the calculation view and also automatically adjust the references in the impacted objects, in
the con rmation dialog box, choose YES.

If you select NO, the tool only renames the calculation view le name.

e. Refactoring calculation views.

In the Refactor Views dialog box, the tool displays the list of calculation views that will be impacted because of the
rename operation. This dialog box also provides information on the refactor support for each impacted view.

 Note
Manually adjust references in impacted views that do not have the refactor support. For example, the tool does
not support refactoring CDS views. In such cases, manually adjust the references in CDS views.

f. Choose Refactor to proceed with the refactoring of impacted views.

The tool performs the rename operation and refactors all impacted views. After the rename and refactor operation is
complete, it displays the refactoring status for each impacted view.

a. (Optional) If you want to download the refactor status as .html le to your local system, select the Download
Refactor Details checkbox.

b. (Optional) Select the Build Impacted Views checkbox to build the impacted views.

The build process uses the design-time database artifacts to generate the corresponding actual objects in the
database catalog.

c. Choose Finish.

3. Rename and refactor output columns or input parameters.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 95/98
1/10/2020
a. Open the required calculation view in the view editor.

b. Select the semantics node.

c. In the editor toolbar, choose (Expand Details Panel).

d. In the Columns tab, choose to rename and refactor output columns of the target calculation view.

If you want to rename and refactor input parameters, in the Parameters tab, choose .

e. For each output column, in the New Name text eld, you can enter a different column name.

f. If you want to convert all lower case letters in column names to upper case letters, select the requrired columns and
choose .

g. Choose Check Impact to identify all views that will be impacted because of the rename operation.

The tool displays the list of impacted views. This dialog box also provides information on the refactor support for
each impacted view.

h. If you want to automatically adjust the references in the impacted views, choose Adjust reference.

i. (Optional) If you want to download the refactor status as .html le to your local system, select the Download
Refactor Details checkbox.

j. (Optional) Select the Build Impacted Views checkbox to build the impacted views.

The build process uses the design-time database artifacts to generate the corresponding actual objects in the
database catalog.

k. Choose .

Rename and Refactor Output Columns and


Input Parameters
You can rename output columns and input parameters in a calculation view and the tool will automatically adjust all references to
the output columns.

Context
You can rename multiple objects at a time. The tool will automatically refactor them to adjust the references in the impacted
objects. When renaming, you can also search output columns (or input parameters) for a text or phrase and replace it with the new
text or phrase. For example, you can search for output columns in the calculation view having the text "customers" and replace it
with "CUSTOMERS."

Procedure
1. Open the required calculation view.

2. Click the Semantics view node.

3. In the editor toolbar, choose .

4. Rename and refactor output columns.

a. In the Columns tab, choose to rename and refactor output columns of the target calculation view.

The tool opens the Rename and Adjust References dialog box, which displays all output columns de ned for the
calculation view. To rename a column,

b. Select the required column.

 Note

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 96/98
1/10/2020
You can rename and refactor multiple columns at a time.

c. In the New Name textbox, provide the required name.

d. If you want to convert all lower case letters in output column names to upper case letters, select the required
columns and choose .

5. (Optional) Search and replace.

You can also use the search and replace capability for renaming output columns. This means that you can search output
columns based on a text or phrase and replace it with the required text or phrase. The tool also allows you to use a regular
expression to search and replace.

a. In the Rename and Adjust References dialog box, choose .

b. Select the required option.

Option Description

Contains Search all output columns that contain the entered search text.

Equals Search all output columns that match the entered search text.

Regex Search all output columns based on the entered regular


expression.

6. In the Search text eld, provide the required text, phrase, or regular expression.

7. In the Replace text eld, enter the new text, phrase, or regular expression.

8. Check impact and adjust references.

Before you rename an output column, the tool helps you identify those calculation views that will be impacted due to the
rename operation. You can then decide whether you want to automatically adjust the references in the impacted objects.

a. In the Rename and Adjust References, choose Check Impact.

The tool displays the list of impacted views. This dialog box also provides information on the refactor support for
each impacted view.

a. If you want to automatically adjust the references in the impacted views, choose Adjust reference.

b. (Optional) If you want to download the refactor status as .html le to your local system, select the Download
Refactor Details checkbox.

c. (Optional) Select the Build Impacted Views checkbox to build the impacted views.

The build process uses the design-time database artifacts to generate the corresponding actual objects in the
database catalog.

9. Choose Finish.

Generate Properties File for Calculation


Views
For a calculation view, you can generate a properties le that contains the key-value pairs, such as, name and description values of
calculation views objects.

Context
The tool generates the properties le in the same SAP HANA Database Module that contains the calculation view with the
extension .properties.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 97/98
1/10/2020
For calculation view objects, such as columns, input parameters, variables, and more, you de ne name and description values.
After generating the properties le for the calculation view, activate the SAP HANA Database Module that contains this generated
le to store the name and description values in the BIMC_DESCRIPTION table.

You can also translate the name and description values to multiple languages and update the BIMC _DESRIPTION table. Client
tools can read the BIMC_DESCRIPTION table and displays values in the reporting tools respectively.

Procedure
1. Start SAP Web IDE in a Web browser.

2. In the Workspace view, select the required calculation views.

3. In the context menu, choose Modeling Actions Generate Properties File .

Generate Calculation View Documentation


Generate a single document that captures all details of a selected calculation view.

Context
Some business scenarios require modeling complex calculation views that includes layers of calculation logic. In such cases,
generating a calculation view documentation helps obtain a snapshot of all key details in a single document. The tool generates
the calculation view documentation in .html format.

For example, the document provides information on columns in the view, the input parameters, variables, hierarchies, calculated
column expressions, notes maintained for calculation views, lter expressions, and more.

Procedure
1. Start SAP Web IDE in a Web browser.

2. In the Workspace view, right-click the calculation view for which you want to generate the documentation, and choose
Modeling Actions Generate Document

In a new browser tab, the tool generates the calculation view documentation. The documentation includes information on
all columns, variables, hierarchies, parameters, impact analysis, lineage, and other general calculation view details.

3. (Optional) Generate documentation for multiple calculation views

You can generate documentation for multiple calculation views in an SAP HANA Database Module at a time.

a. In the workspace view, select the required SAP HANA Database Module.

4. Browse to the src folder, right-click it and choose Generate Document.

The tool downloads an archive le to your local system. This le contains the individual documentation for all calculation
views in the selected SAP HANA Database Module.

https://help.sap.com/http.svc/dynamicpdfcontentpreview?deliverable_id=20467161&topics=92143ac2a1c5460688c5a7177b… 98/98

Das könnte Ihnen auch gefallen