Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Agenda
HANA modeling
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
-5-
Running Head
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
Memory (RAM)
64 bit address space 100 GB/s data throughput Lower cost
Compression
Partitioning
-7-
Partitioning
-8-
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-
Languages Supported SQL Script Language R Business Function Library Predictive Analysis Library
- 10 -
SAP HANA
DS / DXC
Business Warehouse
Traditional DB
Agile Data Marts Operational Data Marts COPA Accelerators SAP Sales and Operations Planning
Fundamentals of SAP HANA - v1 6.pptx
- 11 -
Business Warehouse
HANA DB
HANA DB
- 12 -
- 13 -
Data Provisioning
HANA Studio
Application Tables
DB Connection
Application Tables
- 15 -
SLT Server
SAP HANA
Application Tables
Logging Tables
Write Module
DB Trigger
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 A System B
Source System
Schema 1
SAP HANA
System SchemaA 2
Source System SAP HANA System
- 17 -
System A
System SchemaA 1
- 18 -
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
Database Layer
Calculation
Fundamentals of SAP HANA - v1 6.pptx
- 20 -
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 -
- 22 -
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
Yes
Compilation One time only execution plan Stored in memory in terms of calculation models
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 -
Declarative-Logic
Functional Extension
- 27 -
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.
- 29 -
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
Table Variables
Binding of variables
- 31 -
Bound Bound
variables of type table in the FROM clause which were bound by an earlier statement
- 32 -
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
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 -
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
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])
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
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 -
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.
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 -
Agenda
Application Accelerator
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.
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
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
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
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
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.
Questions?