You are on page 1of 59

Fundamentals of SAP HANA

Version 1.0 February 1st 2013 Anubrat / Joseph / Deepthi / Karthik

Agenda

Fundamentals of SAP HANA

HANA modeling

Extract data from HANA

Fundamentals of SAP HANA

-3Fundamentals of SAP HANA - v1 6.pptx

Agenda - Fundamentals of SAP HANA

What is SAP HANA Integrating HANA into existing SAP Landscape Replicating Data to HANA (Data Provisioning)

Running Head

What is HANA?
A platform for innovative, real-time analytics and applications
Real-time solutions New accelerators and analytic content for powerful analysis and reporting on big data New applications for highly innovative processes and business models Benefits Make smarter and faster decisions with complete insight on large volumes of granular data

React quickly with real-time analysis and reporting


Unlock new opportunities with state-of-the-art analysis Invent new data-driven business models and renew differentiating processes enabled by real real-time insight Ensure quick time-to-value with solutions that you can deploy faster

-5-

Fundamentals of SAP HANA - v1 6.pptx

SAP HANA - In-Memory Strategy

-6Fundamentals of SAP HANA - v1 6.pptx

Running Head

Innovations driving HANA

SAP has used the recent innovations in HW technology and economics to launch a platform that supports development of in-memory business applications.
Hardware Innovations SAP Software Innovations

CPU
Multicore architecture Massive parallel processing capabilities

Row + Column Storage

Memory (RAM)
64 bit address space 100 GB/s data throughput Lower cost

Compression

Partitioning

Insert only on delta

-7-

Fundamentals of SAP HANA - v1 6.pptx

Innovations driving HANA


Columnar Table Reduce database latency and storage Faster Aggregation time
Customer A A B C Columnar Table Customer Product Amount Product AAA BBB BBB AAA Amount 10 20 30 40

Partitioning

Ability to process data from single table across multiple CPUs

-8-

Fundamentals of SAP HANA - v1 6.pptx

Architecture Overview
Index Server: Contains the actual data stores and the engines for processing the data. Processes incoming SQL or MDX statements
Preprocessor Server: Analyze text data and extract the information on which the text search capabilities are based Statistics Server Collects information about status, performance and resource consumption Name Server Information about HANA Topology Critical for distributed landscape Calculation Engine Execute user defined functions User defined functions are broken into logical dataflow steps that can be executed in parallel

-9-

Fundamentals of SAP HANA - v1 6.pptx

Languages Supported SQL Script Language R Business Function Library Predictive Analysis Library

Integrating HANA into existing SAP Landscape

- 10 -

Fundamentals of SAP HANA - v1 6.pptx

Side by Side Scenario


HANA is used as a secondary database and used as an accelerator

SAP Business Suite

Data Services (DS) Direct Connector (DXC)

SAP HANA

DS / DXC

Business Warehouse

ABAP Data Base Connector (ADBC)

Traditional DB

SAP Landscape Transformation (SLT)

Applications developed using Side by Side Architecture

Agile Data Marts Operational Data Marts COPA Accelerators SAP Sales and Operations Planning
Fundamentals of SAP HANA - v1 6.pptx

- 11 -

HANA is used as primary persistence

SAP Business Suite ECC, CRM, SCM

Business Warehouse

Applications using HANA as Primary Persistence

SAP BW on HANA Business suite on HANA

HANA DB

HANA DB

- 12 -

Fundamentals of SAP HANA - v1 6.pptx

SAP HANA Extended Application Service


Application logic directly built into HANA to develop Web Based Application using ODATA or XMLA interfaces or SAPUI5 with server side coding

- 13 -

Fundamentals of SAP HANA - v1 6.pptx

Data Provisioning

- 14 Fundamentals of SAP HANA - v1 6.pptx

SAP Landscape Transformation (SLT)


SAP LT Replication Server (SLT) is positioned for real-time data replication from SAP and non-SAP sources (SAP supported data bases only). Mainly recommended for real-time data replication business scenarios.

HANA Studio

Application Tables

Trigger Based Recording

RFC Replication Engine

DB Connection
Application Tables

- 15 -

Fundamentals of SAP HANA - v1 6.pptx

Source System SAP or non-SAP System

SLT Server

SAP HANA

Replication from SAP sources system

RFC Read Module

Structure mapping &Transformation

Application Tables

Logging Tables

Write Module

DB Connection Application Tables

DB Trigger

SAP Source System

SLT Server

SAP HANA
Fundamentals of SAP HANA - v1 6.pptx

- 16 -

Multi-system support
SLT supports options to connect multiple source systems to single HANA or Multiple HANA

System A
System B
Source System

Schema 1 Schema 2
SAP HANA

System A System B
Source System

System SchemaA 1 System SchemaA 2


SAP HANA

System A System B
Source System

Schema 1
SAP HANA

System SchemaA 2
Source System SAP HANA System
- 17 -

Fundamentals of SAP HANA - v1 6.pptx

System A

System SchemaA 1

Information Modeling with HANA

- 18 -

Fundamentals of SAP HANA - v1 6.pptx

Agenda
Graphical Modeling with HANA When to use SQLSCRIPT What is SQL SCRIPT Purpose of SQLSCRIPT SQLSCRIPT overview Declarative approach Data access operators ,CE functions, procedures Integration with Hana Modeler

Avoid Bottlenecks

Rethink Paradigms

Today
Calculation

Future Application Layer

Database Layer
Calculation
Fundamentals of SAP HANA - v1 6.pptx

- 20 -

Modeling for SAP HANA using SAP HANA Studio


Step 1: Attribute View
Separate Master Data Modeling from Fact Data Build the needed master data objects as Attribute Views

Step 2: Analytical View


Create Cube-like view by joining attributes view to Fact data Build a Data Foundation based on transactional table Join attribute views to data foundation

Step 3: Calculation View


If joins are not sufficient create a

Calculation View that is something that looks like a View and has SQL Script inside Composite view of other views (tables, re-use join, OLAP views) Consists of a Graphical & Script based editor SQLScript is a HANA-specific functional script language

- 21 -

Fundamentals of SAP HANA - v1 6.pptx

Calculation View Graphical Mode


No SQL coding required

Union, Join, Projection nodes provided


Join Column Tables (Analytical Views)

- 22 -

Fundamentals of SAP HANA - v1 6.pptx

SQL Script: Motivation and goals


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

For Internal Purpose Only

Differences between SQL & SQLSCRIPT

SQL
Data Definition Language DDL Interactive Data Manipulation Language (Interactive DML)

SQLScript Bypass SQL processor Yes (via CE interact functions) with CE.

SQL

No

SQLSCRIPT
extend SQL queries to contain high level calculations Conditional Evaluation Scalar Expressions Functional Loops Declarative & Imperative features

Consists of DDL & DML statements

Yes

Mainly only this functionality

Compilation One time only execution plan Stored in memory in terms of calculation models

Every time will be created at runtime

- 24 For Internal Purpose Only

Fundamentals of SAP HANA - v1 6.pptx

SAP HANA: SQL Script


Compared to plain SQL queries, SQL Script has the following advantages: Functions can return multiple results, while a SQL query returns only one result set.

Complex functions can be decomposed into smaller functions. This enables modular programming, reuse and a better understandability by functional abstraction. For structuring complex queries, standard SQL only allows the definition of SQL views. However, SQL views have no parameters.
SQL Scripts supports local variables for intermediate results with implicitly defined types. With standard SQL, it would be required to define globally visible views even for intermediate steps. SQL Script has control logic such as if/else and throw/catch that is not available in SQL

- 25 -

Fundamentals of SAP HANA - v1 6.pptx

Declarative-Logic

SQL Script: Extensions


Declarative Extension I Imperative Extension Control Structures, Cursor, Dynamic SQL. Table Types. Functional Extension, FSP. SQL Script/CE Built in Functions.

Functional Extension

For Internal Purpose Only

SQLScript - Table types


Allows for the definition of new Table Types Similar to a database table but do not have an instance Used to define procedure parameters Created when the procedure is activated

- 27 -

Fundamentals of SAP HANA - v1 6.pptx

Functional Extension Concept


Functional-Style Procedures Procedures can have multiple input parameters and output parameters Side Effect free procedures Declare a procedure as READ ONLY READS SQL DATA Read-only procedures can only call other read-only procedures. Advantages calculation and transformations can be parameterized and reused. define common sub expressions. improves the readability of the SQLScript code.

For Internal Purpose Only

Creating and Invoking PROCEDURES


CREATE PROCEDURE [schema.]name [({IN|OUT|IN OUT} param_name data_type [,...])]

implementation language is by default SQLSCRIPT. specify the security mode SQL SECURITY. READS SQL DATA - Read-only procedures can only call other read-only procedures.

Activated procedure can be called by other procedures

Name of procedure: schema.<proc>


Fundamentals of SAP HANA - v1 6.pptx

- 29 -

- 30 Fundamentals of SAP HANA - v1 6.pptx

Functional Extension - Implementing Functional logic

Sequence of statements

Each statement specifies a transformation of some data (e.g. by means of classical relational operators such as selection, projection) and binds the result to a variable
The declarative nature to define business logic might require some deeper thought when specifying an algorithm, but it gives the SAP HANA database freedom to optimize the data flow A table variable is bound to tabular value when a procedure is called and a tabular IN parameter is bound to the value of its argument Table variables are bound using the equality operator.
Fundamentals of SAP HANA - v1 6.pptx

Data flow - Free of side effects

Table Variables

Binding of variables

recursion is not possible.

- 31 -

Binding of table type variables


lt_expensive_books = SELECT title, price, crcy FROM :it_books WHERE price > :minPrice AND crcy = :currency;

an IN parameter of a table type.

Bound Bound

variables of type table in the FROM clause which were bound by an earlier statement

ot_sales = CE_UNION_ALL(:lt_on_sale, :lt_cheap_books);

Calculation engine plan operators can be used to assign variable as follows:


Fundamentals of SAP HANA - v1 6.pptx

- 32 -

SQLScript - Code example

SqlScript Compiler

The SQL Script in the example above defines a table function which has two scalar input parameters and two output parameters of type table. The first line contains a SQL query Q1 which identifies big publishers based on the number of books they have published (using the input parameter cnt). Afterwards, detailed information about these publishers along with their corresponding books is determined in query Q2. Finally, this information is aggregated in two different ways in queries Q3 (aggregated per publisher) and Q4 (aggregated per year), respectively. The resulting tables constitute the output tables of the function.
- 33 Fundamentals of SAP HANA - v1 6.pptx

SQLScript - Parallel processing

Select statements are executed in parallel unless: o Local scalar parameters and variables are used in the procedure o Read/Write procedures or DML/DDL operations are executed o Imperative Logic is used within the procedure o SQL statements are used that are not assigned to a variable The following 3 queries are processed in parallel: BEGIN p_out1 = select * from <schema>.<TAB1>; p_out2 = select * from <schema>.<TAB2>; p_out3 = select * from <schema>.<TAB3>; END;

- 34 -

Fundamentals of SAP HANA - v1 6.pptx

Calculation engine plan operators


They constitute an alternative to using SQL statements as their logic is directly implemented in the calculation engine, i.e. the execution environment of SQLScript. bind a column table or a column view to a table variable CE_COLUMN_TABLE,CE_OLAP_VIEW

Data Source Access operators

Relational operators

bypass the SQL processor during evaluation and to directly interact with the calculation engine. CE_JOIN,CE_LEFT_OUTER_JOIN,CE_PROJEC TION,CE_UNION_ALL

Special extensions

crucial business functions inside the database kernel. CE_VERTICAL_UNION,CE_CONVERSION


Fundamentals of SAP HANA - v1 6.pptx

- 35 For Internal Purpose Only

SQLScript CE Build In Functions Operators


SQL
SELECT on column table SELECT on attribute view SELECT on olap view WHERE HAVING out = SELECT A, B, C from "COLUMN_TABLE" out = SELECT A, B, C from "ATTRIBUTE_VIEW" out = SELECT A, B, C, SUM(D) from "ANALYTIC_VIEW" GROUP BY A, B, C out = SELECT A, B, C, SUM(D) from "ANALYTIC_VIEW" WHERE B = 'value' AND C = 'value' out = SELECT A, B, C, SUM(D) FROM"COLUMN_TABLE" GROUP BY A, B, C out = SELECT A, B, Y, SUM(D) from "COLTAB1" INNER JOIN "COLTAB2" WHERE "COLTAB1"."KEY1" = "COLTAB2"."KEY1" AND "COLTAB1"."KEY2" = "COLTAB2"."KEY2" out = SELECT A, B, Y, SUM(D) from "COLTAB1" LEFT OUTER JOIN "COLTAB2" WHERE "COLTAB1"."KEY1" = "COLTAB2"."KEY1" AND "COLTAB1"."KEY2" = "COLTAB2"."KEY2" out = SELECT A, B, C, SUBSTRING(D,2,5) FROM "COLUMN_TABLE" col_tab1 = SELECT A, B, C, D FROM "COLUMN_TABLE1"; col_tab2 = SELECT A, B, C, D FROM "COLUMN_TABLE2"; out = SELECT * FROM :col_tab1 UNION ALL SELECT * FROM :col_tab2;

CE-Build In Function
out = CE_COLUMN_TABLE("COLUMN_TABLE", [A, B, C]) out = CE_JOIN_VIEW("ATTRIBUTE_VIEW", [A, B, C]) out = CE_OLAP_VIEW("ANALYTIC_VIEW", [A, B, C]); col_tab= CE_COLUMN_TABLE("COLUMN_TABLE"); out = CE_PROJECTION(col_tab, [A, B, C], ' "B" = ''value'' AND "C" = ''value'' '); col_tab= CE_COLUMN_TABLE("COLUMN_TABLE"); out = CE_AGGREGATION( (col_tab, SUM(D), [A, B, C]); out = CE_JOIN("COLTAB1","COLTAB2", [KEY1, KEY2], [A, B, Y, D])

GROUP BY INNER JOIN

LEFT OUTER JOIN

out = CE_LEFT_OUTER_JOIN("COLTAB1","COLTAB2", [KEY1, KEY2], [A, B, Y, D])

SQL Expressions

proj_tab = CE_COLUMN_TABLE("COLUMN_TABLE"); out = CE_PROJECTION( :proj_tab, ["A", "B", "C", CE_CALC('midstr("D",2,5)', string) ]); col_tab1 = CE_COLUMN_TABLE("COLUMN_TABLE1",[A,B,C,D]); col_tab2 = CE_COLUMN_TABLE("COLUMN_TABLE2",[A,B,C,D]); out = CE_UNION_ALL(:col_tab1,:col_tab2);
Fundamentals of SAP HANA - v1 6.pptx

UNION ALL

- 36 -

Declarative-Logic

Integration with Modeler


Calculation View Procedures

For Internal Purpose Only

Modeling: Procedures Integration with SAP HANA Modeler

Read-only procedure can be created Following restrictions will apply for the procedures created in the SAP HANA Modeler IN (Input) parameters can be of scalar or table type OUT (Output) parameters must have table type Tables types required for the signature are generated automatically Activated procedure can be called by other procedures

Name of procedure:
Fundamentals of SAP HANA - v1 6.pptx

_SYS_BIC.<packagename>/<proc>

- 38 -

- 39 Fundamentals of SAP HANA - v1 6.pptx

Recommendations
How to build content

1: Column Table Used for simple applications and showcases. No additional modeling required. For most clients easy to consume. No support for analytical privileges, multi language and client handling. Complex calculation and logic shifted to client side. In general low performance.

2: Analytical View Used for analytical purposes where reading operations on mass data is required. Very high performance on SELECT. Supported by modeling. Well optimized.

3: Calculation View (SQL)

Usage

Pros

4: Calculation View (CE Functions) Used for analytical purposes that cannot be expressed using Used for simple Attribute or Analytical views. calculations where only Perform statements against a few fields are used. existing Attribute & Analytical Views. Client queries can be well Building calculation optimized and parallelized. views via SQL syntax Usually better performance is easy. results than SQL. Client queries can be less optimized and could significantly be slower compared to other models.

Cons

- 40 -

Fundamentals of SAP HANA - v1 6.pptx

Limitations in regards to functions.

Syntax is different in compared to well-known SQL Language.

Extract data from HANA

- 41 Fundamentals of SAP HANA - v1 6.pptx

Agenda

Application Accelerator

ABAP Database Connectivity (ADBC)

SAP HANA Extended Application Services (XS Engine)

HANA Full Text Search Capabilities

Application Accelerator - Scenario

Application Accelerator - Features

Side-by-side scenario where SAP HANA data base act as a secondary data base along with the traditional data base Instrumented application server can run ERP application without modifications

Applications areas that need performance improvement is continuously replicated in to the HANA data base with the help of SLT. Tables, DB views, main program and batch jobs can be configured for replication.
Configuration is done via program RDA_MAINTAIN in table RDA_CONFIG.

Application Accelerator - Configuration

RDA_CONFIG table maintenance

RDA_CONFIG table sample entries

Application Accelerator Installation Procedure

SAP Business Application Accelerator User Documentation - SAP note 1694697. Add On package needs to be installed (SAP Note 1713986 and 1716826) Upgrade SAP Kernel of AS to 7.2.1 Activation of SAP Business Application Accelerator need to be done by enabling the profile parameter as rsdb/rda = on in transaction RZ11. Data needs to be replication from SAP Business suite system to HANA environment SLT is the replication mechanism suggested by SAP here. Set secondary database connection for the scenario using report RDA_MAINTAIN

ABAP Database Connectivity (ADBC)


Object-based ABAP API for programming relational database access Access to entire SQL functionality of underlying DB system Dynamic creation and execution of native SQL statements via respective API methods Clean concept for multiple DB connections (connections are associated to connection objects) ADBC is the mechanism to connect to any secondary data base and is not specific to the HANA DB Exception handling API methods have well-defined exceptions that can be handled

ADBC Features

ADBC Configuration

Data base table DBCON Transaction DBCO to maintain table DBCON Transaction DBA_COCKPIT to maintain table DBCON and test the secondary data base connection

ADBC Your Tools


CL_SQL_CONNECTION

GET_CONNECTION Opens a Connection to a Database CLOSE Closes an Open Database Connection GET_CON_NAME Returns the Connection Name Entered in the DBCON ROLLBACK and COMMIT

CL_SQL_PREPARED_STATEMENT / CL_SQL_STATEMENT

EXECUTE_DDL Execute a DDL Operation (For Example, CREATE TABLE) EXECUTE_QUERY Execute an SQL Query EXECUTE_UPDATE Execute a DML Operation (INSERT, UPDATE, DELETE) PREPARE / CLOSE Prepare / release an SQL Statement SET_PARAM - Set an Input/Output Parameter (variants for CLOB, BLOB, STRUCT) PREPARED_QUERY, PREPARED_UPDATE - Execute a Prepared Query / DML Operation

CL_SQL_RESULT_SET

SET_PARAM Set reference to output parameter (variants for CLOB, BLOB, STRUCT, TABLE) NEXT Read next record in the resulting set NEXT_PACKAGE Read next set of records for internal tables

Go through the classes in class builder SE24

- 51 Fundamentals of SAP HANA - v1 6.pptx

Calling SQL Procedure using ADBC

- 53 Fundamentals of SAP HANA - v1 6.pptx

SAP HANA Extended Application Services (XS Engine)


A light weight application server that is deeply integrated in to the HANA DB Web based data access via http Build stand alone applications (mobile, browser) without the need of an additional application server in the landscape Lower TCO Enables better performance due to the tight integration with data

Data Access from SAP HANA


ODATA Services
for building light weight stand alone web applications on SAP HANA a REST based web protocol for querying and updating data

defines operations on data using HTTP commands (for example, GET, PUT, POST, and DELETE)
data is transferred over HTTP using the Atom or JSON format

XMLA Interface
for building light weight stand alone web applications on SAP HANA for OLAP processing using Multi Dimensional Expression (MDX) Queries uses SOAP based XML APIs to exchange analytical data between a web based application and the Hana database

Server-Side JavaScript
make use of a powerful set of specially developed API functions interact with Sap HANA XS runtime environment directly access SAP HANA database capabilities unlike OData services and xmla, server side java scripts not only enables you to expose, but also to update, insert and delete data

Full Text Search Capabilities

One major benefit of the column store technique in SAP HANA is fast search access to character based columns. Text search is integrated in to HANA SQL using CONTAINS, which can be used in the WHERE clause of a select statement.

Types of text search in SAP HANA


Linguistic search Multi column search Fuzzy search

- 57 Fundamentals of SAP HANA - v1 6.pptx

Questions?

Copyright 2012 Deloitte Development LLC. All rights reserved.

Copyright 2012 Deloitte Development LLC. All rights reserved.

You might also like