Modeling Guide for SAP Web IDE for SAP HANA



Similar documents
Sample- for evaluation purposes only. Advanced Crystal Reports. TeachUcomp, Inc.

SAP HANA SPS 09 - What s New? SAP HANA Modeling

MAS 500 Intelligence Tips and Tricks Booklet Vol. 1

Business Insight Report Authoring Getting Started Guide

Understanding BEx Query Designer: Part-2 Structures, Selections and Formulas

SAP HANA Core Data Services (CDS) Reference

CHAPTER 4: BUSINESS ANALYTICS

ICP Data Validation and Aggregation Module Training document. HHC Data Validation and Aggregation Module Training Document

ORACLE BUSINESS INTELLIGENCE WORKSHOP

SQL Server 2005: Report Builder

Decision Support AITS University Administration. Web Intelligence Rich Client 4.1 User Guide

How To Create A Report In Excel

CHAPTER 5: BUSINESS ANALYTICS

SAP Business Objects Business Intelligence platform Document Version: 4.1 Support Package Data Federation Administration Tool Guide

Tips and Tricks SAGE ACCPAC INTELLIGENCE

Week 2 Unit 1: Database Schemas and Database Tables

for Sage 100 ERP Business Insights Overview Document

BID2WIN Workshop. Advanced Report Writing

Toad for Oracle 8.6 SQL Tuning

Jet Data Manager 2012 User Guide

Data Tool Platform SQL Development Tools

COGNOS Query Studio Ad Hoc Reporting

SAP BusinessObjects Business Intelligence (BI) platform Document Version: 4.1, Support Package Report Conversion Tool Guide

Release 2.1 of SAS Add-In for Microsoft Office Bringing Microsoft PowerPoint into the Mix ABSTRACT INTRODUCTION Data Access

Release Document Version: User Guide: SAP BusinessObjects Analysis, edition for Microsoft Office

Simply Accounting Intelligence Tips and Tricks Booklet Vol. 1

SAP HANA Live & SAP BW Data Integration A Case Study

Information Design Tool User Guide SAP BusinessObjects Business Intelligence platform 4.0 Feature Pack 3

About PivotTable reports

Logi Ad Hoc Reporting System Administration Guide

IBM Information Server

ADP Workforce Now V3.0

Pastel Evolution BIC. Getting Started Guide

How to Work with Crystal Reports in SAP Business One

Bitrix Site Manager 4.1. User Guide

BusinessObjects Enterprise InfoView User's Guide

Taleo Enterprise. Taleo Reporting Getting Started with Business Objects XI3.1 - User Guide

How to Configure the Workflow Service and Design the Workflow Process Templates

CUSTOMER SAP Cloud for Analytics User Guide User Guide

How to Create User-Defined Fields and Tables

IBM Operational Decision Manager Version 8 Release 5. Getting Started with Business Rules

Creating a Patch Management Dashboard with IT Analytics Hands-On Lab

Efficient Data Access and Data Integration Using Information Objects Mica J. Block

MODULE 7: FINANCIAL REPORTING AND ANALYSIS

Sage ERP Accpac. Everything you Need to Know about Intelligence FAQ

How To Use Query Console

Microsoft Excel: Pivot Tables

Nintex Forms 2013 Help

Creating a universe on Hive with Hortonworks HDP 2.0

SAP Business Intelligence (BI) Reporting Training for MM. General Navigation. Rick Heckman PASSHE 1/31/2012

Consuming Real Time Analytics and KPI powered by leveraging SAP Lumira and SAP Smart Business in Fiori SESSION CODE: 0611 Draft!!!

SAP BusinessObjects Financial Consolidation Web User Guide

SAP Business Objects XIR3.0/3.1, BI 4.0 & 4.1 Course Content

Building Advanced Data Models with SAP HANA. Werner Steyn Customer Solution Adoption, SAP Labs, LLC.

Database Studio is the new tool to administrate SAP MaxDB database instances as of version 7.5.

Sage Abra SQL HRMS Reports. User Guide

How to Work with SAP Crystal Reports in SAP Business One

How to Implement a SAP HANA Database Procedure and consume it from an ABAP Program Step-by-Step Tutorial

OLAP Cube Manual deployment and Error resolution with limited licenses and Config keys

COGNOS 8 Business Intelligence

Designing Adhoc Reports

Reporting and Analysis with SAP BusinessObjects

SAS BI Dashboard 4.3. User's Guide. SAS Documentation

Application. 1.1 About This Tutorial Tutorial Requirements Provided Files

Logi Ad Hoc Reporting Report Design Guide

User s Guide. BusinessObjects XI Release 2 Integration Kit for Baan

ORACLE BUSINESS INTELLIGENCE WORKSHOP

SAP BO 4.1 COURSE CONTENT

Query. Training and Participation Guide Financials 9.2

Oracle Business Intelligence Server Administration Guide. Version December 2006

8902 How to Generate Universes from SAP Sybase PowerDesigner. Revision:

Elisabetta Zodeiko 2/25/2012

Welcome to the topic on creating key performance indicators in SAP Business One, release 9.1 version for SAP HANA.

BI 4.1 Quick Start Guide

WebSphere Commerce V7 Feature Pack 2

The safer, easier way to help you pass any IT exams. SAP Certified Application Associate - SAP HANA 1.0. Title : Version : Demo 1 / 5

Microsoft Consulting Services. PerformancePoint Services for Project Server 2010

Creating Dashboards for Microsoft Project Server 2010

Oracle Application Express - Application Migration Workshop

Sage Intelligence Financial Reporting for Sage ERP X3 Version 6.5 Installation Guide

ReceivablesVision SM Getting Started Guide

SAP Crystal Reports for Enterprise Document Version: 4.0 Support Package SAP Crystal Reports for Enterprise User Guide

GOOGLE DOCS APPLICATION WORK WITH GOOGLE DOCUMENTS

Database Linker Tutorial

How To Create A Powerpoint Intelligence Report In A Pivot Table In A Powerpoints.Com

Informatica PowerCenter Express (Version 9.5.1) Getting Started Guide

SAP BusinessObjects Business Intelligence Platform Document Version: 4.1 Support Package Business Intelligence Launch Pad User Guide

Web Intelligence User Guide

Click to create a query in Design View. and click the Query Design button in the Queries group to create a new table in Design View.

WebSphere Business Monitor V6.2 Business space dashboards

MICROSOFT ACCESS 2003 TUTORIAL

HRS 750: UDW+ Ad Hoc Reports Training 2015 Version 1.1

SAP InfiniteInsight Explorer Analytical Data Management v7.0

Quick Start SAP Sybase IQ 16.0

Crystal Reports Installation Guide

Creating Hybrid Relational-Multidimensional Data Models using OBIEE and Essbase by Mark Rittman and Venkatakrishnan J

SAP HANA SPS 09 - What s New? Development Tools

Sitecore E-Commerce Cookbook

Transcription:

PUBLIC SAP HANA Platform SPS 11 Document Version: 1.1 2016-03-15

Content 1 Introduction to Modeling in the SAP HANA Web IDE.... 4 1.1 Modeling in Web-based Environments....4 2.... 6 2.1 Attributes and Measures....7 2.2 Create Graphical Calculation Views....8 Supported View Nodes for Modeling Calculation Views....9 Working With View Nodes....10 Create Joins....11 Create Unions....17 Filter Output of Aggregation or Projection View Nodes....21 2.3 Supported Data Categories for Calculation Views.... 22 2.4 Preview Calculation View Output....23 2.5 Working With Attributes and Measures....24 Create Counters....24 Create Calculated Columns.... 25 Extract and Copy Semantics From Underlying Data Sources....26 Create Input Parameters....27 Enable or Disable Attributes for Drilldown in Reporting Tools... 32 2.6 Working With Calculation View Properties....32 Invalidate Cached Content....33 Deprecate Calculation Views.... 34 Quick Reference: Calculation View Properties.... 35 2.7 Additional Functionality for Calculation Views....35 Trace View Objects with Data Lineage....36 Trace Dependent Objects to Analyze Impacts.... 37 Maintain Comments for Modeler Objects....37 Replacing Nodes and Data Sources....39 Using Functions in Expressions....41 2.8 Defining Data Access Privileges....49 Create SQL Analytic Privileges....50 3 Using Graphical Tools to Create CDS Artifacts....52 3.1 CDS Graphical Editor.... 52 3.2 Create a CDS Artifact....53 Supported Primitive Data Types....55 Native SAP HANA Data Types....57 2 2016 SAP SE or an SAP affiliate company. All rights reserved. Content

User-Defined Data Types....57 3.3 Create an Association in CDS.... 58 Content 2016 SAP SE or an SAP affiliate company. All rights reserved. 3

1 Introduction to Modeling in the SAP HANA Web IDE SAP Web IDE for SAP HANA is a comprehensive browser-based IDE for the development of complex applications comprised of web-based or mobile UIs, business logic, and extensive SAP HANA data models. Designed to support developers who use SAP HANA and XS Advanced, SAP Web IDE provides a variety of tools, such as syntax-aware editors for code and SAP HANA artifacts, graphical editors for CDS data models and calculation views, as well as inspection, testing and debugging tools. This guide describes two modeling scenarios that you can perform in the SAP Web IDE for SAP HANA. In the first scenario, you can use the graphical editor in the SAP Web IDE to refine or slice data in database tables by creating calculation views that depict a business scenario. You can use these graphical calculation views for any reporting and decision making purposes. In the other scenario, you can use the graphical editor in SAP Web IDE to create persistence models in core data services. The persistence model defines the schema, tables, sequences, and views that specify what data to make accessible for consumption by applications and how. In SAP Web IDE for SAP HANA, the persistence model is mapped to the consumption model that is exposed to client applications and users, so that data can be analyzed and displayed in the appropriate form in the client application interface. Who should read this guide This guide is intended for data modelers or business analyst or data analysts or application developers building database models or database experts involved in the processes of defining data models and schemas, database tables, information views, primary keys, indexes, partitions and all other aspects of layout and interrelationship of data in SAP HANA. The database developer is also concerned with designing and defining authorization and access control, through the specification of privileges, roles and users. 1.1 Modeling in Web-based Environments Web-based development environments provide data modelers with tools that enable access to repository and catalog objects from a remote location, for example, using a Web browser. SAP HANA Web workbench is a Web-browser based Integrated Development Environment that runs on SAP HANA Extended Application Services (SAP HANA XS). It offers data modelers and other user personas the modeling tools to work with SAP HANA content repository and SAP HANA database catalog objects, from a remote location. By using a browser, without requiring them to install any software locally, user can execute the data modeling tasks quickly and easily. 4 2016 SAP SE or an SAP affiliate company. All rights reserved. Introduction to Modeling in the SAP HANA Web IDE

Related Information Create Graphical Calculation Views [page 8] Using Graphical Tools to Create CDS Artifacts [page 52] Introduction to Modeling in the SAP HANA Web IDE 2016 SAP SE or an SAP affiliate company. All rights reserved. 5

2 Creating a Graphical Calculation View and Previewing its Output A calculation view is a powerful and flexible information view, which you can use to define more advanced slices on the data available in the SAP HANA database. The calculation views are simple and they mirror the functionality found in earlier attribute views and analytic views and much more. Calculation views consume various combinations of content data (that is, nonmetadata) to model a business use case. You can classify content data as: Attributes: Descriptive data - such as customer ID, city, and country. Measures: Quantifiable data - such as revenue, quantity sold and counters. Creating a calculation view involves simulation of entities (such as customer, product, sales and so on.) and their relationship. Data visualization and analysis applications such as SAP BusinessObjects Explorer and Microsoft Office based reporting tools consume these calculation views and helps decision makers in their decision process. You can create calculation views with layers of calculation logic, which includes measures sourced from multiple source tables, or advanced SQL logic, and so on. The data foundation of the calculation view can include any combination of tables, column views, attribute views and analytic views. You can create joins, unions, projections, and aggregation levels on data sources. Calculation views can include measures and be used for multidimensional reporting or can contain no measures and used for list-type reporting. The important characteristics of graphical calculation views are: Supports both OLAP and OLTP models. Supports complex expressions (i.e. IF, Case, Counter). Supports reusing Analytic views, Attribute views and other Calculation views (Graphical and Scripted). Supports analytic privileges (i.e. restricting a user for a certain cost center). Supports SAP ERP specific features (i.e. client handling, language, currency conversion). Provides ability to combine facts from multiple tables. Provides support for additional data processing operations, (i.e. Union, explicit aggregation). Provides ability to leverage specialized languages (i.e. R-Lang). Provides ability to leverage both Column and Row tables. Related Information Attributes and Measures [page 7] Create Graphical Calculation Views [page 8] 6 2016 SAP SE or an SAP affiliate company. All rights reserved.

2.1 Attributes and Measures Attributes and measures form content data that you use for data modeling. The attributes represent the descriptive data such as city and country and the measures represent quantifiable data such as revenue and quantity sold. Attributes Attributes are the individual non-measurable analytical elements. Table 1: Attributes Description Example Simple Attributes Calculated Attributes Simple attributes are individual nonmeasurable analytical elements that are derived from the data foundation. Calculated attributes are derived from one or more existing attributes or constants. For example, PRODUCT_ID and PRODUCT_NAME are attributes of a PRODUCT subject area. For example, deriving the full name of a customer (first and last name), assigning a constant value to an attribute that can be used for arithmetic calculations. Measures Measures are measurable analytical elements. Measures are derived from the analytic and calculation views. Table 2: Measures Description Example Simple Measures Calculated Measures Counters A simple measure is a measurable analytical element that is derived from the data foundation. Calculated measures are defined based on a combination of data from OLAP cubes, arithmetic operators, constants, and functions. Counters add a new measure to the calculation view definition to count the distinct occurrences of an attribute. For example, PROFIT. For example, you can use calculated measures to calculate the total sales of a product across five regions, or to assign a constant value to a measure for a calculation. For example, to count how many times product appears. Related Information Working With Attributes and Measures [page 24] 2016 SAP SE or an SAP affiliate company. All rights reserved. 7

2.2 Create Graphical Calculation Views Create graphical calculation views using a graphical editor to depict a complex business scenario with ease. You can create graphical calculation views to include layers of calculation logic and with measures from multiple data sources. Context Creating graphical calculation views is useful in bringing together normalized data that are generally dispersed. You can combine multiple transaction tables and analytic views, while creating a graphical calculation view. Procedure 1. Launch the SAP Web IDE for SAP HANA tool in a browser. 2. Select the module in which you want to create the graphical calculation view. 3. Browse to the src folder. 4. In the context menu, choose New Calculation View. 5. Enter details for the new calculation view. a. In the Name field, enter the name of the calculation view. b. In the Data Category dropdown list, select a value. 6. Choose Create. The tool launches a new graphical calculation view editor with a semantics node and default aggregation or projection node depending on the data category that you select for the calculation view. 7. Continue modeling the graphical calculation view by dragging and dropping the necessary view nodes from the tools pallet. 8. Add data sources. If you want to add data sources to the view node, then: a. Select a view node. b. Choose. c. In the Find Data Sources dialog, select the type of the data source. d. Enter the name of the data source and select it from the list. 9. Choose Ok. You can add one or more data sources depending on the selected view node. Note The find data sources dialog displays only tables and calculation views that are already activated. This means that, you can add only tables and calculation views as data sources in the view nodes. 8 2016 SAP SE or an SAP affiliate company. All rights reserved.

10. Define output columns. a. Select a view node. b. Select the Mapping tab. c. Select the column you want to add to the output. d. In the context menu, choose Add To Output. e. If you want to add all columns in a data source to the output, then from the context menu of the data source, select Add To Output. Note If you want to retrieve columns from the aggregation or projection nodes to the result set even if you do not request it in your query. In other words, if you want to include those columns into the SQL group by clause even if you do not select them in the query, then: 1. Select the Semantics node. 2. In the Columns tab, select the Keep Flag checkbox for the required attributes. 11. Define attributes and measures. If you are creating a calculation view with data category as cube, then to successfully activate the calculation view, you have to specify at least one column as a measure. a. Select the Semantics node. b. In the Columns tab, select a column value. c. In the Type dropdown list, select Measure or Attribute. If the data category is set to Cube, then an additional Aggregation column is available to specify the aggregation type for measures. Note Choose Save in the menu bar to save your calculation view. 12. Build an HDB 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 Build 2.2.1 Supported View Nodes for Modeling Calculation Views Considering the different business scenario and reporting uses cases, the SAP HANA modeler offers different view nodes to model graphical calculation views that helps you obtain the desired output. The table below lists the different view nodes and its description. 2016 SAP SE or an SAP affiliate company. All rights reserved. 9

Table 3: View Node Description Icon Example Union Join Use union node to combine the result set of two or more data sources. Union nodes have two or more inputs. Use join node to query data from two or more data sources, based on a specified condition. Join nodes have two inputs. For example, for retrieving the names of all employees of a store, which has different branches and each branch maintaining its own employee records table. For example, for retrieving customer details and location based on the postal code column present in the two tables CUSTOMER and GEOGRAPHY. The CUSTOMER table has columns Customer_ID, Customer_Name, Postal_Code, and GEOGRAPHY table has columns Postal_Code, Region, Country. Projection Use projection node to filter or obtain a subset of required columns of a table or an information view. Projection nodes have one input. For example, for selecting the employee name and employee department from a table consisting of many other columns. Aggregation Use aggregation node to summarize data for a group of row values, by calculating values in a column. Aggregation nodes have one input. For example, for retrieving total sales of a product in a month. The supported aggregation types are sum, min, and max. Note You can add data sources or unions or joins or projections or aggregations as inputs to union or join or projection or aggregation view nodes. Related Information Working With View Nodes [page 10] 2.2.2 Working With View Nodes View nodes form the building blocks of information views. These view nodes help you build complex, flexible and robust analytic models, and each view node type possess specialized capabilities that triggers advanced features in the database. This section describes the different views nodes that you can use within graphical calculation views, its functionalities and examples on how you can use these views nodes to model calculation views and obtain the desired output. 10 2016 SAP SE or an SAP affiliate company. All rights reserved.

Related Information Create Joins [page 11] Create Unions [page 17] Filter Output of Aggregation or Projection View Nodes [page 21] 2.2.3 Create Joins Use join nodes in calculation views to query data from two data sources. The join nodes help limit the number of records or to combine records from both the data sources, so that they appears as one record in the query results. Procedure 1. Open the required calculation view in view editor. 2. From the editor s tools palette, drag and drop a join node to the editor. 3. Add data sources. a. Select the join node. b. Choose. c. In the Find Data Sources dialog, enter the name of the data source and select it from the list. d. Choose OK. 4. Define output columns. a. Select the Mapping tab. b. Select the columns you want to add to the output of the join node. c. In the context menu, choose Add To Output. Note 5. Create a join. If you want to add all columns of a data source to the output, in the context menu of the data source, choose Add To Output. a. In the Join Definition tab, create a join by selecting a column from one data source, holding the mouse button down and dragging to a column in the other data source. b. Edit join properties. In the Properties section, define necessary join properties. 2016 SAP SE or an SAP affiliate company. All rights reserved. 11

Related Information Text Joins [page 12] Dynamic Joins [page 13] Optimize Join Execution [page 15] Join Properties [page 16] Supported Join Types [page 16] 2.2.3.1 Text Joins A text join helps obtain language-specific data. It retrieves the descriptions for a column from a text table based on the user s session language. The text tables contain description for a column value in different languages. For example, consider a PRODUCT table that contains PRODCUT_IDS and a text table PRODUCT_TEXT that contains the columns PRODUCT_IDS, DESCRIPTION and LANGUAGE. PRODUCT PRODUCT_ID SALES 1 1000 2 2000 3 4000 PRODUCT_TEXT PRODUCT_ID LANGUAGE DESC 1 EN Description in English. 1 DE Description in German. 2 EN Description in English. 3 EN Description in English. Create a text join to join the two tables and retrieve language-specific data using the language column, LANGUAGE. For example, if your session language is EN and if you have added all columns to the output of the join node, then the output of the join node is: PRODUCT_ID LANGUAGE DESC SALES 1 EN Description in English. 1000 2 EN Description in English. 2000 12 2016 SAP SE or an SAP affiliate company. All rights reserved.

PRODUCT_ID LANGUAGE DESC SALES 3 EN Description in English. 4000 Note For text joins, always add the text table as the right table. 2.2.3.2 Dynamic Joins After creating a join between two data sources, you can define the join property as dynamic. If you define a join as dynamic, then modeler dynamically defines the join condition columns based on the columns requested by the client query. Dynamic joins improves the join execution process and helps reduce the number of records that join node process at runtime. Note You can set the Dynamic Join property only if the two data sources are joined on multiple columns. The behavior of dynamic joins depends on the client query. This means that, you can improve the join execution process using the dynamic join property if at least one of the join elements is requested by the client query. Static Join Versus Dynamic Joins In static joins the join condition does not change irrespective of the client query. If a join is defined as dynamic, but if the query does request any of the join columns, it results in a query run-time error. This behavior of dynamic join is different from the static joins. Dynamic joins enforces the aggregation before executing the join, but for static joins the aggregation happens after the join. This means that, if a join column is not requested by the client query, its value is first aggregated and then the join condition is executed based columns requested in the client query. 2.2.3.2.1 Example: Dynamic Joins Consider that you want to evaluate the sales of a product and also calculate the sales share of each product using the below data sources. SALES 2016 SAP SE or an SAP affiliate company. All rights reserved. 13

REGION COUNTRY SALES APJ IND 10 APJ IND 10 APJ CHN 20 APJ CHN 50 EUR DE 50 EUR DE 100 EUR UK 20 EUR UK 30 PRODUCT REGION COUNTRY PRODUCT APJ IND PROD1 APJ IND PROD2 APJ CHN PROD1 APJ CHN PROD2 EUR DE PROD1 EUR DE PROD2 EUR UK PROD1 EUR UK PROD2 Consider a calculation view to join the above two data sources via two different aggregation nodes as inputs to the join node. The aggregation node with the data source SALES does not have the PRODUCT column and contains total sales of a given region or country. Now assume that the two aggregation nodes are joined dynamically on the columns, REGION and COUNTRY. The outputs of the join node are columns REGION, PRODUCT, SALES and the calculated columns, TOT_SALES, and SALES_SHARE. When you execute a client query on the calculation view to calculate the sales share of a product at region level, the output from the dynamic join and static join is as follows: Dynamic Join 14 2016 SAP SE or an SAP affiliate company. All rights reserved.

REGION PRODUCT SALES TOT_SALES SALES_SHARE APJ PROD1 30 90.33 APJ PROD2 60 90.66 EUR PROD1 70 200.35 EUR PROD2 130 200.65 Static Join REGION PRODUCT SALES TOT_SALES SALES_SHARE APJ PROD1 30 90.78 APJ PROD2 60 90 1.21 EUR PROD1 70 200.73 EUR PROD2 130 200 1.26 The dynamic join calculates the sales share at the region level by aggregating the sales values before joining the data sources. The static join, on the other hand, first calculates the sales share at the region level and the country level (because the join condition contains both region and country), and then aggregates the resulting sales share after the join is executed. 2.2.3.3 Optimize Join Execution While executing the join, by default, the query retrieves join columns from the database even if you do not specify it in the query. This means that, you are including those join columns into the SQL group by clause without you selecting them in the query. You can avoid this behavior of including the join columns into the SQL group by clause using the join property, Optimizing Join Columns. When this property for a join is set to True, the columns which are not specified in the query are not retrieved from the database. Note Optimizing join columns is supported only for left outer join or text join (with cardinality 1:1 or N:1) and right outer join (with cardinality 1:1 or 1:N). The join optimizer cannot remove attributes of static filters (if the filters are defined on join columns for which you have enabled Optimize Join Columns. In such cases, you can optimize the join column by introducing a dummy projection node between the join and the input node with static filters. 2016 SAP SE or an SAP affiliate company. All rights reserved. 15

2.2.3.4 Join Properties After creating a join, define its properties to obtain a desired output when you execute the join. SAP HANA modeler allows you to define the following join properties. Join Properties Description Join Type Cardinality The value of this property specifies the join type used for creating a join. For more information, see Supported Join Types. The value of this property specifies the cardinality used for creating a join. By default, the cardinality of the join is empty. If you are not sure about the right cardinality for the join tables, it is recommended to not specify any cardinality. Modeler determines the cardinality when executing the join. Language Column Dynamic Join Optimize Join Columns The value of this property specifies the langue column that modeler must use for executing text joins. For more information, see Text Joins. The value of this property determines whether modeler must dynamically define the columns of the join condition based on the client query. For more information, see Dynamic Joins. The value of this property determines whether modeler must retrieve the columns that are not specified in the query from the database. For more information, see Optimize Join Execution. 2.2.3.5 Supported Join Types When creating a join between two tables, you specify the join type. The below table lists the supported join types in SAP HANA modeler. Table 4: Join Type Inner Left Outer Right Outer Text Join Description This join type returns all rows when there is at least one match in both the database tables. This join type returns all rows from the left table, and the matched rows from the right table. This join type returns all rows from the right table, and the matched rows from the left table. This join type is used to obtain language-specific data from the text tables using a language column. 16 2016 SAP SE or an SAP affiliate company. All rights reserved.

2.2.4 Create Unions Use union nodes in calculation views to combine the results of two or more data sources. Context A union node combines multiple data sources, which can have multiple columns. You can manage the output of a union node by mapping the source columns to the output columns or by creating a target output column with constant values. For a source column that does not have a mapping with any of the output columns, you can create a target output column and map it to the unmapped source columns. Procedure 1. Open the required calculation view in view editor. 2. From the editor s tools palette, drag and drop a union node to the editor. 3. Add data sources. a. Select the union node. b. Choose. c. In the Find Data Sources dialog, enter the name of the data source and select it from the list. d. Choose OK. 4. Define output columns. a. Select the Mapping pane. b. Select the columns you want to add to the output of the union node. c. In the context menu, choose Add To Output. Note If you want to add all columns from the data source to the output, in the context menu of the data source, choose Add To Output. 5. Assign constant value. This helps to denote the underlying data of the source columns with constant values in the output. If you want to assign a constant value to any of the target columns, then a. In the Output Columns section, select an output column. b. In the context menu, choose Manage Mappings. c. In the Manage Mappings section, set the Source Column value as blank. d. In the Constant Value field, enter a constant value. e. Choose OK. 2016 SAP SE or an SAP affiliate company. All rights reserved. 17

6. Create a constant output column. If you want to create a new output column and assign a constant value to it, then a. In the Output Columns section, choose. b. In the Create Target and Manage Mapping dialog, provide name and data type for the new output column. c. Choose OK. Note By default, the value of the constant output column in null. Related Information Example: Constant Columns [page 18] Empty Union Behavior [page 19] 2.2.4.1 Example: Constant Columns Constant output columns help denote the underlying data from the source columns with constant values in the output. You can also map the unmapped source columns to a constant output column based on the business requirement. For example, consider a business scenario where you want to compare the planned sales of each quantity with its actual sales using the two data sources with similar structures, the ACTUALSALES and the PLANNEDSALES. ACTUALSALES SALES_QUANTITY PRODUCT_ID 5000 P1 3000 P2 PLANNEDSALES SALES_QUANTITY PRODUCT_ID 4000 P1 4000 P2 When you use a union node to combine the results of the two data sources, you cannot differentiate the data from these data source. 18 2016 SAP SE or an SAP affiliate company. All rights reserved.

SALES_QUANTITY PRODUCT_ID 5000 P1 3000 P2 4000 P1 4000 P2 In such cases, create a constant output column PLANNEDORACTUAL and assign the constant value ACTUAL to ACTUALSALES and the constant value PLANNED to PLANNEDSALES. SALES_QUANTITY PRODUCT_ID PLANNEDORACTUAL 5000 P1 ACTUAL 3000 P2 ACTUAL 4000 P1 PLANNED 4000 P2 PLANNED This means that, you can identify the data source and its underlying data with constant values in the output. Related Information Create Unions [page 17] 2.2.4.2 Empty Union Behavior The value of the Empty Union Behavior property for a data source in the union node, helps modeler determine whether any queries on union nodes with constant output columns shall return values if no other columns from the data source is queried. This property is useful, for example, for value help queries in applications. You can select either No Row or Row with Constant as values for the Empty Union Behavior property. Select the data source in the mapping definition and in the Properties tab define the values for this property based on your business requirement. 2016 SAP SE or an SAP affiliate company. All rights reserved. 19

For understanding the Empty Union Behavior property and how the value this property determines the output data, consider the following mapping definition in a union node: Constant values A and B are defined for Projection_1 and Projection_2 using the constant column CONSTANT. When you execute a query on calculation view with this union node, and if the column CUSTOMER_ID is not queried, the Empty Union Behavior property for the Projection_2 data source determines whether the constant column CONSTANT returns the constant value A for Projection_2 in the output. If the Empty Union Behavior property is set to No Row, no data from Projection _2 appears in the output data. In the other words, only data from Projection_1 appears in the output data. If the Empty Union Behavior property is set to Row with Constant, then the output data includes one record from Projection _2. In this one record, the constant value A appears for the CONSTANT column and values for all other columns appears as null. 20 2016 SAP SE or an SAP affiliate company. All rights reserved.

2.2.5 Filter Output of Aggregation or Projection View Nodes Apply filters on columns of projection or aggregation view nodes (except the default aggregation or projection node) to filter the output of these nodes. Context You apply filters, for example, to retrieve the sales of a product where (revenue >= 100 AND region = India) OR (revenue >=50 AND region = Germany). You can also define filters using nested or complex expressions. Filters on columns are equivalent to the HAVING clause of SQL. At runtime, the system executes the filters after performing all the operations that you have defined in the aggregation or projection or data foundation nodes. You can also use input parameters to provide values to filters at runtime. Note Use the expression editor to define filters on columns. You can use the column engine language or the SQL language to define the filter expression. Procedure 1. Open the calculation view in the editor. 2. Select a projection or aggregation node. Note You cannot apply filter on columns of default projection or default aggregation views nodes of calculation views. 3. Select the Filter Expression tab 4. Select the expression langauge in the dropdown list. 5. In the expression editor, enter the expression that defines the filter conditions. For example, (revenue >= 100 AND region = India) OR (revenue >=50 AND region = Germany). 2016 SAP SE or an SAP affiliate company. All rights reserved. 21

2.3 Supported Data Categories for Calculation Views Modeler supports two types of data categories to classify calculation views. The table below provides more information on each of these data category types. Table 5: Data Category Cube Description Calculation views with data categories as Cube are visible to the reporting tools and supports data analysis with multidimensional reporting. For graphical calculation views with data category as Cube, modeler provides aggregation as the default view node. Also, an additional aggregation column behavior is available that you can use to specify the aggregation types for measures. Dimension Calculation views with data categories as Dimension are not visible to the reporting tools and does not support data analysis. However, you can use these calculation views as data sources in other calculation views, which have data category as Cube, for any multidimensional reporting purposes. If the data category is Dimension, you cannot create measures. You can only consume them with SQL. For example, you use such calculation views to fill simple list user interfaces, where recurring attribute values are not a problem, but are desired. The output node offers only attributes of numerical data types. For graphical calculation views with data category as Dimension, modeler provides projection as the default view node. Default Calculation views with data categories as Default are not visible to the reporting tools and do not support multidimensional reporting. However, you can use these calculation views as data sources in other calculation views, which have data category as Cube, for any multidimensional reporting purposes. For graphical calculation views with data category as Default, modeler provides projection as the default view node. Related Information Create Graphical Calculation Views [page 8] 22 2016 SAP SE or an SAP affiliate company. All rights reserved.

2.4 Preview Calculation View Output After modeling calculation views based on your requirements, deploy them to preview and analyze its output. You can also view the SQL query that modeler generates for the deployed calculation view. Context You can preview the output of a calculation view in tabular format. In addition, you can also export and download the output data to.csv files. Procedure 1. Launch the SAP Web IDE for SAP HANA tool in a browser. 2. In the navigation pane, select the calculation view for which you want to preview the output. 3. In the context menu, choose Data Preview. The tool launches a new window in the browser in which you can preview the data output. 4. Provide input parameter value. If you have created any input parameters in the calculation view, the default value for the input parameters is displayed. If you have not defined any default value for the input parameter, a. Select the operator. b. Define the From and To fields based on the selected operator. c. Choose. d. Select Open Content. The tool displays the output data in tabular format. If your calculation view does not contain any input parameters, the tool displays the output data when it launched in the new window. 5. Apply filters. a. If you want to apply filters on columns to view filtered data, choose. b. Choose Add Filters. c. Choose a column and define filter conditions. 6. Export output data. If you want to export the raw data output to a.csv file, choose. 7. View SQL query for the calculation view. a. If you want to view the SQL query that modeler generates for the deployed calculation view, choose. 2016 SAP SE or an SAP affiliate company. All rights reserved. 23

2.5 Working With Attributes and Measures Attributes and measures form content data that you use for data modeling. The attributes represent the descriptive data such as city and country and the measures represent quantifiable data such as revenue and quantity sold. Calculation views can contain two types of columns, the measures and the attributes. Measures are columns for which you define an aggregation. If information views are used in SQL statements, then you have to aggregate the measures, for example, using the SQL functions SUM(<column name>), MIN(<column name>), or MAX(<column name>. Attributes can be handled as regular columns as they do not need to be aggregated. This section describes the different operations you can perform using the attributes and measures. For example, you can create calculated attributes or calculated measures. Related Information Create Counters [page 24] Create Calculated Columns [page 25] Extract and Copy Semantics From Underlying Data Sources [page 26] Create Input Parameters [page 27] Enable or Disable Attributes for Drilldown in Reporting Tools [page 32] 2.5.1 Create Counters If you want to count the number of distinct values for one or more attribute columns, you create counters, which are special type of columns that displays the distinct count of attribute columns. Procedure 1. Open the calculation view in the view editor. 2. Select the default aggregation node. Note You can create counters for attribute columns in the default aggregation view node only. 3. Choose the Calculated Column/Counters tab. 4. Choose. 5. Select Counter. 6. In the General section, provide name and description for the new counter. 24 2016 SAP SE or an SAP affiliate company. All rights reserved.

7. If you want to hide the counter for data preview, then select Hidden. 8. In the Counter section, choose. 9. In the dropdown list, choose an attribute column. Note You can create counters for multiple attribute columns at a time. For example, if you create a counter for two columns, then the counter displays the count of distinct combinations of both the columns. 2.5.2 Create Calculated Columns Create new output columns and calculate its values at runtime based on the result of an expression. You can use other column values, functions, input parameters or constants in the expression. Context For example, you can create a calculated column DISCOUNT using the expression if("product" = 'NOTEBOOK', "DISCOUNT" * 0.10, "DISCOUNT"). In this sample expression, you use the function if(), the column PRODUCT and operator * to obtain values for the calculated column DISCOUNT. Procedure 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. Choose the Calculated Columns tab. 4. Choose. 5. In the General section, enter a name and description for the new calculated column. 6. In the Data Type dropdown list, select the data type for the calculated column. 7. Enter length and scale based on the selected data type. 8. Define calculated columns semantics In the Semantics section, provide semantics information for the new calculated column. You can create calculated attributes or calculated measures using attributes or measures respectively. a. In the Column Type dropdown list, select a value. b. If you want to create a calculated measure and enable client side aggregation for the calculated measure, select Enable client side aggregation. 2016 SAP SE or an SAP affiliate company. All rights reserved. 25

Note After selecting the checkbox, in the Aggregation Type dropdown list, select an aggregation type that client needs to perform on calculated measures. c. Drilldown calculated attributes in reporting tools By default, modeler allows you to drilldown calculated attributes in reporting tools. If you want to disable the drilldown property, in the Drill Down dropdown list, set the value to blank. 9. 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. Select the language you want to use to create the expression. c. In the expression editor enter a valid expression. Modeler 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 ABC then DISCOUNT equals to DISCOUNT multiplied by 0.10 should be returned. Else use the original value of the attribute DISCOUNT. Note You can also drag and drop the expression elements, operators and functions from the menus to the editor and create expressions. d. Choose Back. 2.5.3 Extract and Copy Semantics From Underlying Data Sources Defining semantics for calculation views includes defining the output columns of the calculation views and its aggregation type. While defining the semantics for a calculation view, you can extract and copy the semantic definitions of columns from their underlying data sources. Context For example, consider that you are modeling a complex calculation view with multiple underlying data sources and these data source have their own semantic definitions for its columns. In such cases, you can extract and copy the semantic definitions of columns from their underlying data sources to define the semantics of the calculation view. This way of extracting and copying the semantic definitions helps you save the effort of manually defining the semantics of the calculation view. 26 2016 SAP SE or an SAP affiliate company. All rights reserved.

Note You can currently extract and copy only the aggregation types of underlying columns to the semantic definition. Procedure 1. Open the required calculation view in view editor. 2. Select the Semantics node. 3. Choose the Columns tab. 4. Choose. In the Extract Semantics dialog, modeler displays the output columns from the underlying data sources. 5. Select the columns. By default, the column property Aggregation Type is checked. This means that, the aggregation types of selected columns are extracted to the semantic definition of the calculation view. 6. If you want to override the existing semantic definition of the calculation view with the extracted semantics, select Overwrite semantics already defined. 7. Choose Ok. 2.5.4 Create Input Parameters Input parameters helps you parameterize information views and execute them based on the values you provide to the input parameters at query runtime. The engine considers input parameters as the PLACEHOLDER clause of the SQL statement. Context You create an input parameter at design time (while creating your information views), and provide value to the engine at runtime and execute information views accordingly. For example, if you want your information view to provide data for a specific region, then REGION is a possible input parameter. You can provide value to REGION at runtime. Procedure 1. Open the required calculation view in the view editor. 2016 SAP SE or an SAP affiliate company. All rights reserved. 27

2. Select a view node in which you want to create the input parameter. 3. Choose the Parameters tab. 4. Choose. 5. Select Input Parameter. 6. Maintain input parameter details a. In the General section, provide the input parameter name and description. a. If you want to configure the input parameter to mandatorily accept a value at runtime, then select the Is Mandatory checkbox. b. If you want to configure the input parameter to accept multiple values at runtime, then select the Multiple Entries checkbox. For example, you can create input parameter to identify the revenue for the period 2000 to 2005 and 2012, at runtime. 7. Define input parameter type. a. In the Parameter Type dropdown list, select an input parameter type. Table 6: Input Parameter Type Description Next Steps Column At runtime, modeler provides a value help with attribute data. You can choose a value from the attribute data as an input parameter value. a. If you want to use attribute data from another calculation view as the reference column, in the View/Table for value help dropdown list, select the information view that contains the required attribute. b. In the Reference Column dropdown list, select an attribute. Direct Specify the data type and length and scale of the input parameter value that you want to use at runtime. You can also define an input parameter with semantic type as Currency or Unit of Measure or Date. For example, in currency conversions, you can specify the target currency value at run time by creating an input parameter of type Direct with semantic type as Currency. b. In the Data Type dropdown list, select the data type. c. Provide the Length and Scale for the data type you choose. a. Optionally, In the Semantic Type dropdown list, specify the semantic type for you input parameter. 8. Provide default values Provide a default value that modeler must consider as the input parameter value if no value is provided to the input parameter at runtime. a. In the Default Value section, provide default values using constant values or expressions. You cannot use a combination of expressions and constants as default values for input parameters. 28 2016 SAP SE or an SAP affiliate company. All rights reserved.

Table 7: Default Value Constant Meaning If you want to use a constant value as the default input parameter value, 1. In the Default Value section, choose. 2. In Type dropdown list section, select Constant. 3. In Value field, 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: 1. In the Default Value section, choose the add icon. 2. In Type dropdown list section, select Expression. 3. In the Value field, choose the value help to open the expression editor. 4. In the Expression Editor, enter a valid expression. 5. Choose Validate Syntax. 6. Choose Back.. For example, you can evaluate the expression date(now()), and use the result as the default input parameter value at runtime. Note Providing multiple default constant values. If you have configured 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 section, choose the add icon to add multiple default constant values. These values appear on the selection screen when you execute the calculation view. Related Information Map Input Parameters [page 30] Input Parameters [page 31] 2016 SAP SE or an SAP affiliate company. All rights reserved. 29

2.5.4.1 Map Input Parameters If you are modeling calculation views on top of other calculation view that have input parameters defined for it, then you can map the input parameters or variables of the underlying data sources with the input parameters of calculation views that you are modeling. Context Mapping parameters of the current view to the parameters of the underlying data sources, moves the filters down to the underlying data sources during runtime, which reduces the amount of data transferred across them. Note Only if the input parameters are used in the dependent data sources, they are available for mapping. Procedure 1. Open the required calculation view in the editor. 2. Select Semantics node. 3. Choose the Parameters tab. 4. Choose. 5. Manage mappings for the source and target s input parameters by selecting a value from the source, holding the mouse button down and dragging to a value in the target. 6. If you want auto-map based on the source and target input parameter names, then: a. In the toolbar, choose. Note If you are using auto-map, then for mapping all unmapped parameters at the source, the system creates input parameters with same name at the target. 7. If you want to create a constant value at the target calculation view, then: a. Select Create Constant. b. Enter constant value. c. Choose OK. 30 2016 SAP SE or an SAP affiliate company. All rights reserved.

Related Information Create Input Parameters [page 27] Input Parameters [page 31] 2.5.4.2 Input Parameters You use input parameters to define internal parameterization of the view. Input parameters used in the views enables you to obtain a desired functionality when the view is executed. This means that the engine needs to know and use the parameter value during the view execution for example, to calculate a formula for a calculated measure. The parameter value is passed to the engine via the PLACEHOLDER clause of the SQL statement. Normally a parameter can only have a single value, for example, for currency conversion. However, when working with the in() function in filter expressions of the calculation views you can pass several values as an IN List. The quoting must be followed as shown below: For numerical type parameters The filter expression of a calculation view CV1 is defined as: in("attr", $$param$$) Then you need to pass several values as: select... from CV1( 'PLACEHOLDER' = ('$$var$$' = 'VAL1,VAL2,VAL3') For string type parameters The filter expression of a calculation view CV1 is defined as: in("attr", $$param$$) Then you need to pass several values (with double quotes) as: select... from CV1( 'PLACEHOLDER' = ('$$var$$' = '''VAL1'',''VAL2'',''VAL3''') You use input parameters as placeholders during currency conversion, unit of measure conversion and formulas like calculated columns in an analytic view and a calculation view. When used in formulas, the calculation of the formula is based on the input that you provide at runtime during data preview. In calculation view, you can additionally use these input parameters in the script node. You can apply input parameters in analytic and calculation views. If a calculation view is created using an analytic view with input parameters, those input parameters are also available in the calculation view. Each type of input parameter is either mandatory or non-mandatory. Mandatory in the view model means semantically mandatory that is, the data might be inconsistent if the parameter value is not provided because for instance data is then aggregated across clients. From the engine point of view the parameter is technically mandatory that is, if no default value is provided (which means a value has to be provided by the caller). Therefore, irrespective of the parameter being set as mandatory or not, if a default value is not set for the parameter, and it is mandatory to provide a value at runtime. The expected behavior of the input parameter when a value at runtime is not provided is as follows: 2016 SAP SE or an SAP affiliate company. All rights reserved. 31

Table 8: Default Value Yes No Expected Behavior Calculates the formula based on the default value Results in error The table above implies that it is mandatory to provide a value for the input parameter either at runtime or assign a default value while creation, otherwise, it leads to errors. Note You can also check whether an input parameter is mandatory or not from the properties of the input parameter in the Properties pane. 2.5.5 Enable or Disable Attributes for Drilldown in Reporting Tools By default, the modeler allows you to drilldown 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. Select an attribute. 4. 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. 2.6 Working With Calculation View Properties While modeling calculation views, you can define certain properties for the calculation views. The modeler refers to the values of these properties, for example, to access the data from the database or identify how to execute the calculation view and so on. This section describes the important calculation view properties, the possible values for each property and how these values help modeler determine the activation or execution behavior of the calculation view. For defining the view properties, select the Semantics node and define the properties in the View Properties tab. 32 2016 SAP SE or an SAP affiliate company. All rights reserved.

Related Information Invalidate Cached Content [page 33] Deprecate Calculation Views [page 34] Quick Reference: Calculation View Properties [page 35] 2.6.1 Invalidate Cached Content In order to maintain the significance of the cached data for your calculation views, modeler supports timebased cache invalidation. The system invalidates or removes the data from the cache after specific time intervals. Prerequisites You have enabled caching support for your SAP HANA system. Context Time based cache invalidation is necessary to refresh data after every specific time period. By default, the cache invalidation period is null. This means, the result of the complex query that you execute resides in the cache until you execute the next query. Similarly, if you set your cache invalidation period as one hour, the result of the query resides in the cache for one hour, and system does not clear the cache for all other queries that you execute until this time period. 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. Choose View Properties tab. 3. In the Cache Invalidation dropdown list, select a time interval. 2016 SAP SE or an SAP affiliate company. All rights reserved. 33

Related Information Enable Cache Invalidation [page 34] 2.6.1.1 Enable Cache Invalidation Enable time-based cache invalidation for your SAP HANA system to invalidate or remove data from the cache after specific time intervals. Context You enable cache invalidation on your SAP HANA sytem. Procedure 1. In Systems view, double click your SAP HANA system. 2. Under Configuration tab, navigate to indexserver.ini cache. 3. Set the property resultcache_enabled toyes. 2.6.2 Deprecate Calculation Views Deprecated Calculation views signifies that although a calculation view is supported within a modeler, it is not recommended to use it in other calculation views or in analytic privileges. Context As a data modeler, you can deprecate calculation views, which you do not recommend for use in other calculation views for various reasons based on your business requirement. Procedure 1. Open the required calculation view in the view editor. 2. Select the Semantics node. 34 2016 SAP SE or an SAP affiliate company. All rights reserved.

3. In the View Properties tab, select the Deprecate checkbox. Results Modeler 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. 2.6.3 Quick Reference: Calculation View Properties While modeling a calculation view, you can define value for calculation view peoperties that determines the behavior of the calculation view at the runtime. When you are modeling calculation views, you can define the following properties in the View Properties tab of the Semantics node. Table 9: Properties Data Category Apply Privileges Default Member Execute In Cache Invalidation Period Description 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 [page 22]. The value of this property specifies the analytic privilege type selected for data access restrictions on the calculation view. For more information, see Defining Data Access Privileges [page 49]. This value of this property helps modeler identify the default member for all hierarchies in the calculation views. The value of this property impacts the output data. It determines whether modeler must execute the calculation view in SQL engine or column engine. For more information see SAP Note 1857202. 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 [page 33]. 2.7 Additional Functionality for Calculation Views After modeling calculation views or during design time itself you can perform certain additional functions to improve the efficiently of modeling calculation views. This section describes the different additional functions that modeler offers and how you can use these functions to efficiently model views. 2016 SAP SE or an SAP affiliate company. All rights reserved. 35

Related Information Trace View Objects with Data Lineage [page 36] Trace Dependent Objects to Analyze Impacts [page 37] Maintain Comments for Modeler Objects [page 37] Replacing Nodes and Data Sources [page 39] Using Functions in Expressions [page 41] 2.7.1 Trace View Objects with Data Lineage Data lineage in modeler helps visualize the source for objects such as the measures, attributes, tables and other views used within a calculation view. With data lineage, you can essentially identify from where the calculation view gets its data from. Context You use data lineage to visualize the flow of an object within a calculation view. It is useful, for example, to analyze impact, to trace errors and to debug errors. Modeler supports two scenarios for data lineage. In the first scenario, you can view the flow 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 within a calculation view. Procedure 1. Trace columns in calculation view. a. Launch the SAP Web IDE for SAP HANA tool. b. In the navigation pane, select the required calculation views. c. In the context menu, choose Open With Calculation View Editor. d. Select the Semantics node. e. Choose the Columns tab. f. Select a column you want to trace. g. Choose. In the view editor, the tool highlights the selected column, its data source and the flow of the column from its data source to the Semantics node. 2. Trace source of all data sources within the calculation view. a. Launch the SAP Web IDE tool for SAP HANA. b. In the navigation pane, select the required calculation views. c. In the context menu, choose Data Lineage. 36 2016 SAP SE or an SAP affiliate company. All rights reserved.

In a new tab, the tool launches a new editor. You use the editor to trace data sources within the calculation view. If a data source is further derived from another data source, use the collapse and expand buttons for each such data source to view its next level of data source. 2.7.2 Trace Dependent Objects to Analyze Impacts Modifying a calculation view can impact other calculation views that are modeled on top of this view. It is necessary to identify all such dependent objects before making any changes within the view. Context You analyze impacts at the view level. Modeler helps 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. Launch the SAP Web IDE for SAP HANA tool. 2. In the navigation pane, select the required calculation view. 3. In the context menu, choose Impact Analysis. In a new tab, the tool launches a new 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. 2.7.3 Maintain Comments for Modeler 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 so on. The comments can include, for example, information that provides more clarity on the calculation view or its objects for data modelers accessing the same view or its objects. Context Maintaining comments helps your store more information related to the calculation view or to store and provide reference information for other data modelers working on the same calculation view. You can also use the comments for documentation purposes. 2016 SAP SE or an SAP affiliate company. All rights reserved. 37

Columns in the semantics node View Node Input Parameters Calculated columns in underlying view nodes Note Translating comments that you maintain for the modeler objects is not supported. Procedure 1. Launch the SAP HANA Web IDE in a browser. 2. Open the calculation view for which you want to maintain comments in view editor. 3. Maintain comments for the calculation view at the view level. a. Select the Semantics node. b. Choose the View Properties tab. c. In the General section, choose. d. Enter a new comment or edit an existing comment. 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. Choose. e. Enter a new comment or edit an existing comment. 5. Maintain comments for view nodes. a. Select the view node other than the Semantics node and the default view nodes. b. Choose. c. Enter a new comment or edit an existing comment. 6. Maintain comments for input parameters 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. Choose. e. Enter a new comment or edit an existing comment. 7. Maintain comments for calculated columns. a. Select a view node with a calculated column. b. Choose the Calculated Columns tab. c. Select a calculated column for which you want to maintain comments. d. Choose. 38 2016 SAP SE or an SAP affiliate company. All rights reserved.

e. Enter a new comment or edit an existing comment. 2.7.4 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. Related Information Replace a View Node in Calculation Views [page 39] Replace a Data Source in Calculation Views [page 40] 2.7.4.1 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 below calculation view, if you want to replace the node Union_1 with the node, Projection_1, then you can do it by executing the below procedure. 2016 SAP SE or an SAP affiliate company. All rights reserved. 39

Procedure 1. Open required calculation view in 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, select a view node that you want use for replacing. 5. Manage the source and target mappings accordingly. Note You need to delete all unmapped target columns and references. 6. If you want to remove the node from the column view, select Delete the node after replace. If you do not select this checkbox, the view node appears as an orphan node in the column view. 7. Choose Finish. 2.7.4.2 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. Context For example, in the below 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 below procedure. 40 2016 SAP SE or an SAP affiliate company. All rights reserved.

Procedure 1. Open required calculation view in 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. 4. In the Find Data Sources dialog, 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. 2.7.5 Using Functions in Expressions This section describes the functions, which you can use while creating expressions for calculated attributes and calculated measures. Related Information Conversion Functions [page 41] String Functions [page 43] Mathematical Functions [page 46] Date Functions [page 46] Miscellaneous Functions [page 48] 2.7.5.1 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) float float float(arg) convert arg to float type float(3.0) double double double (arg) convert arg to double type double(3) sdfloat sdfloat sdfloat (arg) convert arg to sdfloat type 2016 SAP SE or an SAP affiliate company. All rights reserved. 41

Function Syntax Purpose Example decfloat decfloat decfloat (arg) convert arg to decfloat type fixed fixed fixed (arg, int, int) arg2 and arg3 are the intdigits and fractdigits parameters, respectively. Convert arg to a fixed type of either 8, 12, or 16 byte length, depending on intdigits and fractdigits fixed(3.2, 8, 2) + fixed(2.3, 8, 3) string string string (arg) convert arg to string type raw raw raw (arg) convert arg to raw type date date date(stringarg) date date(fixedarg) date date(int, int) date date(int, int, int) date date(int, int, int, int) date date(int, int, int, int, int) date date(int, int, int, int, int, int) convert arg to date type. The first version parses a string in the format "yyyy-mm-dd hh:mi:ss" where trailing components except for the year may be omitted. The version with one fixed number arg strips digits behind the comma and tries to make a date from the rest. The other versions accept the individual components to be set. date(2009) -> date('2009') date(2009, 1, 2) -> date('2009-01-02') date(fixed(2000020313502 6.1234567, 10, 4)) -> date('2000-02-03 13:50:26') longdate longdate longdate(stringarg) longdate longdate(fixedarg) longdate longdate(int, int, int) longdate longdate(int, int, int, int, int) convert arg to longdate type, similar to date function above. longdate(fixed(2000020313 5026.1234567, 10, 5)) -> longdate('2000-02-03 13:50:26.1234500') longdate(2011, 3, 16, 9, 48, 12, 1234567) -> longdate('2011-03-16 09:48:12.1234567') longdate longdate(int, int, int, int, int, int) longdate longdate(int, int, int, int, int, int, int) time time time(stringarg) time time(fixedarg) convert arg to time type, similar to date function above time time(int, int) time time(int, int, int) seconddate seconddate(string) Convert to seconddate. One stringargs is a string with default parsing; two 42 2016 SAP SE or an SAP affiliate company. All rights reserved.

Function Syntax Purpose Example secondtime seconddate(int, int, int, int, int, int) secondtime(string) secondtime(string, string) secondtime(int, int, int) stringargs is a format string in the second arg, numeric args are the date components. Converto to secondtime. 2.7.5.2 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 midstr int strlen(string) string midstr(string, int, int) Returns the length of a string in bytes, as an integer number. Returns a part of the string starting at arg2, arg3 bytes long. arg2 is counted from 1 (not 0). midstru leftstr rightstr string midstru(string, int) string midstru(string, int, int) string leftstr(string, int) string rightstr(string, int) Returns a part of the string starting at character or surrugate arg2, arg3 characters or surrogates long. Returns arg2 bytes from the left of the arg1. If arg1 is shorter than the value of arg2, the complete string will be returned. Returns arg2 bytes from the right of the arg1. If arg1 is shorter than the value of arg2, the complete string will be returned. rightsru string rightstru(string, int) return arg2 characters from the right of string. If arg1 is shorter than arg2 characters, the complete string will be returned. instr int instr(string, string) Returns the position of the first occurrence of the second string within the first string (> 2016 SAP SE or an SAP affiliate company. All rights reserved. 43

Function Syntax Purpose = 1) or 0, if the second string is not contained in the first. instru int instru(string, string) return the character position of the first occurrence of the second string within the first string (>= 1) or 0, if the second string is not contained in the first. This assumes inputs to be unicode expressed in utf-8, if the input is not encoded this way, the result will be less meaningful. hextoraw rawtohex ltrim rtrim trim lpad string hextoraw(string) string rawtohex(string) string ltrim(string) string ltrim(string, string) string rtrim(string) string rtrim(string, string) string trim(string) string trim(string, string) string lpad(string, int) string lpad(string, int, string) Convert a hexadecimal representation of bytes to a string of bytes. The hexadecimal string may contain 0-9, upper or lowercase a-f and no spaces between the two digits of a byte; spaces between bytes are allowed. convert a string of bytes to its hexadecimal representation. The output will contain only 0-9 and (upper case) A-F, no spaces and is twice as many bytes as the original string. removes a whitespace prefix from a string. The Whitespace characters may be specified in an optional argument. This functions operates on raw bytes of the UTF8-string and has no knowledge of multi byte codes (you may not specify multi byte whitespace characters). removes trailing whitespace from a string. The Whitespace characters may be specified in an optional argument. This functions operates on raw bytes of the UTF8-string and has no knowledge of multi byte codes (you may not specify multi byte whitespace characters). removes whitespace from the beginning and end of a string. add whitespace to the left of a string. A second string argument specifies the whitespace which will be added repeatedly until the string has reached 44 2016 SAP SE or an SAP affiliate company. All rights reserved.

Function Syntax Purpose the intended length. If no second string argument is specified, chr(32) (' ') gets added. This function operated on UTF-8 bytes and has no knowledge of unicode characters (neither for the whitespace string nor for length computation). rpad replace string rpad(string, int) string rpad(string, int, string) string replace(string, string, string) add whitespace to the end of a string. A second string argument specifies the whitespace which will be added repeatedly until the string has reached the intended length. If no second string argument is specified, chr(32) (' ') gets added. This function operated on UTF-8 bytes and has no knowledge of unicode characters (neither for the whitespace string nor for length computation). replace every occurrence of arg2 in arg1 with arg3 and return the resulting string upper string 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. lower string 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. rightstru string rightstru(string, int) return arg2 characters from the right of string. If arg1 is shorter than arg2 characters, the complete string will be returned. chars chars(string) return the number of characters in a string. This returns the number of characters in a UTF-8 encoded string. In a CESU-8 encoded string, it will return the number of 16-bit words of that string if it were encoded if UTF-16. charpos charpos(string, int) return the position of the nth character in a string (n starting with 1). The string is interpreted as UTF-8 as it is in the chars() function above. 2016 SAP SE or an SAP affiliate company. All rights reserved. 45

2.7.5.3 Mathematical Functions Scalar math functions perform a calculation, usually based on input values that are provided as arguments, and return a numeric value. Function Syntax Purpose Example sign int sign(double) int sign(time) int sign(date) Sign returns -1, 0 or 1 depending on the sign of its argument. Sign is implemented for all numeric types, date and time. abs double abs(double) decfloat abs(decfloat) decfloat abs(decfloat) Abs returns arg, if arg is positive or zero, -arg else. Abs is implemented for all numeric types and time. time abs(time) round double round(double, int) Round does rounding of absolute values toward zero while the sign is retained round(123.456, 0) = 123 round(123.456, 1) = 123.5 round(-123.456, 1) = -123.5 round(123.456, -1) = 120 rounddown double rounddown(double, int) Rounddown rounds toward negative infinity making rounddown(-1.1, 0) = -2 rounddown(123.456, -1) = 120 rounddown(-123.456, -1) = -130 2.7.5.4 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 localtoutc weekday utctolocal(datearg, timezonearg) localtoutc(datearg, timezonearg) weekday(date) Interprets datearg (a date, without timezone) as utc and convert it to the timezone named by timezonearg (a string) Converts the local datetime datearg to the timezone specified by the string timezonearg, return as a date Returns the weekday as an integer in the range 0..6, 0 is Monday. 46 2016 SAP SE or an SAP affiliate company. All rights reserved.

Function Syntax Purpose now daysbetween now() daysbetween(date1, date2) daysbetween(daydate1, daydate2) daysbetween(seconddate1, seconddate2) daysbetween(longdate1, longdate2) Returns the current date and time (localtime of the server timezone) as date Returns the number of days (integer) between date1 and date2. The first version is an alternative to date2 - date1. Instead of rounding or checking for exactly 24 hours distance, this truncates both date values today precision and subtract the resulting day numbers, meaning that if arg2 is not the calendar day following arg1, daysbetween returns 1 regardless of the time components of arg1 and arg2. secondsbetween component addseconds adddays quarter secondsbetween(seconddate1, seconddate2) secondsbetween(longdate1, longdate2) component(date, int) addseconds(date, int) addseconds(seconddate, decfloat) addseconds(longdate, decfloat) adddays(date, int) adddays(daydate, int) adddays(seconddate, int) adddays(longdate, int) quarter(date) Returns the number of seconds the first to the second arg, as a fixed point number. The returned value is positive if the first argument is less than the second. The return values are fixed18.0 in both cases (note that it may prove more useful to use fixed11.7 in case of longdate arguments). 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. Return a date plus a number of seconds. Fractional seconds is used in case of longdate. Null handling is (in opposition to the default done with adds) to return null if any argument is null. Return a date plus a number of days. Null handling is (in opposition to the default done with adds) to return null if any argument is null. Return a string 'yyyy-qn', yyyy being the year of the quarter and n the 2016 SAP SE or an SAP affiliate company. All rights reserved. 47

Function Syntax Purpose quarter(date, month) quarter of the year. An optional start month (of the fiscal 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'. 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') 2.7.5.5 Miscellaneous Functions The table below lists the miscellaneous functions that you can use while creating expressions. Function Syntax Purpose Example if if(intarg, arg2, arg3) return arg2 if intarg is considered true (not equal to zero), else return arg3. Currently, no shortcut evaluation is implemented, meaning that both arg2 and arg3 are evaluated in any case. This means that you cannot use if to avoid a divide by zero error which has the side effect of terminating expression evaluation when it occurs. if("netwr"<=500000,'a', if("netwr"<=1000000,'b',' C') ) jf if(intarg, arg2, arg3) The function jf behaves similar to if, only with SQL semantic. While if will return NULL if the predicate (first argument) is NULL (undefined), jf will use 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 48 2016 SAP SE or an SAP affiliate company. All rights reserved.

Function Syntax Purpose Example case case(arg1, default) case(arg1, cmp1, value1, cmp2, value2,..., default) return value1 if arg1 == cmp1, value2 if arg1 == cmp2 and so on, default if there no match case("category", 'A', 'LV', 'B', 'MV', 'HV') box The function box behaves similar to case, only with SQL semantic. While case will return NULL if arg1 is NULL, box will return 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_RETUR N_NULL) max max(arg1, arg2, arg3,...) return the maximum value of the passed arguments list. An arbitrary number of arguments is allowed. Arguments must be at least convertible into a common type. min min(arg1, arg2, arg3,...) return the minimum value of the passed arguments list. An arbitrary number of arguments is allowed. Arguments must be at least convertible into a common type. max(0, 5, 3, 1) min(1, 2, 3, 4) sqladd sqladd(arg1, arg2) sqladd behaves like the operator '+', with NULL handling changed to SQL standard. While the operator '+' returns the other argument when one argument is NULL, sqladd will return NULL if any of its arguments is NULL. sqladd(if("val_b" = 0, int(null), "VAL_C") / "VAL_B", -1) 2.8 Defining Data Access Privileges This section describes how to create analytic privileges within the SAP Web IDE for SAP HANA tool. Analytic privileges grant different users access to different portions of data in the same view based on their business role. Within the definition of an analytic privilege, the conditions that control which data users see is defined using SQL. 2016 SAP SE or an SAP affiliate company. All rights reserved. 49

Standard object privileges (SELECT, ALTER, DROP, and so on) implement coarse-grained authorization at object level only. Users either have access to an object, such as a table, view or procedure, or they don't. While this is often sufficient, there are cases when access to data in an object depends on certain values or combinations of values. Analytic privileges are used in the SAP HANA database to provide such fine-grained control at row level of which data individual users can see within the same view. Note The current revision supports only creating analytic privileges. Deploying analytic privileges will be supported in the future revisions. Example Sales data for all regions are contained within one analytic view. However, regional sales managers should only see the data for their region. In this case, an analytic privilege could be modeled so that they can all query the view, but only the data that each user is authorized to see is returned. Related Information Create SQL Analytic Privileges [page 50] 2.8.1 Create SQL Analytic Privileges SQL based analytic privileges provides you the flexibility to create analytic privileges within the familiar SQL environment. You can create and apply SQL analytic privileges for a selected group of models or apply them to all models across packages. Prerequisites If you want to use a SQL analytic privilege to apply data access restrictions on information views, set the Apply Privileges property for the calculation view to SQL Analytic Privileges. 1. Open the calculation view in the view editor. 2. Select the Semantics node. 3. Choose the View Properties tab. 4. In the Apply Privileges dropdown list, select SQL Analytic Privileges. 50 2016 SAP SE or an SAP affiliate company. All rights reserved.

Procedure 1. Launch the SAP Web IDE for SAP HANA tool in a browser. 2. Select the module in which you want to create the analytic privilege. 3. Browse to the src folder. 4. In the context menu, choose New Analytic Privilege. 5. Enter details for the new analytic privilege. a. In the Name field, enter the name of the analytic privilege. 6. Choose Create. The tool launches anlytic privilege editor where you can define the analytic privilege. 7. Select information models. If you want to create an analytic privilege and apply the data access restrictions for selected list of models, in the Secured Models section, a. Choose Add. b. In the Find Data Sources dialog, select the models for which you want apply the analytic privilege restrictions. c. Choose OK. 8. Defining SQL analytic privileges. a. In the SQL editor, provide the attribute restrictions and its validity. For example, (("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)) 9. Build an HDB 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 Build 2016 SAP SE or an SAP affiliate company. All rights reserved. 51

3 Using Graphical Tools to Create CDS Artifacts Core data services (CDS) is an infrastructure that can be used to define and consume semantically rich data models in SAP HANA. The model described in CDS enables you to use the Data Definition Language to define the artifacts that make up the data-persistence model. You can save the data-persistence object definition as a CDS artifact, that is; a design-time object that you manage in the SAP HANA repository and activate when necessary. Using a data definition language (DDL), a query language (QL), and an expression language (EL), CDS enables write operations, transaction semantics, and more. You can currently use a graphical editor to model the following artifacts and elements: Entities (tables) Contexts (Containers) Associations (Joins) Related Information CDS Graphical Editor [page 52] Create a CDS Artifact [page 53] Create an Association in CDS [page 58] 3.1 CDS Graphical Editor SAP Web IDE for SAP HANA provides graphical tools specially designed to help you mode artifacts that define data persistence objects using Core Data Services (CDS). SAP Web IDE for SAP HANA includes dedicated graphical editor that you can use to model data-persistence objects in CDS documents using the DDL-compliant CDS syntax. This graphical tool recognizes the.hdbcds file extension required for CDS object definitions and calls the appropriate repository plug-in to parse the CDS artifact. If you right-click a file with the.hdbcds extension in the Project Explorer view, SAP Web IDE for SAP HANA provides the following choice of editors in the context-sensitive menu. Text Editor View and edit DDL source code in a CDS document as text with the syntax elements highlighted for easier visual scanning. Graphical Editor View graphical representation of CDS artifacts, and also model CDS artifacts with graphical modeling tools. 52 2016 SAP SE or an SAP affiliate company. All rights reserved. Using Graphical Tools to Create CDS Artifacts

Related Information Create a CDS Artifact [page 53] 3.2 Create a CDS Artifact A CDS artifact is a design-time source file that contains definitions of the objects you want to create in the SAP HANA catalog. Context CDS artifacts are design-time source files that contain DDL code that describes a persistence model according to rules defined in Core Data Services. CDS artifacts have the file suffix.hdbcds. Building an HDB module that includes this CDS artifact, creates the corresponding catalog objects in the specified schema. Note You can currently model only CDS entities, contexts and associations within an artifact in the graphical editor. To create a CDS artifact in the repository, perform the following steps: Procedure 1. Select the module in which you want to create the CDS artifact. 2. Browse to the src folder. 3. In the context menu, choose New CDS Artifact. 4. Enter details for the new CDS artifact. a. In the Name field, enter the name of the CDS artifact. b. By default, you open CDS artifacts in the graphical editor. You can switch to the text editor by selecting Text. 5. Create a CDS artifact with context By default, you create CDS artifacts with contexts. Context helps group related CDS artifacts. You can also create multiple contexts within a context (nested scenarios). If you do not want to create a CDS artifact with a context, unselect With Context. 6. Choose Create. The tools launches a graphical editor that you allows you to define the CDS artifact. 7. Create an entity. Using Graphical Tools to Create CDS Artifacts 2016 SAP SE or an SAP affiliate company. All rights reserved. 53

a. In the menu bar, select. b. Drop the cursor on the editor. c. Provide a name to the entity. 8. Define columns in CDS entity. a. Double-click the CDS entity. b. In the menu bar, choose. c. For each column, select a data type. The data types are classified as primitive data types, structure data types and native SAP HANA data types. Structure data types are user-defined data types. Based on your requirement you can select a data type from any of these three classifications. d. Define the length and scale based on the selected data type. e. Define if the specified column is the primary key or part of the primary key for the specified entity. Select the Key checkbox accordingly. Note Structured columns can be part of the key, too. In this case, all table fields resulting from the flattening of this structured field are part of the primary key.. f. Define if an entity column can (null) or cannot (not null) have the value NULL. If neither null nor not null is specified for the column, the default value null applies (except for the key column). Select the Not Null checkbox accordingly. g. Defines the default value for an entity column in the event that no value is provided during an INSERT operation. Enter value in the Default text field. 9. Choose Back. 10. Create a context, if required A CDS artifact can contain multiple contexts and any number and type of artifacts. A context can also contain nested sub-contexts, each of which can also contain any number and type of artifacts. a. In the menu bar, select. b. Provide a name for the context. c. Double-click the context. d. Define the sub-context with new entities, associations or another context. You can use the bread crumb in the menu bar to switch between contexts. 11. Choose Save to save all your changes. 12. Build an HDB module The build process uses the design-time database artifacts to generate the corresponding actual objects in the database catalog. The activation process generates a corresponding catalog object for each of the artifacts defined within another artifact; the location in the catalog is determined by the type of object generated. a. From the module context menu, choose Build Build 54 2016 SAP SE or an SAP affiliate company. All rights reserved. Using Graphical Tools to Create CDS Artifacts

Related Information Supported Primitive Data Types [page 55] Native SAP HANA Data Types [page 57] User-Defined Data Types [page 57] 3.2.1 Supported Primitive Data Types primitive (or core) data types are the basic building blocks that you use to define entities or structure types with DDL. The following primitive data types are supported in the SAP Web IDE for SAP HANA modeler tool. Table 10: Supported SAP HANA DDL Primitive Types Name Description SQL Literal Syntax SQL Name EDM Name String (n) LargeString Binary(n) Variable-length Unicode string with a specified maximum length of n=1-1333 characters (5000 for SAP HANA specific objects). Default = maximum length. String length (n) is mandatory. Variable length string of up to 2 GB (no comparison) Variable length byte string with userdefined length limit of up to 4000 bytes. Binary length (n) is mandatory. 'text with quote ' NVARCHAR String 'text with quote ' NCLOB String x'01cafe', X'01Cafe' VARBINARY Binary LargeBinary Variable length byte string of up to 2 GB (no comparison) x'01cafe', X'01Cafe' BLOB Binary Integer Integer64 Decimal( p, s ) DecimalFloat Respective container's standard signed integer. Signed 32 bit integers in 2's complement, -2**31.. 2**31-1. Default=NULL Signed 64-bit integer with a value range of -2^63 to 2^63-1. Default=NULL. Decimal number with fixed precision (p) in range of 1 to 34 and fixed scale (s) in range of 0 to p. Values for precision and scale are mandatory. Decimal floating-point number (IEEE 754-2008) with 34 mantissa digits; range is roughly ±1e-6143 through ±9.99e+6144 13, -1234567 INTEGER Int64 13, -1234567 BIGINT Int64 12.345, -9.876 DECIMAL( p, s ) Decimal 12.345, -9.876 DECIMAL Decimal Using Graphical Tools to Create CDS Artifacts 2016 SAP SE or an SAP affiliate company. All rights reserved. 55

Name Description SQL Literal Syntax SQL Name EDM Name BinaryFloat LocalDate LocalTime Binary floating-point number (IEEE 754), 8 bytes (roughly 16 decimal digits precision); range is roughly ±2.2207e-308 through ±1.7977e +308 Local date with values ranging from 0001-01-01 through 9999-12-31 Time values (with seconds precision) and values ranging from 00:00:00 through 24:00:00 1.2, -3.4, 5.6e+7 DOUBLE Double date'1234-12-31' DATE DateTimeOffset Combines date and time; with time zone must be converted to offset time'23:59:59', time'12:15' TIME Time For duration/ period of time (==xsd:duration). Use Date TimeOffset if there is a date, too. UTCDateTime UTC date and time (with seconds precision) and values ranging from 0001-01-01 00:00:00 through 9999-12-31 23:59:59 timestamp'2011-12-31 23:59:59' SECONDDATE DateTimeOffset Values ending with Z for UTC. Values before 1753-01-01T00: 00:00 are not supported; transmitted as NULL. UTCTimestamp UTC date and time (with a precision of 0.1 microseconds) and values ranging from 0001-01-01 00:00:00 through 9999-12-31 23:59:59.9999999, and a special initial value timestamp'2011-12-31 23:59:59.7654321' TIMESTAMP DateTimeOffset With Precision = 7 Boolean Represents the concept of binary-valued logic true, false, unknown (null) BOOLEAN Boolean 56 2016 SAP SE or an SAP affiliate company. All rights reserved. Using Graphical Tools to Create CDS Artifacts

3.2.2 Native SAP HANA Data Types The following table lists all the native SAP HANA primitive data types that CDS supports. The information provided in this table also includes the SQL syntax required (where appropriate) as well as the equivalent SQL and EDM names for the listed types. Table 11: Supported Native SAP HANA Data Types Data Type * Description SQL Literal Syntax SQL Name EDM Name ALPHANUM Variable-length character string with special comparison - ALPHANUMERIC - SMALLINT Signed 16-bit integer -32768, 32767 SMALLINT Int16 TINYINT Unsigned 8-bit integer 0, 255 TINYINT Byte REAL SMALLDECIMAL VARCHAR CLOB BINARY ST_POINT ST_GEOMETRY 32-bit binary floatingpoint number 64-bit decimal floating-point number Variable-length ASCII character string with user-definable length limit n Large variable-length ASCII character string, no comparison Byte string of fixed length n 0-dimensional geometry representing a single location Maximal supertype of the geometry type hierarchy; includes ST_POINT - REAL Single - SMALLDECIMAL Decimal - VARCHAR String - CLOB String - BINARY Blob - - - - - - 3.2.3 User-Defined Data Types A structured type is a data type comprising a list of attributes, each of which has its own data type. You create a user-defined structured type as a design-time file in the SAP HANA repository. SAP Web IDE for SAP tool enables you to use the CDS syntax to create a user-defined structured type as a design-time file in the repository. Repository files are transportable. You use CDS text editor to create the structure data type. If the structure type is already defined for a CDS artifact, you can select it while defining the data types for columns. Alternatively, you can also import structure types from other artifacts while defining the data types. Using Graphical Tools to Create CDS Artifacts 2016 SAP SE or an SAP affiliate company. All rights reserved. 57

3.3 Create an Association in CDS Associations define relationships between entities. You create associations in a CDS entity definition, which is a design-time file in the SAP HANA repository. Context SAP Web IDE for SAP HANA enables you to use graphical tools to model associations between entities. The associations are defined as part of the entity definition, which are design time files in the repository. You can create more than one association for an entity. Repository files are transportable. Activating the CDS entity creates the corresponding catalog objects in the specified schema. To create associations between CDS entities, perform the following steps: Procedure 1. In the navigation pane, select the CDS artifact. 2. In the context menu, choose Open With Graphical Editor. 3. Double-click the entity which will contain the associations you define. 4. Choose the Associations tab. 5. Choose. 6. Define cardinality, if required. When using an association to define a relationship between entities in a CDS artifact, you use the cardinality to specify the type of relation, for example, one-to-one (to-one) or one-to-many (to-n); the relationship is with respect to both the source and the target of the association. a. In the Source Cardinality and Target Cardinality dropdown lists, select the required values. 7. Select a target entity. The target entity can be from the same artifact or from a different artifact. a. In the Target Entity dropdown list, select a target entity value. If you want to select an entity from another artifact, select Other from the dropdown list. 8. Select the association type. CDS supports both managed and unmanaged associations. a. In the Association Type dropdown list, select the required value. b. For managed associations, in the Association Keys value help, select required columns as association keys. For managed associations, the relation between source and target entity is defined by specifying a set of elements of the target entity that are used as a foreign key. If no foreign keys are specified explicitly, the elements of the target entity s designated primary key are used. 58 2016 SAP SE or an SAP affiliate company. All rights reserved. Using Graphical Tools to Create CDS Artifacts

c. For unmanaged associations, open the expression editor from the On Condition value help and define your condition. Unmanaged associations are based on existing elements of the source and target entity; no fields are generated. In the ON condition, only elements of the source or the target entity can be used; it is not possible to use other associations. The ON condition may contain any kind of expression. Using Graphical Tools to Create CDS Artifacts 2016 SAP SE or an SAP affiliate company. All rights reserved. 59

Important Disclaimers and Legal Information Coding Samples Any software coding and/or code lines / strings ("Code") included in this documentation are only examples and are not intended to be used in a productive system environment. The Code is only intended to better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, unless damages were caused by SAP intentionally or by SAP's gross negligence. Accessibility The information contained in the SAP documentation represents SAP's current view of accessibility criteria as of the date of publication; it is in no way intended to be a binding guideline on how to ensure accessibility of software products. SAP in particular disclaims any liability in relation to this document. This disclaimer, however, does not apply in cases of wilful misconduct or gross negligence of SAP. Furthermore, this document does not result in any direct or indirect contractual obligations of SAP. Gender-Neutral Language As far as possible, SAP documentation is gender neutral. Depending on the context, the reader is addressed directly with "you", or a gender-neutral noun (such as "sales person" or "working days") is used. If when referring to members of both sexes, however, the third-person singular cannot be avoided or a gender-neutral noun does not exist, SAP reserves the right to use the masculine form of the noun and pronoun. This is to ensure that the documentation remains comprehensible. Internet Hyperlinks The SAP documentation may contain hyperlinks to the Internet. These hyperlinks are intended to serve as a hint about where to find related information. SAP does not warrant the availability and correctness of this related information or the ability of this information to serve a particular purpose. SAP shall not be liable for any damages caused by the use of related information unless damages have been caused by SAP's gross negligence or willful misconduct. All links are categorized for transparency (see: http://help.sap.com/disclaimer). 60 2016 SAP SE or an SAP affiliate company. All rights reserved. Important Disclaimers and Legal Information

Important Disclaimers and Legal Information 2016 SAP SE or an SAP affiliate company. All rights reserved. 61

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