SAP HANA
Werner Steyn, Customer Solution Adoption (CSA), SAP Labs
March 2013
Things you need to know about Data Modeling
© 2012 SAP AG. All rights reserved. 2
Disclaimer
This presentation outlines our general product direction and should not be relied on in
making a purchase decision. This presentation is not subject to your license
agreement or any other agreement with SAP. SAP has no obligation to pursue any
course of business outlined in this presentation or to develop or release any
functionality mentioned in this presentation. This presentation and SAP's strategy and
possible future developments are subject to change and may be changed by SAP at
any time for any reason without notice. This document is provided without a warranty
of any kind, either express or implied, including but not limited to, the implied
warranties of merchantability, fitness for a particular purpose, or non-infringement.
SAP assumes no responsibility for errors or omissions in this document, except if
such damages were caused by SAP intentionally or grossly negligent.
© 2012 SAP AG. All rights reserved. 3
Things you need to know about Data Modeling
• Unified Modeling o Analytical Views & Attribute Views
• Analytical Views o Count & Temporal Joins
o Multi Dimensional reporting flag
• Calculation Views o Count, Keep flag, Constant Column
• SAP HANA XS o HTTP access to data & artifacts
o Text-based search
o Transport > roles, DML/DDL, procedures
• Query execution insights o Preview of intermediate results
o Visualize plan & timeline
• Input Parameters o Derived from tables & manage parameters UI
• Decision Tables o Based on tables, models, table types
o Transactional behavior
• Text Search o Fuzzy search models
o Rule sets
o Full Text Search (PDF, MS Office documents)
• Predictive Analytics o Application Function Library (PAL & BFL)
• Analytical Privileges o Dynamic role assignments
SAP HANA SPS 05 What’s New – Release Notes http://help.sap.com/hana/hana_sps5_whatsnew_en.pdf
Unified Modeling
SAP HANA Developer Guide http://help.sap.com/hana/hana_dev_en.pdf
© 2012 SAP AG. All rights reserved. 5
Unified Modeling - New Model Editor
New integrated view designer for
Attribute and Analytical Views
Simplification of the view authoring
process with just one (technical) view
Apply most-all semantic modeling in
the same output node
Overview
Output Semantics
Node Detail Node columns
Improved efficiency for
SAP HANA modeling
Temporal Joins
© 2012 SAP AG. All rights reserved. 7
Temporal Joins
• The join condition between fact data and attribute data is extended with a time-
dependency
• In the Logical Join, you can create a temporal join between the date field of the
fact table to an interval (to and from) field of the attribute view. The temporal join has to start from the fact table such that the single column must
be in the fact table and, the to and from columns must be in the table that is directly
joined to the fact table.
The join type must be a referential join. The supported data types are timestamp,
date, and integer.
Input Parameters
© 2012 SAP AG. All rights reserved. 9
Input Parameters
Table Input Parameters • Values are automatically derived from a Table instead of user input
View A View B
Discount Table
Prompts User to
enter Discount Rate
when this view is
executed
independently
View B Derives Discount from a Table,
passing discount automatically into View A
without prompting the user
Count
© 2012 SAP AG. All rights reserved. 11
Count - Analytical View
New Count Aggregation type in Analytical Views • Enables counters to be push down
© 2012 SAP AG. All rights reserved. 12
Count - Aggregation Node
Aggregate type on count • Add count measure as an aggregated Column
• Support for sum, min, max aggregation types
© 2012 SAP AG. All rights reserved. 13
Keep Flag & Constant Column
Keep Flag will force columns to be retrieved from the
database even when not requested
Aggregation Node
SELECT DIM_A, DIM_B, GROUP_CONSTANT FROM VIEW
WHERE
(GROUP_CONSTANT = A AND DIM_A IN 2,3,4,5)
OR
(GROUP_CONSTANT = B AND DIM_A IN 6,7,8,9)
Constant Column
Multi Dimensional Reporting
© 2012 SAP AG. All rights reserved. 15
Multi Dimensional Reporting
Analytical View
SELECT ORDER_ID,
SALES_ORG,
MATERIAL
FROM <ANALYTICAL VIEW>
GROUP BY
ORDER_ID,
SALES_ORG,
MATERIAL
Calculation View
• Output node deployed as a projection • Disable if no measures exist
• Aggregation & measures optional
SELECT ORDER_ID,
SALES_ORG,
MATERIAL
FROM <CALCULATION VIEW>
Analytical Privileges
SAP HANA Security Guide http://help.sap.com/hana/hana_sec_en.pdf
© 2012 SAP AG. All rights reserved. 17
Analytical Privileges - Dynamic
Business User
Business User
Bus. User
Bus. User
John
John
John
• Create Dynamic Privileges using SQL Editor
• Privileges can be dynamically maintained within tables, without re-activation
Authorization
Table
Restricted coffee list
Query execution insights
SAP HANA Administration Guide http://help.sap.com/hana/hana_admin_en.pdf
© 2012 SAP AG. All rights reserved. 19
Intermediate results-set Preview
Previewing intermediate result set data
• Data Preview supported for nodes within a Calculation View
• This provides intermediate level data previews in addition to the data preview on
the full model itself
© 2012 SAP AG. All rights reserved. 20
Visualize Plan & Timeline
SQL Editor > Context Menu Administration > Performance > SQL Plan Cache Time Line View
Visualize Plan
Decision Tables
© 2012 SAP AG. All rights reserved. 22
IF the borrower needs a
loan for $14000 for a period
of 36 months and he/she
resides within the same
state then he/she would be
eligible for a 10.25 interest
rate
Interest-rate Calculation
Conditions Actions .. are compact representation
of IF-THEN-ELSE rules
Decision Table Example
Import/Export Rules
© 2012 SAP AG. All rights reserved. 23
Decision Tables Modeling
Ability to model decision tables in SAP HANA Studio • Business Rules vocabulary can be extracted from models based on Calculation Views,
Analytical Views, Physical Tables and Table Types
• Model rules get stored in a compact decision table and provide the ability to simulate and
modify physical data based on actions (e.g. discount %)
SAP HANA Studio
Decision Table
… select the source
© 2012 SAP AG. All rights reserved. 24
Decision Tables - High Level Architecture
SAP HANA Rules
Compiler
HANA
Repository
HANA Studio
Decision
Table Editor
SAP HANA XS
Rules Web-editor
Browser
Business User Information Modeler
SQL Engine
SQL Script
compiler
© 2012 SAP AG. All rights reserved. 25
Decision Tables - Based on a Table <type>
Sample Input Data Set
LOANREQUESTS
SELECT *
FROM TABLE_TYPE_DT/RV
(PLACEHOLDER = ($$IN_TT$$, LOANREQUESTS))
CALL TABLE_TYPE_DT (LOANREQUESTS,?)
• Decisions based on table types require a input table when executed
• Parameters will enable the creation of a result view (RV)
© 2012 SAP AG. All rights reserved. 26
Decision Tables - Based on a (Table or Modeled View)
Table
INTERESTRATES
CALL TABLE_RAW_DT (?)
SELECT * FROM TABLE_RAW_DT/RV
• Parameters will enable the creation of a result view (RV)
• Results are dynamically calculated, without updating the table
© 2012 SAP AG. All rights reserved. 27
Decision Tables - Based on a Table <Materialized results>
Initial Table
ZINTERESTRATES
• Absence of Parameters will materialize the result
• CALL TABLE_UPDATE_DT (?) will re-execute the rules and
update the table results
SELECT *
FROM ZINTERESTRATES
Predictive Analytics
SAP HANA Predictive Analysis Library (PAL) Reference http://help.sap.com/hana/hana_dev_pal_en.pdf
SAP HANA Business Function Library (BFL) Reference http://help.sap.com/hana/hana_dev_bfl_en.pdf
© 2012 SAP AG. All rights reserved. 29
Application Function Library (AFL)
Application Functions (C++)
SQLScript
HANA Clients (App Server, Analytics Technology, etc)
SAP HANA
Business Function
Library Predictive Analysis
Library
AFL Framework
…
Application Functions
– Written in C++ and delivered as AFL content
– Users create procedures through a procedure
wrapper generator
PAL Algorithms
– Association Analysis (Aprior, Apriori Lite)
– Cluster Analysis (K-Means, Kohonen Self Organized
Maps)
– Classification Analysis (C4.5 Decision Tree Analysis,
CHAID Decision Tree Analysi, K Nearest Neighbour,
Multiple Linear Regression, Polynomial
– Etc.
BFL Algorithms
– Cycles, Delay Stock, Driver, Forecast Agents,
Forecast Driver, Future, Grow, Lag, Seasonal
Simple, Volume Driver, Seasonal Complex,
Cumulate, Days, Days Outstanding , Annual
Depreciation, Diminishing Balance Depreciation, etc.
Parameter Table
Consult the documentation for complete list of available Algorithms
© 2012 SAP AG. All rights reserved. 30
Working with AFL - (PAL/KMEANS) Example
Step 1 – Generate a PAL/BFL Procedure using the AFL wrapper generator
CALL AFL_WRAPPER_GENEREATOR('PAL_KMEANS_KHNC', 'AFLPAL', 'KMEANS', PDATA)
Procedure Name AFL or BFL Algorithm Signature Table
Step 2 – Execute the Procedure (i.e. using SQL Script, Calculation View, Client)
CALL PAL_KMEANS_KHNC(DATA_TAB, CONTROL_TAB, OUT1_TAB, OUT2_TAB)
Input Data Input Control Data 3 clusters (ages)
discovered Output
Text Search
SAP HANA Developer Guide http://help.sap.com/hana/hana_dev_en.pdf
© 2012 SAP AG. All rights reserved. 32
Text Search - SAP HANA SPS05
Capabilities
Native full text search
In-database text analysis
Graphical modeling of search models
Information Access (InA) toolkit for HTML5 UIs
Benefits
Exploit unstructured content in SAP HANA without additional costs
Extract meaningful information from text
Less data duplication and movement – leverage one infrastructure for analytical
and search workloads
Easy-to-use modeling tools – use HANA Studio Modeler to create search models
Build Search Applications quickly – HANA Information Access toolkit
© 2012 SAP AG. All rights reserved. 33
Fuzzy search
SELECT CAMP_NO, DEFECT FROM MODELED VIEW WHERE CONTAINS(DEFECT, 'thrtle', FUZZY(0.7));
Relevance ranking
SELECT SCORE() AS S, CAMP_NO, DEFECT FROM TABLE
WHERE CONTAINS(DEFECT, 'throttle engine‘, FUZZY(0.7)) ORDER BY S DESC;
Text Search - SQL search examples
© 2012 SAP AG. All rights reserved. 34
Text Search - Search Models
SELECT SCORE() AS S, CAMP_NO, DEFECT FROM MODEL
WHERE CONTAINS(DEFECT, 'throttle engine') ORDER BY S DESC;
© 2012 SAP AG. All rights reserved. 35
Text Search - Definition of Search Rules
Editor is part of the SAP HANA Development perspective
No need to write complex SQL, code can be shared
Rules can be changed without changing the SQL code
Search rules are called using the
EXECUTE_SEARCH_RULE_SET function
© 2012 SAP AG. All rights reserved. 36
Full Text Search
Full text search features has been enhanced to support binary formats
This allows you to search text in .pdf documents or Microsoft Office file formats
SELECT SCORE(), ID, FILENAME, SNIPPETS(PDF_BLOB), HIGHLIGHTED(PDF_BLOB) FROM
DOCUMENTREPO WHERE CONTAINS(PDF_BLOB, 'temporal')
CREATE FULLTEXT INDEX PDF_BLOB_IDX ON DOCUMENTREPO("PDF_BLOB") TEXT ANALYSIS ON
CONFIGURATION 'EXTRACTION_CORE'
Uploaded binary PDF documents
Document Repository Table
SAP HANA XS
SAP HANA Developer Guide http://help.sap.com/hana/hana_dev_en.pdf
SAP HANA XS JavaScript Reference http://help.sap.com/hana/jsapi/index.html
SAPUI5 http://scn.sap.com/community/developer-center/front-end
© 2012 SAP AG. All rights reserved. 38
SAP HANA Extended Application Services
HANA
Browser
http(s); OData (pure data only)
(minimal data volume)
XSEngine
Procedural Appl. Logic
Complete UI Rendering
HTML5: Javascript execution
IndexServer
Data-oriented Appl. Logic
XS Applications
Inbound channel
• HTTP
OData
• Drastic code reduction
Outbound connectivity
HTTP, SMTP
UI services
• SAPUI5
• Portal Services
Built-in services
© 2012 SAP AG. All rights reserved. 39
SAP HANA XS - Programming model
UI Rendering should be implemented completely in the Client
Server generically supports data exposure (via OData) and static UI content provisioning
Browser-based applications should use HTML5, especially SAP UI 5
Ability to leverage the Open Social component model
Additional UI features provided by the Portal Services: navigation, page building, mash-ups,
personalization
Server-side procedural logic in JavaScript
Data-intensive logic to be pushed down to the index server processes via
Native SAP HANA View Types or SQLScript
Application artifacts are stored in the SAP HANA Repository
© 2012 SAP AG. All rights reserved. 40
SAPUI5
SAPUI5 is an extensible JavaScript-based HTML5 browser
rendering library for Business Applications.
Supports RIA like client-side features based on JavaScript
Supports an extensibility concept regarding custom controls
Allows change of themes for customer branding in an effective manner
Allows usage of own JavaScript and HTML
Uses the jQuery library as a foundation
Fully supports SAP Product standards
Open AJAX compliant and can be used together with/uses other standard JS libs
Can be used from various platforms (Java, ABAP, etc)
Produced in a release independent code line to enable short shipment cycles
© 2012 SAP AG. All rights reserved. 41
HANA Studio - Development Perspective
Server-side - OData Service Definition
Server-side JavaScript - SAP HANA XS JavaScript API
SAP HANA XS Project
Client-side - HTML/JavaScript/SAPUI5
Project artifacts
Transportable project artifacts: i.e. roles, schemas, tables,
table content, (DML & DDL), procedures
© 2012 SAP AG. All rights reserved. 42
OData - Exposing Calculation Views
http://server:port/odata/PlannedvsActual.xsodata/PlannedvsActualCalcView?$select=SALESORG,MATERIAL…..
Server-side - OData Service Definition
Client-side - HTML/JavaScript / SAPUI5
1
2
3
4
REST your Models on SAP HANA XS http://scn.sap.com/community/developer-center/hana/blog/2013/01/22/rest-your-models-on-sap-hana-xs
© 2012 SAP AG. All rights reserved. 43
Information Access (InA) toolkit - Search-based apps
Maintain Search Attributes
Client-side - InA
1
2
3
Attribute View
4
© 2012 SAP AG. All rights reserved. 44
SAP HANA XS - Examples
Search-based Application built
with the Information Access
(InA) toolkit for HTML5
Custom-applications built
with SAP UI5 toolkit
Thank you!
Werner Steyn
Platinum Specialist
SAP HANA
Customer Solution Adoption (CSA)
SAP Labs, LLC
© 2012 SAP AG. All rights reserved. 46
Reference Information
SAP Customer Solution Adoption Know-How Webinars
http://scn.sap.com/community/webinars/technology-rig-know-how
SAP HANA SPS 05 What’s New
http://help.sap.com/hana/hana_sps5_whatsnew_en.pdf
SAP HANA Developer Guide
http://help.sap.com/hana/hana_dev_en.pdf
SAP HANA XS JavaScript Reference
http://help.sap.com/hana/jsapi/index.html
SAP HANA Predictive Analysis Library (PAL) reference
http://help.sap.com/hana/hana_dev_pal_en.pdf
SAP HANA Business Function Library (BFL) Reference
http://help.sap.com/hana/hana_dev_bfl_en.pdf
SAP HANA SQLScript Reference
http://help.sap.com/hana/hana_dev_sqlscript_en.pdf
SAP HANA Security Guide
http://help.sap.com/hana/hana_sec_en.pdf
REST your Models on SAP HANA XS
http://scn.sap.com/community/developer-center/hana/blog/2013/01/22/rest-your-models-on-sap-hana-xs
© 2012 SAP AG. All rights reserved. 47
SAP Notes
SAP HANA Central Note
https://service.sap.com/sap/support/notes/1514967
SAP HANA SPS 05 - Release Notes
https://service.sap.com/sap/support/notes/1771591
Debugging User Authorization Errors
https://service.sap.com/sap/support/notes/1809199
Analytical privilege does not work for shared attributes
https://service.sap.com/sap/support/notes/1812023
Modeler behavior when adding objects
https://service.sap.com/sap/support/notes/1783668
Activation error “user is not authorized”
https://service.sap.com/sap/support/notes/1774476
SAP HANA XS: Restrictions / Development Perspective SP5
https://service.sap.com/sap/support/notes/1779803
Using Cardinality in SAP HANA Models
https://service.sap.com/sap/support/notes/1801838
© 2012 SAP AG. All rights reserved. 48
© 2012 SAP AG. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or for any purpose
without the express permission of SAP AG. The information contained herein may be
changed without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary
software components of other software vendors.
Microsoft, Windows, Excel, Outlook, PowerPoint, Silverlight, and Visual Studio are
registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x,
System z, System z10, z10, z/VM, z/OS, OS/390, zEnterprise, PowerVM, Power
Architecture, Power Systems, POWER7, POWER6+, POWER6, POWER, PowerHA,
pureScale, PowerPC, BladeCenter, System Storage, Storwize, XIV, GPFS, HACMP,
RETAIN, DB2 Connect, RACF, Redbooks, OS/2, AIX, Intelligent Miner, WebSphere, Tivoli,
Informix, and Smarter Planet are trademarks or registered trademarks of IBM Corporation.
Linux is the registered trademark of Linus Torvalds in the United States and other countries.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are trademarks or registered
trademarks of Adobe Systems Incorporated in the United States and other countries.
Oracle and Java are registered trademarks of Oracle and its affiliates.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin
are trademarks or registered trademarks of Citrix Systems Inc.
HTML, XML, XHTML, and W3C are trademarks or registered trademarks of W3C®,
World Wide Web Consortium, Massachusetts Institute of Technology.
Apple, App Store, iBooks, iPad, iPhone, iPhoto, iPod, iTunes, Multi-Touch, Objective-C,
Retina, Safari, Siri, and Xcode are trademarks or registered trademarks of Apple Inc.
IOS is a registered trademark of Cisco Systems Inc.
RIM, BlackBerry, BBM, BlackBerry Curve, BlackBerry Bold, BlackBerry Pearl, BlackBerry
Torch, BlackBerry Storm, BlackBerry Storm2, BlackBerry PlayBook, and BlackBerry App
World are trademarks or registered trademarks of Research in Motion Limited.
Google App Engine, Google Apps, Google Checkout, Google Data API, Google Maps,
Google Mobile Ads, Google Mobile Updater, Google Mobile, Google Store, Google Sync,
Google Updater, Google Voice, Google Mail, Gmail, YouTube, Dalvik and Android are
trademarks or registered trademarks of Google Inc.
INTERMEC is a registered trademark of Intermec Technologies Corporation.
Wi-Fi is a registered trademark of Wi-Fi Alliance.
Bluetooth is a registered trademark of Bluetooth SIG Inc.
Motorola is a registered trademark of Motorola Trademark Holdings LLC.
Computop is a registered trademark of Computop Wirtschaftsinformatik GmbH.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP BusinessObjects Explorer,
StreamWork, SAP HANA, and other SAP products and services mentioned herein as well
as their respective logos are trademarks or registered trademarks of SAP AG in Germany
and other countries.
Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal
Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services
mentioned herein as well as their respective logos are trademarks or registered trademarks
of Business Objects Software Ltd. Business Objects is an SAP company.
Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and other Sybase
products and services mentioned herein as well as their respective logos are trademarks or
registered trademarks of Sybase Inc. Sybase is an SAP company.
Crossgate, m@gic EDDY, B2B 360°, and B2B 360° Services are registered trademarks
of Crossgate AG in Germany and other countries. Crossgate is an SAP company.
All other product and service names mentioned are the trademarks of their respective
companies. Data contained in this document serves informational purposes only. National
product specifications may vary.
The information in this document is proprietary to SAP. No part of this document may be
reproduced, copied, or transmitted in any form or for any purpose without the express prior
written permission of SAP AG.