SAP HANAMarkus Fath, SAP HANA Product ManagementJune 2013
© 2013 SAP AG. All rights reserved. 2Public
Agenda
What is SAP HANA?
How do I use SAP HANA?
How can I develop applications on SAP HANA?
That’s it?
© 2013 SAP AG. All rights reserved. 3Public
What is SAP HANA?
SAP HANA is an in-memory data platform that is deployable as an on-
premise appliance, or in the cloud. It is a revolutionary platform that’s
best suited for performing real-time analytics, and developing and
deploying real-time applications. At the core of this real-time data
platform is the SAP HANA database which is fundamentally different
than any other database engine in the market today.
© 2013 SAP AG. All rights reserved. 4Public
What is SAP HANA?
In-memory database
hardware - 8 CPU*10 cores, 1TB RAM
software - column store, compression, partitioning
3B scans/s/core, 12.5 aggregations/s/core
Analytics
real-time – analyze as data keeps rolling in
agility – logical views
Applications
integrated, lightweight application server
© 2013 SAP AG. All rights reserved. 5Public
What is SAP HANA?
Side-by-Side Scenarios (2010)Agile Data Marts
Real-time Operational Reporting
SAP BW on HANA (2011)SAP HANA as primary persistence
SAP NW Application Server on HANA
SAP HANA as data platform (2012)SAP HANA for SAP Business Suite
SAP HANA for custom applications
How do I use SAP HANA?
© 2013 SAP AG. All rights reserved. 7Public
Storing data in SAP HANA
SAP HANA speaks SQL. > CREATE SCHEMA ka;
> CREATE TABLE ka.complaints (cmplid INT, …);
> INSERT INTO ka.complaints VALUES (1, …);
> SELECT cmplid, … FROM ka.complaints;
© 2013 SAP AG. All rights reserved. 8Public
Storing data in SAP HANA
Applications writingdirectly into SAP HANA
Data loaded from filesusing IMPORT / INSERT
Data loaded at certain eventsusing Business Objects Data Services
Real-time replication using SAP LT Replication Service
][ ][ ][Message queue integrationwith Sybase ESP
© 2013 SAP AG. All rights reserved. 9Public
Using data in SAP HANA
You define views, to make dataeasily accessible to everyone.
© 2013 SAP AG. All rights reserved. 10Public
Using data in SAP HANA
TT
T
T T
TT
T
T
TT
Views enable real real-time computing by transforming
data on the fly.
Analytic View
Calculation View
Attribute View
Table
© 2013 SAP AG. All rights reserved. 11Public
Attribute View
© 2013 SAP AG. All rights reserved. 12Public
Analytic View
© 2013 SAP AG. All rights reserved. 13Public
Calculation View
© 2013 SAP AG. All rights reserved. 14Public
Using data in SAP HANA
Data Stores
Persistency Layer
Save Point Logs
Calculation Engine Op
Op Op
Op
Op
Op
Op Op
Execution planSELECT …FROM …WHERE …
Query
Views
Statement Processor
© 2013 SAP AG. All rights reserved. 15Public
Using data in SAP HANA
SAP HANA
SAP Business Objects BI
Analytical applications build with
BI Suite products
Store
Tables
Engines
Analytic Engine
App Objects
Views
SAP HANA Studio
Modeler
Calculation Engine
Apps on HANAApplications on any platform using SQL
via ODBC/JDBC
SQL, MDX
© 2013 SAP AG. All rights reserved. 16Public
Using data in SAP HANA
SAP Business Objects provides an entiresuite of BI front-ends to access data in SAP HANA
SAP Business Objects Crystal Reports
SAP Business Objects WebIntelligence
SAP Business Objects Analysis for MS Excel
SAP Business Objects Explorer
SAP Business Objects Visual Intelligence
Developing for SAP HANA
© 2013 SAP AG. All rights reserved. 18Public
SAP HANA Programming Model Paradigm Shift - Responsibilities in Runtime Layers
Client
Application Server
Database
Proprietary Protocol
SQL
UI Rendering
Display pre-rendered UI
SQL
Classic Application Server Layers
HANA
Browser
http(s), OData (pure data only)
HdbNet(minimal data volume)
Extended Application ServicesProcedural Application Logic
Complete UI Rendering
Database
Data-intense Application Logic
HANA Native Applications
Application Logic
DBI/DBSL, DB buffer
© 2013 SAP AG. All rights reserved. 19Public
SAP HANA Programming ModelTechnologies
PresentationHTML5 / SAPUI5Client-side JavaScript
HANA
Browser
http(s), OData (pure data only)
HdbNet(minimal data volume)
Extended Application ServicesProcedural Application Logic
Complete UI Rendering
Database
Data-intense Application Logic
Control FlowODataServer-side JavaScript
Data ProcessingSQL / Views / SQLScriptApplication Function Library (AFL)
© 2013 SAP AG. All rights reserved. 20Public
SAP HANA Native ApplicationsSQLScriptWhat is SQLScript?
Interface for applications to access SAP HANA; extension of ANSI Standard SQLLanguage for creating stored proceduresDeclarative logic including SELECT queries, built-in Calculation Engine FunctionsOrchestration logic including Data Definition Language (DDL), Data Manipulation Language (DML), assignment, imperative logic
SQLScript allows execution of data intensive calculations inside SAP HANAEliminates need to transfer large amounts of data from the database to the applicationMaximum benefit from SAP HANA features such as fast column operations, query optimization and parallel execution
Advantages (compared to SQL)Functions can return multiple resultsComplex functions can be broken down - modular programming, reuse, and understandabilityFunctions can have parametersSupports local variables for intermediate results with implicitly defined typesProvides control logic such as if/else
© 2013 SAP AG. All rights reserved. 21Public
SQLScriptCode example using SQL
CREATE PROCEDURE getComplaintsAggSQL (in cmplid INTEGER, out o_complaints tt_complaints)
LANGUAGE SQLSCRIPTSQL SECURITY INVOKERREADS SQL DATA ASBEGIN/***************************** Write your procedure logic *****************************/
ta_complaints = SELECT CMPLID, MAKE, MODEL, CDESCR, COUNTER FROM "KA"."COMPLAINTS";
ag_complaints = SELECT MAKE, SUM(COUNTER) AS TOTAL_FOR_MAKE FROM "KA"."COMPLAINTS" GROUP BY MAKE;
jo_complaints = SELECT T1.CMPLID, T1.MAKE, T1.MODEL, T1.CDESCR, T1.COUNTER, T2.TOTAL_FOR_MAKE
FROM :ta_complaints AS T1, :ag_complaints AS T2WHERE T1.MAKE = T2.MAKE;
o_complaints = SELECT CMPLID, MAKE, MODEL , COUNTER, TOTAL_FOR_MAKE
FROM :jo_complaints WHERE CMPLID = :cmplid;END;
Result
Complaints
Q1
Q4
Q3
Q2
© 2013 SAP AG. All rights reserved. 22Public
Using data in SAP HANA
Operation
R Procedure Calls
Predictive Analysis Algorithms
Business Function Calls
Calculations on Data
Set Operations
Operations can be all sortsof operations on data – not just basic
SQL operations but also more complex logic
© 2013 SAP AG. All rights reserved. 23Public
SAP HANAApplication Function Library
What is Application Function Library (AFL)?
Set of native, pre-built, parameter-driven, commonly used algorithmsOptimized for performanceFunctions can be called from SQLScriptThe Business Function Library (BFL) contains algorithms primarily related to financeStock Flow, Lease, Depreciation, Discounted cash flow, Inflated cash flow, …
The Predictive Analysis Library (PAL) contains algorithms primarily related to predictive analysis and data miningRegressions, KNN, k-Means, Exponential Smoothing, Apriori, …
© 2013 SAP AG. All rights reserved. 24Public
SAP HANA Programming ModelTechnologies
PresentationHTML5 / SAPUI5Client-side JavaScript
HANA
Browser
http(s), OData (pure data only)
HdbNet(minimal data volume)
Extended Application ServicesProcedural Application Logic
Complete UI Rendering
Database
Data-intense Application Logic
Control FlowODataServer-side JavaScript
Data ProcessingSQL / Views / SQLScriptApplication Function Library (AFL)
© 2013 SAP AG. All rights reserved. 25Public
SAP HANA Extended Application Services
What are Extended Application Services?Small footprint application server / web server for application development inside SAP HANA
Enable application development and deployment while minimizing architectural “layers”Create apps that have an http-based UI (browser, mobile apps)Apps run directly on SAP HANA, w/o additional external servers or components
simplified system architecture; low TCO
Tight integration with SAP HANA DBbest possible performance
ScopeLightweight web-based applicationsComplex Enterprise Business Applications
© 2013 SAP AG. All rights reserved. 26Public
SAP HANA Extended Application ServicesOData Service Implementation
© 2013 SAP AG. All rights reserved. 27Public
SAP HANA Extended Application ServicesJavaScript Service Implementation
var iSearchTerm= $.request.parameters.get('searchterm');var output = ''; var list = [];
function createEntry(rs){return {
"CMPLID" : rs.getInteger(1),"MAKE" : rs.getString(2),"MODEL" : rs.getString(3),"CDESCR" : rs.getString(4)
};}
var query = "SELECT CMPLID, MAKE, MODEL, CDESCR FROM \"KA\".\"COMPLAINTS\" " +"WHERE CONTAINS (CDESCR, ?) ORDER BY SCORE() DESC LIMIT 10 ";
var dbconn = $.db.getConnection();var stmt = dbconn.prepareCall( query );stmt.setString(1, iSearchTerm);stmt.execute();var result = stmt.getResultSet();
while (result.next()) {list.push(createEntry(result));
}
result.close();stmt.close();dbconn.close();
output = JSON.stringify( {"entries": list } );
$.response.setBody(output); $.response.contentType = 'text/json';
© 2013 SAP AG. All rights reserved. 28Public
SAP HANA Programming ModelTechnologies
PresentationHTML5 / SAPUI5Client-side JavaScript
HANA
Browser
http(s), OData (pure data only)
HdbNet(minimal data volume)
Extended Application ServicesProcedural Application Logic
Complete UI Rendering
Database
Data-intense Application Logic
Control FlowODataServer-side JavaScript
Data ProcessingSQL / Views / SQLScriptApplication Function Library (AFL)
© 2013 SAP AG. All rights reserved. 29Public
SAP HANASAPUI5
SAP UI development toolkit for HTML5 (SAPUI5) is a cross-browser JavaScript library for building rich internet applications.
© 2013 SAP AG. All rights reserved. 30Public
SAP HANASAPUI5
//Create an instance of the table controlvar oTable = new sap.ui.table.Table({title: "Complaints",visibleRowCount: 10,firstVisibleRow: 1,columnHeaderHeight: 30,navigationMode: sap.ui.table.NavigationMode.Paginator
});//Define the columns and the control templates to be used
oTable.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "ID"}),template: new sap.ui.commons.TextField().bindProperty("value", "CMPLID"),sortProperty: "CMPLID",filterProperty: "CMPLID",width: "50px"
}));oTable.addColumn(new sap.ui.table.Column({label: new sap.ui.commons.Label({text: "Make"}),template: new sap.ui.commons.TextField().bindProperty("value", "MAKE"),sortProperty: "MAKE",filterProperty: "MAKE",width: "50px"
}));...
//Create a model and bind the table rows to this modelvar oModel = new sap.ui.model.odata.ODataModel("../data/complaints.xsodata/", false);oTable.setModel(oModel);oTable.bindRows("/COMPLAINTS");oTable.placeAt('result');
© 2013 SAP AG. All rights reserved. 31Public
SAP HANA Studio Development Perspective and Repository
Environment for building native HANA applicationsDevelopingTesting DebuggingSupportabilityLifecycle Management
Application objects are stored in the repositoryVersioningPackagingTransport
What else?
© 2013 SAP AG. All rights reserved. 33Public
Using data in SAP HANA
SAP HANA
SAP Business Objects BI
Analytical applications build with
BI Suite products
Store
Tables
Engines
SearchEngine
Analytic Engine
Extended Application Services
HANA Search UI Search UI configured with the Info Access
(InA) toolkit for HTML5 running natively on SAP
HANA
Preprocessor
Linguistic Processing
Entity, FactExtraction
App Objects
Views Procedures
JS code
SAP HANA Studio
Modeler,Dev.
Workbench
Info Access (InA) Service
HANA Appbuilt withSAPUI5
Application running natively on / against
SAP HANA
Calculation Engine
server-side JS, OData
Apps on HANAApplications on any platform using SQL
via ODBC/JDBC
SQL, MDX
© 2013 SAP AG. All rights reserved. 34Public
SAP HANA Fulltext Search and Text Analysis
CapabilitiesNative full text searchIn-database text analysisGraphical modeling of search modelsInfo Access (InA) toolkit for HTML5 UIs
BenefitsExploit unstructured content in SAP HANA without additional costsExtract meaningful information from textCombine structured and unstructured information for unified information accessLess data duplication and movement – leverage one infrastructure for analytical and search workloadsSpeed up HTML5 application development – InA toolkit
© 2013 SAP AG. All rights reserved. 35Public
SAP HANASearch Model Example
© 2013 SAP AG. All rights reserved. 36Public
SAP HANA Info Access (InA) toolkit for HTML5
© 2013 SAP AG. All rights reserved. 37Public
SAP HANAText Analysis
CREATE FULLTEXT INDEX FTI_COMPLAINTSON COMPLAINTS(CDESCR)CONFIGURATION 'EXTRACTION_CORE' TEXT ANALYSIS ON;
Source Table “COMPLAINTS”
© 2013 SAP AG. All rights reserved. 38Public
SAP HANAText Analysis – Downstream Processing
Text Analysis results are stored in a table and therefore can be leveraged in all supported HANA scenarios
“Standard” analytics Create Analytic Views and Calculation Views on tope.g. companies mentioned in news articles over time
Data mining, predictiveUse R, Predictive Analysis Library (PAL) functionse.g. clustering, time series analysis etc.
Search Based ApplicationsCreate a search model and build a search UI with the HANA Info Access (InA) toolkit for HTML5Text Analysis results can be used to navigate and filter search resultse.g. people finder, search UI for internal documents
© 2013 SAP AG. All rights reserved. 39Public
Use Cases
Real-time analytics on large data volumes
Financials
Production planning, monitoring
Sales optimization
Combine structured and unstructured information
Patent research
Consumer sentiment analysis, brand monitoring
Healthcare
How to get started
© 2013 SAP AG. All rights reserved. 41Public
SAP HANA Developer edition
• For product evaluations, trials, students, data exploration projects, etc.
• Software is free, developers pay cloud provider for server usage.
• Focused on small- to mid-sized data footprint, with non-productive use only
• Community supported through http://saphana.com/cloud
• Available of choice on 4 public cloud providershttp://developers.sap.com/hana
© 2013 SAP AG. All rights reserved. 42Public
Additional Resources
http://developers.sap.com/hana 30 days trial, development community
http://www.saphana.com/welcomeAdditional information, e.g. use cases
http://www.saphana.com/community/implement/hana-academyVideos and courses
http://help.sap.com/hana_appliance/Online documentation, e.g. Developer Guide