SAP HANA als Entwicklungsplattform Matthias Kupczak SAP Forum - 12. Juni 2013 1 2 SAP HANA A Database for application logic? SAP HANA Extended Services (XS) Embedded application server 3 SAP NetWeaver Application Server on SAP HANA 4 5 SAP HANA Demo development tools In-Memory Computing CPU Memory Column Store Partitioning Compression Insert Only on Delta Logging and Backup Storage Disks © 2013 SAP AG or an SAP affiliate company. All rights reserved. 3 In-Memory Computing Implications Delegation of data intense operations to the in-memory computing Today‘s applications execute many data intense operations in the application layer Application Layer Data Layer In-Memory Computing Imperative: © 2013 SAP AG or an SAP affiliate company. All rights reserved. High performance apps delegate data intense operations to the in-memory computing layer Avoid movement of detailed data Calculate first, then move results 4 SAP HANA PlatformSAP HANA is an open platform! The Agony of Choice Not SAP applications benefitsBI,ofthird HANA capabilities! NW only AS, HTML5-based, SAP BusinessObjects party tools, any application Server https, ODBC, JDBC, oData, SQL, MDX, … Web Resource oData Service SAPdelivered XS Engine Application Services Customer Views Customer Queries Customer SQL Script Modeled / Scripted views Stored Procedures SAP HANA PLATFORM Database Layer Integration Layer logic as close as possible to the data © 2013 SAP AG or an SAP affiliate company. All rights reserved. HANA Development Physical Tables Libraries, R-integration, Hadoop, data sources Data available instantaneously Pre-defined or own developed models within the database 5 Integrated development scenarios Application Function Library (AFL) / Business function library (BFL) & Predictive Analytic Library (PAL) UI integration / SAPUI5 External Libraries / e.g. Statistical language R External Data integration / e.g. Hadoop cluster © 2013 SAP AG or an SAP affiliate company. All rights reserved. 6 SAP HANA embedded application server SAP Extended Services (XS) Scope & features • Lightweight small web-based applications • leveraging the built-in strengths of SAP HANA capabilities • Client Presentation logic Presentation artifacts HANA Control flow logic minimize “layers” • with an http-based UI (browser, mobile apps) • run directly on SAP HANA, without an additional external application server © 2013 SAP AG or an SAP affiliate company. All rights reserved. Control flow artifacts Calculation logic Data Data artifacts 7 SAP ABAP Netweaver Application Server SAP ABAP Application Architecture was built on several constraints Data does not fit into server memory completely Disk I/O is a performance bottleneck The network is a performance bottleneck The DBMS is a bottleneck (as resource shared by all users) … Application Server CPU Core CPU Cache Some of these constraints changed Data transfer between memory and CPU now an important performance bottleneck Still to be considered: Data transfer via network Performance bottleneck today: CPU waiting for data to be loaded from memory into cache Main Memory Performance bottleneck in the past: Disk I/O Disk © 2013 SAP AG or an SAP affiliate company. All rights reserved. 8 HANA Innovations Overview - SAP Applications Code Optimization Different Landscape options HANA Content (Reporting & Analytics) HANA Accelerators Business Suite on HANA • NetWeaver 7.3x first release ready for HANA • NetWeaver 7.40 massive HANA optimizations Suite on HANA (NW 7.40) Client Apps BW VDL PLM Any DB HANA DB SRM SAP Business Suite SCM HANA DB ERP Any DB (VDL) Client CRM SAP Business Suite SAP Business Suite • Benefits of Hana optimization and full support of HANA capabilities • DDIC integration of HANA artifacts • Optimized tools, e.g. Trace tools, code inspector, etc. Switch Framework after DB migration • Non disruptive, independent optimization without changing business logic HANA DB • © 2013 SAP AG or an SAP affiliate company. All rights reserved. 9 Different Optimization Categories NW ABAP Optimizations AS ABAP • NEW tools for optimization with NW 7.40 • e.g. code inspections, • Get SAP standard optimizations • Extended UI experiences due to HANA capabilitites © 2013 SAP AG or an SAP affiliate company. All rights reserved. Push down • Optimize ABAP source code examples • Replace „SELECT * …“ into „SELECT <fieldlist>“ • SQL push down instead of loop internal table HANA Dev. • using HANA capabilities • Implementation of complete new processes • Integrate with external data and or programming libraries • Extend the varity of client tools 10 NW 7.40 AS ABAP optimization tools • SQL Trace (ST05) • Runtime Analysis (SAT) • Code Inspector (SCI) • DBACOCKPIT (ST04) • Statistical records (STAD) • Memory Analysis (S_MEMORY_INSPECTOR) © 2013 SAP AG or an SAP affiliate company. All rights reserved. 11 Optimizing ABAP code using Open SQL “Old” ABAP Code the column FOR store by selecting OPENLeverage CURSOR ld_cursor SELECT only * required columns! FROM (ls_tablenames-tot_table) CONNECTION (i_dbcon_name) WHERE rldnr = ld_ledger Leverage SAP HANA capabilities by AND rrcty IN i_range_rrcty selecting from HANA views AND rvers IN i_range_rvers AND rbukrs IN i_range_bukrs AND ryear IN i_range_ryear AND racct IN i_range_racct to the ANDDelegate rtcuraggregations IN i_range_rtcur AND drcrk IN i_range_drcrk SAP HANA database! AND rpmax IN i_range_rpmax AND (it_where_clause) ORDER BY (it_orderlist). © 2013 SAP AG or an SAP affiliate company. All rights reserved. “New” ABAP Code SELECT (lt_fieldlist) FROM zviewsdf2 CONNECTION (i_dbcon_name) WHERE rldnr = g_leading_rldnr AND rrcty EQ '0' AND bukrs IN gt_ranges_bukrs AND rbusa IN gt_ranges_gsber AND racct IN gt_ranges_racct AND ryear IN gt_ranges_ryear AND (lt_where_clause) GROUP BY (lt_grouplist) ORDER BY (lt_orderlist). *connection (DBCON) refers to a secondary DB connection. Also known as side-car, side-by-side HANA setup 12 SAP HANA Platform Development NW AS, HTML5-based, SAP BusinessObjects BI, third party tools, any application Server https, ODBC, JDBC, oData, SQL, MDX, … Web Resource oData Service SAPdelivered XS Engine Application Services Customer Views Customer Queries Customer SQL Script Modeled / Scripted views Stored Procedures SAP HANA PLATFORM Database Layer Integration Layer logic as close as possible to the data © 2013 SAP AG or an SAP affiliate company. All rights reserved. HANA Development Physical Tables Libraries, R-integration, Hadoop, data sources Operational data available instantaneously Pre-defined or own developed models within the database 13 Scripting Modeling SAP HANA Modeling / Development Views SQL Script Main procedural language of the SAP HANA database Push data intensive operations into the database Utilized in script-based Calculation views and procedures Intregr. Libraries Attribute Views (Dimensions, Time, Hierarchy, Derived) Analytic Views (Star schemas, facts, calculations) Calculation Views (Composite views, Modeled or Script) Transportable design time artifacts stored in the repository Runtime objects (Column store views) are generated from the modeled views Leverage the power of external libraries Open-Source, statistical functions through R Integration leveraging predefined functions SAP HANA Development © 2013 SAP AG or an SAP affiliate company. All rights reserved. 14 DEMO Plunge into the real world… 1) Developing HANA Models 2) Consume HANA artifacts with SAP NW Application Server 3) Expose data directly into the web – HANA XS (HTML5 UI) How to start? SAP Services & more… • HANA LAB • AMAZON © 2013 SAP AG or an SAP affiliate company. All rights reserved. 16 Zusammenfassung – 5 Punkte zum Mitnehmen 1. SAP HANA is an open & integrated development Platform (IDE) 2. Application logic is moving into the database layer 3. HANA development platform provides standard interfaces 4. New SAP NW applications significantly benefit of HANA capabilities… 5. … BUT is further on database independent © 2013 SAP AG or an SAP affiliate company. All rights reserved. 17 Thank you! Matthias Kupczak Consultant HANA CoE Switzerland SAP Switzerland AG Althardstrasse 80 8105 Regensdorf T +41 566 63 96 Matthias.kupczak@sap.com www.sap.com © 2013 SAP AG or an SAP affiliate company. All rights reserved. Appendix 1) Consume HANA DB objects post NW 7.40 2) Consume HANA DB objects with NW 7.40 3) Translate open SQL to native SQL 4) SAP HANA (XS) technics Open SQL: Access HANA Calculation View • Create Calculation View with SAP HANA Studio • “connection“ in source code links to a predefined 2nd DB connection © 2013 SAP AG or an SAP affiliate company. All rights reserved. 20 ADBC native SQL – ABAP DB connection • • Read HANA artifacts via ADBC classes. HANA specific SQL – no limitations © 2013 SAP AG or an SAP affiliate company. All rights reserved. 21 Improvements with NW 7.40 • Data dictionary (DDIC) is extended to include HANA Views • DDIC TYPE ‘external View’ • ABAP reports directly connect DDIC objects via open SQL • Extended UI experience • new ALV variant, fault-tolerant value helps, Analytical side-panels) Further Optimizations 80% of ERP core Transactions / reports are in scope of optimizations (Most used / long running) Complete process optimizations New processes developed due to using HANA capabilities © 2013 SAP AG or an SAP affiliate company. All rights reserved. 22 Example: Translation of Open SQL to Native SQL Open SQL statement Application Server Application ABAP VM Table Buffer Open SQL Native SQL Database Interface (DBI) Translated to native SQL (taken from SQL trace; ST05) Database Specific Library (DBSL) DB Server For ABAP Native SQL Other DB Sever © 2013 SAP AG or an SAP affiliate company. All rights reserved. DB Client Native SQL 23 XS ENGINE • • • UIS SAPUI5 UI Rendering completely in the Client Server-side procedural logic in JavaScript All artifacts stored in the SAP HANA Repository • © 2013 SAP AG or an SAP affiliate company. All rights reserved. XSODATA XSJS XSXMLA InA HDBRole HDBTable CDS SQLScript SQL Views AFL 24 Code Optimization Maximal Flexibility – Minimal Disruption SAP HANA optimizations: Display Business Function (SFW2) Additional views Stored procedures (code pushdown to SAP HANA) To be activated via switch framework ‒ no change in business logic after migration to SAP HANA All switches are reversible Switches can be activated independently Maximal flexibility in consumption of optimizations Minimal disruption for customer business Custom Code (ABAP reports) • Regression tests for own code recommended after SAP HANA migration © 2013 SAP AG or an SAP affiliate company. All rights reserved. 25