CONFIDENTIAL SAP Hana Technical Workshop High Performance Analytics October 6, 2011
Nov 18, 2014
CONFIDENTIAL
SAP Hana Technical WorkshopHigh Performance Analytics October 6, 2011
SAP HANA Overview
© 2011 SAP AG. All rights reserved. 4Confidential
AGENDA
HANA Overview & Roadmap HANA Architecture Introduction to SAP HANA Studio Loading Data into HANA Start hands on workshop
• Modeling Data – Attribute Views• Modeling Data – Analytic Views• Viewing Results – SAP Business Objects Clients• Advanced Information Models
Wrap Up – Q & A
LUNCH IS SCHEDULED FOR 11:30
5
6
SAP in-memory innovations make the “New Way” a reality
In-Memory
Row +
Column Database
Massively Parallel
Processing
Calculation Engine
Columnar storage increases the amount of data that can be stored in limited memory
(compared to disk)
Column databases enable easier
parallelization of queries
Row database fast transactional processing
In-memory processing gives more time for
relatively slow updates to column data
In-memory allows sophisticated calculations
in real-time
MPP optimized software enables linear performance scaling
making sophisticated calculations like allocations
possible
8
Enabling IT AgilityHow Fast Can IT React on Change? – Empower Business People
How can In-Memory help? In-Database Analytics No aggregates No MOLAP cubes External hierarchies No re-alignment runs Virtual structures only Stable performance
traditional change management process
© 2011 SAP AG. All rights reserved. 9Confidential
SAP HANA Proof-PointsEnabling Business Agility
SAP HANA
10
In-Memory AnalyticsSAP HANA real-time operational
analyticsComplete BI Suite with BI 4 runs
on SAP HANABegin delivery of Baseline
Reporting packages
One Store for Data and AnalyticsSAP HANA only persistence layer for
SAP Business SuiteSAP Business Suite optimized for in-
memory computing
Flexible real time analysis of operations at non-aggregated level
Real-Time operational planning and simulation capabilities: link to execution
Primary persistence and optimized for SAP BW
Reduced landscape complexityValue chain transformation
Cap
abili
ties
Ben
efits
Next-gen ApplicationsSAP BW fully running on SAP HANASAP HANA platform for in-memory apps
■ Industry and LOB Analytic Apps ■ Other purpose built apps
Further optimization of BI 4 Suite for SAP HANA
SAP Business Suite begins move to SAP HANA
SAP HANA 1.0 sp3
VisionLonger-Term
SAP HANA Development RoadmapProduct Strategy and Plan
SAP HANA 1.0Dec 2010
SAP HANA 1.0 sp1, July 2011
sp2General Availability
RTC(Ramp-up)
11
Just Some of the New HANA-EnabledApplications for 2011
SAP Cash and Liquidity Management: Allows companies to predict inbound and outbound cash flows and risk management.
Sales and Operations Planning: This application will enable sales and marketing departments to collaborate with operations and finance in order to evaluate the impact of their strategies and make accurate predictions.
Intelligent Payment Broker: This application will calculate financing options on open invoices and will help determine which discounting terms should be offered on which invoices.
Smart Meter Analytics: The software for intelligent electricity meters: With this application utility companies can analyze smart meter readings to forecast demand and develop new products.
SAP Trade Promotion Management : Improves the planning process and helps develop accurate strategies for particular customers.
12
SAPCRM Rapid
Deployment Solution
SAP ERP rapid-deployment solution for operational reporting with SAP HANA™ software
Business Models and Reports included: Financial Reporting Sales Reporting Procurement Reporting Shipping Reporting Master Data Reporting
Solution to provide compelling SAP ERP operational analytics quickly and affordably
Description An essential reporting software with fixed scope, predefined services at a predictable price with the flexibility for future extension. It provides a set of reports from the business area of sales, financial, shipping, procurement, and master data.
Current situationReactive business model and lack of business transparency due to sub-optimal execution speed of the current ERP operational reporting solution
Value propositionProvide flexible real time analytics, improve business performance, strengthen competitive advantage, provide quick wins for business.
Outcome opportunity Sales people’s efficiency is increased, plans are more accurate and reporting is more timely.
SAP HANA Architecture
© 2011 SAP AG. All rights reserved. 14Confidential
SAP HANA
In-Memory Computing Engine
Admin and Data Modeling
Real–Time Replication Services
Data Integration Services
In-MemoryRow/ColumnData Store
Calculation and Planning
Engine
SAP NetWeaver BW
3rd Party
SAP Business Suite
CustomApplications
SAP BusinessObjects
MDX SQL Optimized
Data Management Service
SAP HANA – Complete SolutionPreconfigured Analytical
Appliance■ In-Memory software + hardware
(Cisco, Dell, HP, IBM, Hitachi and Fujitsu)
In-Memory Computing Engine Software
■ Data Modeling and Data Management■ Real-time Data replication for SAP ECC■ Data Integration for 3rd Party Systems
Capabilities Enabled■ Analyze information in real-time at
unprecedented speeds on large volumes of non-aggregated data
■ Create flexible analytic models based on real-time and historic business data
■ Foundation for new category of applications (e.g., planning, simulation) to significantly outperform current applications in category
■ Minimizes data duplication
© 2011 SAP AG. All rights reserved. 15Confidential
Architecture OverviewIn-Memory Computing Engine and Surroundings
In-Memory Computing Engine
Clients (planned, e.g.) BI4 Explorer
Dashboard Design
SAP BI4 universes (WebI,...)
Request Processing / Execution Control
MS Excel
BI4 Analysis
SQL Parser MDX
SQL Script Calc Engine
Transaction Manager
Session Management
Relational EnginesRow Store Column Store
Persistence LayerPage Management Logger
Disk StorageLog VolumesData Volumes
Authorization Manager
Metadata Manager
In-Memory Computing Studio
Administration Modeling
ERP
ERP DBSystem
Landscape Transformation
SLT
SAP Business Objects BI4
Data Services Designer
SBO BI4 servers ( program for client)
SBO BI4 Information
Design Tool
Other Source Systems
SAP NetWeaver
BW3rd Party
Data Services
© 2011 SAP AG. All rights reserved. 16Confidential
Architecture OverviewIn-Memory Computing Engine and Surroundings
Other Source Systems
ERP
ERP DB
In-Memory Computing Engine
Clients (planned, e.g.) BI4 Explorer
Dashboard Design
SAP BI4 universes (WebI,...)
Request Processing / Execution Control
MS Excel
BI4 Analysis
SQL Parser MDX
SQL Script Calc Engine
Transaction Manager
Session Management
Relational EnginesRow Store Column Store
Persistence LayerPage Management Logger
Disk StorageLog VolumesData Volumes
Authorization Manager
Metadata Manager
In-Memory Computing Studio
Administration Modeling
System Landscape
Transformation
SLT
SAP Business Objects BI4
Data Services Designer
SBO BI4 servers ( program for client)
SBO BI4 Information
Design Tool
SAP NetWeaver
BW3rd Party
Data Services
In-Memory Computing Engine
Request Processing / Execution ControlSQL Parser MDX
SQL Script Calc Engine
Transaction Manager
Session Management
Relational EnginesRow Store Column Store
Persistence LayerPage Management Logger
Disk StorageLog VolumesData Volumes
Authorization Manager
Metadata Manager
SLT
© 2011 SAP AG. All rights reserved. 18Confidential
ERP
ERP DBSystem
Landscape Transformation
Architecture OverviewLoading Data into SAP HANA
In-Memory Computing Engine
Request Processing / Execution ControlSQL Parser MDX
SQL Script Calc Engine
Transaction Manager
Session Management
Relational EnginesRow Store Column Store
Persistence LayerPage Management Logger
Disk StorageLog VolumesData Volumes
Authorization Manager
Metadata Manager
In-Memory Computing Studio
Administration Modeling
SLT
Business Objects Enterprise
Data Services Designer
SBO BI4 servers ( program for client)
SBO Information
Design Tool
Other Source Systems
SAP NetWeaver
BW3rd Party
Data Services
Clients (planned, e.g.) BI4 Explorer
Dashboard Design
SAP BI4 universes (WebI,...)
MS Excel
BI4 Analysis
© 2011 SAP AG. All rights reserved. 19Confidential
Architecture OverviewData Modeling
In-Memory Computing Engine
Request Processing / Execution ControlSQL Parser MDX
SQL Script Calc Engine
Transaction Manager
Session Management
Relational EnginesRow Store Column Store
Persistence LayerPage Management Logger
Disk StorageLog VolumesData Volumes
Authorization Manager
Metadata Manager
In-Memory Computing Studio
Administration Modeling
SLT
Business Objects Enterprise
Data Services Designer
SBO BI4 servers ( program for client)
SBO Information
Design Tool
Other Source Systems
SAP NetWeaver
BW3rd Party
Data Services
Clients (planned, e.g.) BI4 Explorer
Dashboard Design
SAP BI4 universes (WebI,...)
MS Excel
BI4 Analysis
ERP
ERP DBSystem
Landscape Transformation
© 2011 SAP AG. All rights reserved. 20Confidential
Clients (planned, e.g.)
Architecture OverviewReporting
In-Memory Computing Engine
Request Processing / Execution ControlSQL Parser MDX
SQL Script Calc Engine
Transaction Manager
Session Management
Relational EnginesRow Store Column Store
Persistence LayerPage Management Logger
Disk StorageLog VolumesData Volumes
Authorization Manager
Metadata Manager
In-Memory Computing Studio
Administration Modeling
SLT
Business Objects Enterprise
Data Services Designer
SBO BI4 servers ( program for client)
SBO Information
Design Tool
Other Source Systems
SAP NetWeaver
BW3rd Party
Data Services
BI4 Explorer
Dashboard Design
SAP BI4 universes (WebI,...)
MS Excel
BI4 Analysis
ERP
ERP DBSystem
Landscape Transformation
© 2011 SAP AG. All rights reserved. 21Confidential
Architecture OverviewAdministration
In-Memory Computing Engine
Request Processing / Execution ControlSQL Parser MDX
SQL Script Calc Engine
Transaction Manager
Session Management
Relational EnginesRow Store Column Store
Persistence LayerPage Management Logger
Disk StorageLog VolumesData Volumes
Authorization Manager
Metadata Manager
In-Memory Computing Studio
Administration Modeling
SLT
Business Objects Enterprise
Data Services Designer
SBO BI4 servers ( program for client)
SBO Information
Design Tool
Other Source Systems
SAP NetWeaver
BW3rd Party
Data Services
Clients (planned, e.g.) BI4 Explorer
Dashboard Design
SAP BI4 universes (WebI,...)
MS Excel
BI4 Analysis
ERP
ERP DBSystem
Landscape Transformation
© 2011 SAP AG. All rights reserved. 22Confidential
© 2011 SAP AG. All rights reserved. 23Confidential
© 2011 SAP AG. All rights reserved. 24Confidential
© 2011 SAP AG. All rights reserved. 25Confidential
HANA Modeling Process Flow
Import Source System metadata•Physical tables are created dynamically (1:1 schema definition of source system tables)
Provision Data•Physical tables are loaded with content.
Create Information Models•Database Views are created•Attribute Views•Analytic Views•Calculation Views
Deploy•Column views are created and activated
Consume•Consume with choice of client tools
•BICS, SQL, MDX
© 2011 SAP AG. All rights reserved. 26Confidential
HANA Information Models
Attribute Views – Think Master data or single dimension view of data
Analytic Views – Think data cube or Star Schema model / merged facts and dimension table
Calculation View – Think extended functionality or complex calculation capabilities.
Introduction to SAP HANA Studio
© 2011 SAP AG. All rights reserved. 28Confidential
Framework for Modeling within HANA
Analyze Data in Hana
Information in single
table
Base Tables Only Joins and
calculated expressions
no
Access Base Tables/ Attr
Views
yes
Use Attribute Views
Star Schema or Aggregation
noyes
Use Analytic Views
yes
Try Graphical Calc View
not enough
Use Graphical
Calc Views
yes
Use Scripted Calc Views
not enough
Attribute views
Analytic Views
Calc Views
© 2011 SAP AG. All rights reserved. 29Confidential
Welcome to the SAP HANA Studio
Starting the Modeling Environment
• Find the Modeler short cut on the desktop and double click to open it.
© 2011 SAP AG. All rights reserved. 30Confidential
Information Modeler – SAP HANA Studio
Tour of the UI:
• Based on Eclipse
• Consistent with other SAP Modeling/Developer tools
• Navigation
• Perspectives
• Information Panel
© 2011 SAP AG. All rights reserved. 31Confidential
Check System Status
It is possible to check the status of the HANA system from the Modeler
• Select the IM2 system
• Click on the Wrench
© 2011 SAP AG. All rights reserved. 32Confidential
Check System Status
From the Status Window Navigate the tabs
• Landscape
• Alerts
• Performance• Load
© 2011 SAP AG. All rights reserved. 33Confidential
Navigating HANA
The Navigator view is the main way to access content in the HANA system.
Top level nodes are System Instances.
Each instance contains:
Catalog Authorizations/Security Schemas/Data Tables
Content Virtual Information Models
Instance
Security
Schemas/Data
Information Models
© 2011 SAP AG. All rights reserved. 34Confidential
Navigating HANA
Schemas provide a way to organize and work with the assets in your database.
Here we can view and modify the various objects that are part of a schema
For example, you can look at the Definition of a Table by Right clicking on the Table name and selecting Open Definition.
© 2011 SAP AG. All rights reserved. 35Confidential
Navigating HANA
While in the Definition view of the Table, you can see:• Names, data types, etc. of
the Table• Indexes defined for the
Table• Runtime Information
• Shows Table type (Column or Row Store)
• Main/Delta Size
© 2011 SAP AG. All rights reserved. 36Confidential
Navigating HANA
Other actions that are available on a Table include:
•Open Content• Displays the Top
1000 records
© 2011 SAP AG. All rights reserved. 37Confidential
Navigating HANA
Other actions that are available on a Table include:
•Open Content• Displays the Top
1000 records
• Open Data Preview• Displays data in
table form• Allows for basic
profiling of the data.
© 2011 SAP AG. All rights reserved. 38Confidential
Navigating HANA
Other actions that are available on a Table include:
•Open Content• Displays the Top 1000
records
• Open Data Preview• Displays data in table
form• Allows for basic profiling
of the data.
• Generate SQL• Insert Statement• Select Statement• Visual SQL• Use Table as Template
© 2011 SAP AG. All rights reserved. 39Confidential
Navigating HANA
A SQL Editor is available for free hand SQL
© 2011 SAP AG. All rights reserved. 40Confidential
Navigating HANA
Information Models are organized under the Content folder in the Navigator view.
Create/Modify/View• Attribute Views• Analytic Views• Calculations Views• Analytic Privileges• Procedures
© 2011 SAP AG. All rights reserved. 41Confidential
Navigating HANA
Select Data Preview for the Analytic View ORDER_WAREHOUSE
Interact with the virtual views directly in the HANA Modeler
Loading Data into HANA
© 2011 SAP AG. All rights reserved. 43Confidential
Populating HANA with Data
Currently there are three primary ways for transporting data in to HANA:
• Direct import from within HANA• System Landscape Transformation (SLT)
• Move data directly from ECC to HANA• Supports near real-time replication from ECC
• SAP BusinessObjects Data Services Can be used on a broad array of data source including SAP ECC and SAP BW. Can source directly from SAP BW extractors Can support transformation logic in the data flow
© 2011 SAP AG. All rights reserved. 44Confidential
SAP BusinessObjects DataServicesExtractor Support
Use extractors in a data flow like a regular source
© 2011 SAP AG. All rights reserved. 45Confidential
LT Replication Concept: Trigger-Based ApproachConfiguration of LT Replication Server
RFC Connection
Table space (optional)
Replication mode
Connection to HANA
Number of jobs
A schema defines the configuration ofthe data replication for a source system
© 2011 SAP AG. All rights reserved. 48Confidential
Loading Data into HANA
In the following section we will load data into HANA using SAP BusinessObjects Data Services. We will perform the following steps:
1. Prepare the HANA system for the load
2. Perform the load from SAP Business Objects Data Services
3. Verify that the data was loaded correctly
© 2011 SAP AG. All rights reserved. 49Confidential
The Data Model
For our Exercise we are using the TPC-H database.
The data was generated with the publicly available utility used to generate data for this benchmark. The default data set was generated with roughly 6 million records in the main fact table.
© 2011 SAP AG. All rights reserved. 50Confidential
Preparing to Load Data
• Navigate to the ORDERS table in the HANA_TPCH Schema.
• Right clink on the ORDERS table and select “Generate”/”Select Statement”
© 2011 SAP AG. All rights reserved. 51Confidential
Preparing to Load Data
Execute the SQL statement generated.
© 2011 SAP AG. All rights reserved. 52Confidential
Preparing to Load Data
Switch back to the SQL tab and change the SQL statement to the one belwo and execute the statement. There should br 1.5 million records in the table.
© 2011 SAP AG. All rights reserved. 53Confidential
Prepare to Load Data
Delete the data in the table.
Input the SQL below and execute it.
© 2011 SAP AG. All rights reserved. 54Confidential
Load Data
Start the SAP BusinessObjects Data Services client ( in a production system this would be an automated process).
© 2011 SAP AG. All rights reserved. 55Confidential
Load Data
Log into the SAP BusinessObjectes Data Services Client:
• User name: dsuser
• Password: abc123
• Select the “Log On” button
• Select the “Local Repo” Repository
• Select the “OK” button
© 2011 SAP AG. All rights reserved. 56Confidential
Load Data
Data Services Designer.
© 2011 SAP AG. All rights reserved. 57Confidential
Load Data
Open the “TPCH_Data_Load” project by double clicking on the folder in the lower left of the UI.
© 2011 SAP AG. All rights reserved. 58Confidential
Load Data
Expand the TPCH_Job_Runner node until it looks like this.
© 2011 SAP AG. All rights reserved. 59Confidential
Load Data
Double Click on the Query Icon to see the data mappings from input table to HANA table.
© 2011 SAP AG. All rights reserved. 60Confidential
Load Data
• Right click on the “TPCH_Job_Runner” node in the Project Area panel and select “Execute…”
• You will be prompted to “Save all changes and execute”. Select the “Yes” button.
© 2011 SAP AG. All rights reserved. 61Confidential
Load Data
• You will see an “Execution Properties Dialog.
• Do not alter the default values and select the “OK” button.
© 2011 SAP AG. All rights reserved. 62Confidential
Load Data
• Select the “Monitor” button in the top of the main window dialog to watch the data load into HANA.
• 1,500,000 million rows should load in just under a minute.
• You can now Exit SAP Business Objects Data Services and return the the SAP HANA Studio.
© 2011 SAP AG. All rights reserved. 63Confidential
Verify the Data
From the SAP HANA Studio Return to your SQL window and execute the command below.
BEGIN HANDS-ON EXERCISE!
Modeling Data – Attribute Views
© 2011 SAP AG. All rights reserved. 66Confidential
The Data Model
For our Exercise we are using the TPC-H database.
The data was generated with the publicly available utility used to generate data for this benchmark. The default data set was generated with roughly 6 million records in the main fact table.
© 2011 SAP AG. All rights reserved. 67Confidential
Framework for Modeling within HANA
Analyze Data in Hana
Information in single
table
Base Tables Only Joins and
calculated expressions
no
Access Base Tables/ Attr
Views
yes
Use Attribute Views
Star Schema or Aggregation
noyes
Use Analytic Views
yes
Try Graphical Calc View
not enough
Use Graphical
Calc Views
yes
Use Scripted Calc Views
not enough
Attribute views
Analytic Views
Calc ViewsW
e ar
e he
re
Modeling Data – Analytic Views
© 2011 SAP AG. All rights reserved. 82Confidential
Framework for Modeling within HANA
Analyze Data in Hana
Information in single
table
Base Tables Only Joins and
calculated expressions
no
Access Base Tables/ Attr
Views
yes
Use Attribute Views
Star Schema or Aggregation
noyes
Use Analytic Views
yes
Try Graphical Calc View
not enough
Use Graphical
Calc Views
yes
Use Scripted Calc Views
not enough
Attribute views
Analytic Views
Calc Views
We
are
here
Viewing Results
• SAP BusinessObjects Explorer• SAP BusinessObjects Web Intelligence
More Complex Information Models
© 2011 SAP AG. All rights reserved. 119Confidential
Framework for Modeling within HANA
Analyze Data in Hana
Information in single
table
Base Tables Only Joins and
calculated expressions
no
Access Base Tables/ Attr
Views
yes
Use Attribute Views
Star Schema or Aggregation
noyes
Use Analytic Views
yes
Try Graphical Calc View
not enough
Use Graphical
Calc Views
yes
Use Scripted Calc Views
not enough
Attribute views
Analytic Views
Calc Views
We
are
here
© 2011 SAP AG. All rights reserved. 120Confidential
Calculation ViewGraphical
JOINUNION
No SQL coding required Union, Join, Projection nodes provided Join Column Tables (Analytical Views)
© 2011 SAP AG. All rights reserved. 121Confidential
Calculation ViewSQLScript (Script-based)
SQL or SQLScript required to create Script based Calculation Views Write SQL Select statements against existing raw tables or Column Stores
(preferred) Define output structure, activation creates column store based on Script
Output
© 2011 SAP AG. All rights reserved. 122Confidential
Creating a Calculation ViewGraphical
A new Analytic View was created (Customer_Order) to support this exercise.
This Analytic View combines the Order Fact table with the Customer Attribute View. Two Calculated Attributes were created to capture Year and Month.
© 2011 SAP AG. All rights reserved. 123Confidential
Creating a Calculation ViewGraphical
This is the completed Calculation View that we will be creating.
The goal of this Calc View is to Union the Current Year and Prior Year Sales together along with some desired Attributes.The new Customer_Order Analytic View is the source for this Calc View. In the Projection you specify the Attributes and Measures you want to include from the Analytic Views, as well as two calculated columns.Each Projection will also filter the data for a specific Year.
© 2011 SAP AG. All rights reserved. 124Confidential
Creating a Calculation ViewGraphical
A Union is configured to define the mapping to combine the 2 datasets. Lastly the Output dataset is defined.
© 2011 SAP AG. All rights reserved. 125Confidential
Creating a Calculation ViewGraphical
Calc View Creation Right click on the
Calculation View Folder and select New => Calculation View
Provide a Name and Description
Leave the View Type as Graphical as click “Next”
© 2011 SAP AG. All rights reserved. 126Confidential
Creating a Calculation ViewGraphical
Calc View Creation The next dialog window
allows you to choose tables, but we’re going to use an Analytic View so just click “Next”
Expand the Analytic Views Folder, Add Customer_Order, and Click “Finish”
© 2011 SAP AG. All rights reserved. 127Confidential
Creating a Calculation ViewGraphical
Calc View CreationThe Initial View is defined with the “Customer_Orders” Analytic View and the Output component. Add a “Projection”
Component Link the Customer_Order AV
with the Projection Component
Select the Projection Component and add the desired fields to the Output (R_NAME, N_NAME,C_MKTSEGMENT, C_NAME, O_YEAR, O_MONTH, O_TOTALPRICE)
Apply a Filter to the O_YEAR so that Year = 1998 (Most recent year in this dataset is 1998)
© 2011 SAP AG. All rights reserved. 128Confidential
Creating a Calculation ViewGraphical
Calc View Creation Create a Calculated Column
for Current Year (The Expression is just the O_TOTALPRICE field because the filter returns the current year)
Create a Calculated Column for the PriorYear with the Expression defined as 0. We need this field so that the Union will function properly (All Queries in a Union need the same number of fields.)
© 2011 SAP AG. All rights reserved. 129Confidential
Creating a Calculation ViewGraphical
Calc View CreationThe Prior Year dataflow needs to be added to the Calculation View. Drag the CUSTOMER_ORDER
Analytic View onto the pallet Add a “Projection” Component Link the Customer_Order AV with
the Projection Component Select the Projection Component
and add the desired fields to the Output
Apply a Filter to the O_YEAR so that Year = 1997
Create a Calculated Column for Current Year (The Expression is 0)
Create a Calculated Column for the PriorYear with the Expression defined as O_TOTALPRICE.
NOTE: The Output fields and the Calculated Columns for the Prior Year Projection must be in the same order as the Current Year Projection.
© 2011 SAP AG. All rights reserved. 130Confidential
Creating a Calculation ViewGraphical
Calc View CreationThe next step is to “Union” the two Projections together. Add a Union component Add links from the two Projections
to the Union component. Select the Union component and
add the desired fields from the first Projection to the Target panel (all fields with the exception of O_YEAR and O_TOTALPRICE)
Map the fields from the second Projection to the appropriate Target field.
© 2011 SAP AG. All rights reserved. 131Confidential
Creating a Calculation ViewGraphical
Calc View CreationThe next step is to link the Union component to the Output Component and specify the Output fields. Add a link from the Union
component to the Output component.
Add the Attribute fields. Select the Output component and add the desired fields as Attributes
Add the Measure fields using the same process.
Save the Calc View Activate the Calc View Preview the Data
© 2011 SAP AG. All rights reserved. 132Confidential
Calculation ViewScript
Calc ViewThis Calc View accomplishes the same thing but is defined using the Script technique instead of the Graphical approach.
© 2011 SAP AG. All rights reserved. 133Confidential
SQLScript / R / BFL (Business Function Library)Three ways to implement in-memory data mining and statistical analysis
SQLScript SQLScript is a set of SQL extensions which allow developers to push data-
intensive logic into the database in order to avoid massive data copies to the application server and to leverage sophisticated parallel execution strategies of the database.
R Through the R integration solution, developers can leverage open source R’s
3000+ external packages to perform wide-range data mining and statistical analysis.
BFL (Business Function Library) BFL is the calculation library for the applications built on top of the SAP HANA
database. The business functions are written in C++ and executed in database calculation engine. BFL has a roadmap for data mining and statistical algorithms.
© 2011 SAP AG. All rights reserved. 134Confidential
SQLScript
The set of SQL extensions for the SAP HANA database which allow developers to push data intensive logic into the database is called SQLScript.
These extensions are keys to avoiding massive data copies to the application server and to leverage sophisticated parallel execution strategies of the database.
SQLScript V2 supports stored procedures, which provides enhanced control flow capabilities and is positioned to be more suitable for pushing complex parts of application logic to the database.
It can meet some simple requirement for reporting, like join, aggregation, etc. When it comes to data mining and statistic analysis, SQLScript is not suitable for implementing complex algorithms.
© 2011 SAP AG. All rights reserved. 135Confidential
Calculation View (Scripting)
Calculation View Define Table Output Structure Write SQL Statement.
Ensure that the selected fields corresponds to previously defined Output table structure of the function.
Example : SQL_A = SELECT MATNR, KUNNR, …. FROM <COPA_ACTUAL_ANALYTICAL VIEW 1>
SQL_P = SELECT MATTNR_KUNNR, … FROM <COPA_PROJECTED_ANALYTICAL VIEW 2>
TABLE_OUTPUT_STRUCTURE = SELECT * FROM <SQL_A> UNION SELECT * FROM <SQL_P>;
© 2011 SAP AG. All rights reserved. 137Confidential
R Integration with the SAP HANA database – Scenario 1
Join OP
ROP
OLAP OP
Calc. Engine
R External Packages
(Forecasting, Parallelism,
statistics, etc.)
RClient
SAP RHANA Package
Send data and R script
NewDB Space OpenSource R Space
1
3
NewDB R Integration
Open Source R
2 Run the R scripts
Get back the result from R to SAP HANA
Usage Scenario 1 Utilize Open Source R as the data mining calculation engine. Application developer can embedded R scripts in the
SQLScript.CREATE FUNCTION LR( IN input1 SUCC_PREC_TYPE, OUT output0 R_COEF_TYPE) LANGUAGE RLANG AS''' CHANGE_FREQ<-input1$CHANGE_FREQ; SUCC_PREC<-input1$SUCC_PREC; coefs<-coef(glm(SUCC_PREC ~
CHANGE_FREQ, family = poisson )); INTERCEPT<-coefs["(Intercept)"]; CHANGEFREQ<-coefs["CHANGE_FREQ"]; result<-as.data.frame(cbind(INTERCEPT,CHANGEFREQ))''';
TRUNCATE TABLE r_coef_tab; CALL LR(SUCC_PREC_tab,r_coef_tab );SELECT * FROM r_coef_tab;
Sample Codes in SAP HANA SQLScript
© 2011 SAP AG. All rights reserved. 138Confidential
Business Function Library
Business Function Library (BFL) is the calculation library for Applications built on top of the SAP HANA database. It resides in the Calculation Engine and consists of many Business Functions executing at the database layer and is written in C++.
Significant performance improvements for SAP apps
1. Utilizing new hardware i.e. multi core, built in vector engine
2. Massive parallel main memory processing
3. Changing the boundaries between application server and data management layer
Simplification of application programming model
4. Usage of extended SQL(SQLScript) 5. Rich functionalities in the Calculation
Engine6. Fast apps delivery
Design GoalsBFL Wiki
Thank You!