CD162
Accelerating ABAP Applications Using the Best Features in
SAP HANA
Dr. Jasmin Gruschke, SAP AG
Dr. Steffen Weinstock, SAP AG
Tobias Wenner, SAP AG
September, 2012
Disclaimer
This presentation outlines our general product direction and should not be relied on in making a purchase decision.
This presentation is not subject to your license agreement or any other agreement with SAP. SAP has no
obligation to pursue any course of business outlined in this presentation or to develop or release any functionality
mentioned in this presentation. This presentation and SAP's strategy and possible future developments are subject
to change and may be changed by SAP at any time for any reason without notice. This document is provided
without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of
merchantability, fitness for a particular purpose, or non-infringement. SAP assumes no responsibility for errors or
omissions in this document, except if such damages were caused by SAP intentionally or grossly negligent.
© 2012 SAP AG. All rights reserved.
2
Agenda
SAP HANA Application Accelerator
Take Full Advantage of the HANA SQL Functionality with ABAP Database Connectivity (ADBC)
HANA Full Text Search Capabilities
Pushing down Code to HANA with SQLScript
Outlook and Summary
© 2012 SAP AG. All rights reserved.
3
SAP HANA Application Accelerator
SAP HANA Application Accelerator I
ERP System
Appl.
Server 1
Suite Accelerator
Instr.
Appl.
Server
Appl.
Server 2
rsdb/rda = on
Hana data
base
Main data base
Replication
© 2012 SAP AG. All rights reserved.
5
Demo
SAP HANA Application Accelerator II
© 2012 SAP AG. All rights reserved.
7
SAP HANA Application Accelerator – Useful documentation links
User documentation -> SAP note 1694697
Secondary database connections -> SAP note 1517236
Installation of the replication service -> http://service.sap.com/~sapidb/011000358700000604912011
© 2012 SAP AG. All rights reserved.
8
ABAP Database Connectivity (ADBC)
ABAP Database Connectivity (ADBC)
© 2012 SAP AG. All rights reserved.
10
ADBC - Introduction
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)
 Exception handling – API methods have well-defined exceptions that can be handled
© 2012 SAP AG. All rights reserved.
11
ADBC – Typical steps
Create a database connection
Reading from the database
Creating a database table
Changing database objects
Inserting data into the database
Error Handling
© 2012 SAP AG. All rights reserved.
12
ADBC – Your tools
CL_SQL_CONNECTION
Have a look at the
Classbuilder (SE24)
or Transaction SE80!
 GET_CONNECTION
 CREATE_STATEMENT and PREPARE_STATEMENT
 ROLLBACK and COMMIT
CL_SQL_PREPARED_STATEMENT / CL_SQL_STATEMENT




PREPARE / CLOSE – Prepare / release an SQL Statement
SET_PARAM - Set an Input/Output Parameter (variants for CLOB, BLOB, STRUCT, TABLE (available soon))
PREPARED_QUERY, PREPARED_UPDATE - Execute a Prepared Query / DML Operation
EXECUTE_DDL, EXECUTE_QUERY, EXECUTE_UPDATE - Execute DDL, Query, DML (Insert, Update, Delete)
CL_SQL_RESULT_SET
 SET_PARAM - Set an Input/Output Parameter (variants for CLOB, BLOB, STRUCT, TABLE)
 NEXT, NEXT_PACKAGE – Read next record in the resulting set, or next set of records for internal tables
© 2012 SAP AG. All rights reserved.
13
Demo
Exercise
Suggested solution
HANA full text search capabilities
HANA - Powerful and high-speed text search
Linguistic search
Multi column search
Fuzzy search
© 2012 SAP AG. All rights reserved.
18
Demo
Pushing down code to HANA with
SQLScript
SQLScript - Motivation
Procedural extension of SQL
Example use case: Extensive computations on database content in ABAP
“Classic way”
Load all data into application server and compute
•
All data is copied
•
No parallel execution
© 2012 SAP AG. All rights reserved.
“HANA way”
Compute on database and load results
•
Only result data is copied
•
Parallel execution in database
21
SBOOK example
SBOOK
SCURR
carrier
booking date
currency/amount
date
source/target currency
conversion rate
Total booking volume
per airline in one
given currency
© 2012 SAP AG. All rights reserved.
22
Demo
SBOOK example in ABAP
SQLScript - Syntax
Example for procedure with two scalar IN-parameters and one tabular OUT-parameter
CREATE PROCEDURE myprocedure
( IN from
nvarchar(3),
IN to
nvarchar(3),
OUT result spfli
)
LANGUAGE SQLSCRIPT AS
BEGIN
result = select * from spfli where airpfrom = :from
and
airpto
= :to;
END
© 2012 SAP AG. All rights reserved.
24
Demo
SBOOK example: create SQLScript procedure
SQLScript - Call
Create transfer table for tabular output parameter
CREATE GLOBAL TEMPORARY ROW TABLE cd162_cuco_tab
( name nvarchar(20), amount decimal(15,2) )
Make sure it is empty
DELETE FROM cd162_cuco_tab
Call the procedure
CALL cd162_proc_cuco( ? , cd162_cuco_tab) WITH OVERVIEW
Get the result data
SELECT * FROM cd162_cuco_tab
© 2012 SAP AG. All rights reserved.
26
Demo
SBOOK example: run both implementations
Exercise
Suggested solution
Outlook and summary
SQLScript - Outlook
Next release of ABAP contains built-in call
for SQLScript procedures
© 2012 SAP AG. All rights reserved.
31
Summary
Non-disruptive performance boosts thanks to SAP HANA Application Accelerator
Exploit the tremendous HANA SQL Features (e.g. Business Function Library)
Powerful and high-speed text search
Accelerate applications by pushing down code to HANA
© 2012 SAP AG. All rights reserved.
32
SAP NetWeaver Application Server ABAP
Empowering classic & new SAP products and Custom Development
• 50.000+ customers of ABAP-based products
MOBILITY
• Millions of ABAP developers, SCN as community
• Proven, robust and scalable
• Extends into HANA, Mobility and Cloud
SAP NetWeaver
Application
Server ABAP
CLOUD
• A thriving partner ecosystem
SAP NetWeaver in 2013
• Evolves continuously w/o disruption
• Enables hybrid on-premise/on-demand scenarios
HANA
SAP NetWeaver Application Server ABAP, a strong pillar in SAP’s product strategy
© 2012 SAP AG. All rights reserved.
33
Further information
SAP Public Web
http://scn.sap.com/community/developer-center/
http://scn.sap.com/community/abap-for-hana
SAP Education and Certification Opportunities
www.sap.com/education
Related Workshops/Lectures at SAP TechEd 2012
CD166 - SAP HANA SQL Script Basics and Troubleshooting (hands-on)
CD202 – ABAP for SAP HANA: Building Business Applications Optimized for In-Memory
TEC204 – How to migrate to SAP HANA
© 2012 SAP AG. All rights reserved.
34
Feedback
Please complete your session evaluation for CD162
Thanks for attending this SAP TechEd session.
© 2012 SAP AG. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of
SAP AG. The information contained herein may be changed without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software components of other software
vendors.
Microsoft, Windows, Excel, Outlook, PowerPoint, Silverlight, and Visual Studio are registered trademarks of Microsoft
Corporation.
IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, z10,
z/VM, z/OS, OS/390, zEnterprise, PowerVM, Power Architecture, Power Systems, POWER7, POWER6+, POWER6,
POWER, PowerHA, pureScale, PowerPC, BladeCenter, System Storage, Storwize,
XIV, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, AIX, Intelligent Miner, WebSphere, Tivoli, Informix,
and Smarter Planet are trademarks or registered trademarks of IBM Corporation.
Linux is the registered trademark of Linus Torvalds in the United States and other countries.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are trademarks or registered trademarks of Adobe Systems
Incorporated in the United States and other countries.
Oracle and Java are registered trademarks of Oracle and its affiliates.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered
trademarks of Citrix Systems Inc.
HTML, XML, XHTML, and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium,
Massachusetts Institute of Technology.
Apple, App Store, iBooks, iPad, iPhone, iPhoto, iPod, iTunes, Multi-Touch, Objective-C, Retina, Safari, Siri,
and Xcode are trademarks or registered trademarks of Apple Inc.
Google App Engine, Google Apps, Google Checkout, Google Data API, Google Maps, Google Mobile Ads, Google Mobile
Updater, Google Mobile, Google Store, Google Sync, Google Updater, Google Voice,
Google Mail, Gmail, YouTube, Dalvik and Android are trademarks or registered trademarks of Google Inc.
INTERMEC is a registered trademark of Intermec Technologies Corporation.
Wi-Fi is a registered trademark of Wi-Fi Alliance.
Bluetooth is a registered trademark of Bluetooth SIG Inc.
Motorola is a registered trademark of Motorola Trademark Holdings LLC.
Computop is a registered trademark of Computop Wirtschaftsinformatik GmbH.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP BusinessObjects Explorer, StreamWork,
SAP HANA, and other SAP products and services mentioned herein as well as their respective logos are trademarks or
registered trademarks of SAP AG in Germany and other countries.
Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence,
Xcelsius, and other Business Objects products and services mentioned herein as well as their respective logos are
trademarks or registered trademarks of Business Objects Software Ltd. Business Objects is an SAP company.
Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and other Sybase products and services mentioned
herein as well as their respective logos are trademarks or registered trademarks of Sybase Inc. Sybase is an SAP company.
Crossgate, m@gic EDDY, B2B 360°, and B2B 360° Services are registered trademarks of Crossgate AG
in Germany and other countries. Crossgate is an SAP company.
All other product and service names mentioned are the trademarks of their respective companies. Data contained in this
document serves informational purposes only. National product specifications may vary.
The information in this document is proprietary to SAP. No part of this document may be reproduced, copied,
or transmitted in any form or for any purpose without the express prior written permission of SAP AG.
IOS is a registered trademark of Cisco Systems Inc.
RIM, BlackBerry, BBM, BlackBerry Curve, BlackBerry Bold, BlackBerry Pearl, BlackBerry Torch, BlackBerry Storm,
BlackBerry Storm2, BlackBerry PlayBook, and BlackBerry App World are trademarks or registered trademarks of Research in
Motion Limited.
© 2012 SAP AG. All rights reserved.
36