You are on page 1of 46

ABAP Code Optimization for SAP HANA

Webinar Presenter:

Albrecht Gass
Chief Architect, smartShift Technologies

www.smartShiftTech.com

Moderator

Manasi Kakade
Product Marketing Manager
smartShift Technologies

© 2013 smartShift Technologies. All rights reserved

8/13/2013

2

Agenda

1.
2.
3.
4.
5.
6.

Introduction smartShift Technologies
SAP HANA Overview
New Performance Rules
Optimized ABAP Code Examples
Q&A
Further ABAP Resources

Note: You can also continue discussion via Twitter @smartShiftTech with #smartSAPHANA

© 2013 smartShift Technologies. All rights reserved

8/13/2013

3

1

About smartShift
Technologies

www.smartShiftTech.com

About smartShift Tech © 2013 smartShift Technologies. All rights reserved 8/13/2013 5 .

All rights reserved 8/13/2013 6 .Select Customers © 2013 smartShift Technologies.

We Partner with the Best of the Breed! © 2013 smartShift Technologies. All rights reserved 8/13/2013 7 .

smartScale for HANA Offering smartScale for HANA will consists of the appropriate components with newly added HANA Code Optimization Ruleset. • smartAnalyze o SaaS Analysis • smartUpgrade o Unicode Enablement o Change Impact Analysis • smartDevelop o On-going ABAP Code Remediation © 2013 smartShift Technologies. All rights reserved 8/13/2013 8 .

Presenter Albrecht Gass Chief Architect smartShift Technologies © 2013 smartShift Technologies. All rights reserved 8/13/2013 9 .

smartShiftTech.com .2 SAP HANA Overview www.

ODBC. ADBC. MDX Unstructured Data Support Full Text Searchable HW Appliance or Cloud Deployment Advanced Calculation Engine Historic Data © 2013 smartShift Technologies. All rights reserved 8/13/2013 11 .SAP HANA Overview • • • • • • • • • • Column and Row Store Dictionary based (compression) ACID RDBMS Stand-alone or SAP Business Suite/BW JBDC.

All rights reserved 8/13/2013 12 .SAP HANA Overview • • • • • • • • • Unicode Only Integration with ‘R’ Large Tables Dynamic Tables ABAP Code Must be Optimized Eclipse based IDE (ADT) Optimization for Star Queries Signification Performance Improvements ALV paging for large results © 2013 smartShift Technologies.

All rights reserved 8/13/2013 13 .HANA “Objectives” • Does not impact transaction processing • Enables “reporting without fear” by increasing reporting speeds dramatically • Eliminates SAP as Access Loader • Keeps processing within SAP and not Excel • Avoid using old and/or partial data • Convert batch processes to real-time operations • Enable new big data processes © 2013 smartShift Technologies.

All rights reserved 8/13/2013 14 .Attribute View • Can join multiple tables • Perform simple calculations • Only SQL Functions can be used © 2013 smartShift Technologies.

Analytical View • • • • Replaces cubes in traditional BW Joins attribute views and fact tables Perform calculations and aggregations Only SQL Functions can be used © 2013 smartShift Technologies. All rights reserved 8/13/2013 15 .

All rights reserved 8/13/2013 16 .Calculated View • • • • Full SQLScript Must define output record type Supports measures and hierarchies Callable via standard OPENSQL © 2013 smartShift Technologies.

DB Procedure • • • • Full SQLScript Can define a output record type Callable via CALL DATABASE PROCEDURE Creates table types for input and output arguments © 2013 smartShift Technologies. All rights reserved 8/13/2013 17 .

DB Procedure (cont.) © 2013 smartShift Technologies. All rights reserved 8/13/2013 18 .

Externalizing a HANA view to be used in ABAP • View defined in HANA • Externalized so that it can be referenced by ABAP code • Can be used in OpenSQL statements © 2013 smartShift Technologies. All rights reserved 8/13/2013 19 .

e. for declarations.Externalizing a view on MARA to be used by ABAP The view is now visible in DDIC and can be used in ABAP programming. selections.g. etc. All rights reserved 8/13/2013 20 . © 2013 smartShift Technologies.

smartShiftTech.com .3 Performance Guidelines and Rules 8/13/2013 21 www.

All rights reserved 8/13/2013 22 .HANA Optimization Guidelines • • • • • • • • • • Reduce result set Reduce amount of data transfer Reduce number of DB round trips Index/Query optimization Text search for F4 help and type-ahead search Avoid native SQL Consider changes in the order in the result Use buffering on application server Existing best practices still apply Don’t overload HANA server © 2013 smartShift Technologies.

Primary DB • Instance Size o Memory o CPU • • • • Table Partitioning Consider Changes in Query Result Ordering Incompatible Native SQL Code Unicode Requirement © 2013 smartShift Technologies.HANA Implementation Considerations • Side-car vs. All rights reserved 8/13/2013 23 .

e.New HANA Performance Rules These patterns focus on the push-down paradigm as well as on restrictions that HANA is imposing. VBUK.           Locate joins on transactional table Locate “SELECT … FOR ALL ENTRIES” statements Locate SQL on SAP “index” tables (i. VBAK. All rights reserved 8/13/2013 24 . VAPMA) Clusters of related table SQL (i.e. VBAP) Custom read cluster tables Sort of internal tables sourced from SQL Processing of internal tables sourced from SQL Perform unit conversion ALV Optimization DB Migration rules © 2013 smartShift Technologies.

smartShiftTech.4 Optimized ABAP Code Examples 8/13/2013 25 www.com .

Example 1 – Using an external view • Originally using nested SELECT FOR ALL ENTRIES © 2013 smartShift Technologies. All rights reserved 8/13/2013 26 .

All rights reserved 8/13/2013 27 .Example 1 – Using an external view (2) • Model a view based on a join of LIKP and LIPS © 2013 smartShift Technologies.

All rights reserved 8/13/2013 28 .Example 1 – Using an external view (2) • Make the new view visible to app layer: define a dictionary view © 2013 smartShift Technologies.

2013 29 .08.. All rights reserved 13. selection criteria and type © 2013 smartShift Technologies. VBFS.Example 1 – Using an external view (3) Replacing SELECT . FOR ALL ENTRIES: • • • Required data is provides by View ZV_ERROR_DOCS. Integration of pre-requisite conditions. based on VBUK.. Join of ZV_ERROR_DOCS with ZV_DELIVERY_DATA. VBSK.

All rights reserved 8/13/2013 30 .Example 2 – Pushing code to DB layer • Original code as in example 1 © 2013 smartShift Technologies.

Example 2 – Pushing code to DB layer (2) • Define procedure parameters © 2013 smartShift Technologies. All rights reserved 8/13/2013 31 .

to be used in application logic © 2013 smartShift Technologies. All rights reserved 8/13/2013 32 .Example 2 – Pushing code to DB layer (3) • Generated interface object.

Example 2 – Pushing code to DB layer (4) • SQL script that implements reading from relevant tables © 2013 smartShift Technologies. All rights reserved 8/13/2013 33 .

Example 2 – Pushing code to DB layer (5) • Modify code to use interface / call procedure © 2013 smartShift Technologies. All rights reserved 8/13/2013 34 .

also called IDA-ALV (inegrated data access list viewer).4 ABAP Enhancements • Example 2 demonstrated a new ABAP language feature: o CALL PROCEDURE • ABAP for HANA introduces a new usage pattern for a well known and commonly used programming feature: o ALV Grids • True to the motto “push code down to db layer”.NetWeaver 7.4 SP0 follows. Note that SP2 adds some features not available in SP0: o Setting field header texts o Fuzzy text search © 2013 smartShift Technologies. implements much of the processing in the DB layer • Example from NW 7. the new ALV grid model. All rights reserved 8/13/2013 35 .

All rights reserved 8/13/2013 36 . Importing and Changing. Partially Implemented Interfaces for Testing) • Table Expressions • Conditional Operators • Lossless Operator EXACT • Conversion Operators • Reference Operator • Value Operator • Constructor Operator • Inline Declarations • Expressions © 2013 smartShift Technologies.4 ABAP Enhancements (cont.NetWeaver 7.) • Internal Tables with Empty Keys • New Internal Table Functions • ABAP Objects (Exporting.

Use of Integrated Data Access List Grid (IDA-ALV) © 2013 smartShift Technologies. All rights reserved 8/13/2013 37 .

All rights reserved 8/13/2013 38 . • smartAnalyze o SaaS Analysis • smartUpgrade o Unicode Enablement o Change Impact Analysis • smartDevelop o On-going ABAP Code Remediation © 2013 smartShift Technologies.smartScale for HANA Offering smartScale for HANA will consists of the appropriate components with newly added HANA Code Optimization Ruleset.

smartShiftTech.5 © 2013 smartShift Technologies.com . All rights reserved Q&A 8/13/2013 39 www.

All rights reserved SCN LinkedIn @AlbrechtGass 8/13/2013 40 .smartShiftTech.Contact Albrecht Gass Chief Architect.com © 2013 smartShift Technologies. smartShift Technologies www.

All rights reserved 8/13/2013 41 .Where to start? Get Started with Your HANA Proof of Concept © 2013 smartShift Technologies.

com . All rights reserved Further Resources 8/13/2013 42 www.6 © 2013 smartShift Technologies.smartShiftTech.

Online Resources High-level Info • Main Landing Page http://www. All rights reserved 8/13/2013 43 .saphana.com/welcome • HANA Academy (Instructional Videos) http://www.saphana.saphana.com/community/implement/hanaacademy • SAP HANA One Cloud http://www.com/community/learn/cloud • SAP HANA Marketplace http://www.com/community/marketplace © 2013 smartShift Technologies.saphana.

Again. it makes a difference).scn.com/community/hana-in-memory) you can also find interesting information on related spaces (e. All rights reserved 8/13/2013 44 .ondemand.sap.4. Besides a dedicated HANA space (http://scn. a resource highly recommended for developers. mobility. • openSAP Massive Open Online Course for HANA at https://open.com ) if you have not done so.sap. • SAP HANA Developer Center If you are a developer and you would like to get some first hands-on experience you should check the SAP HANA Developer Center (http://scn.hana. NW 7.com/community/developer-center/hana). cloud computing).com/ © 2013 smartShift Technologies. You will get more information on how to sign up for a trial cloud instance and links to HANA client and studio software for modeling (https://hanadeveditionsapicl.Online Resources Developer Level • SAP community center It is highly recommended to join SCN (SAP Community Network.com/hanadevedition).g.sap. www. Please do check from time to time for the latest revision (yes.

sap.com/community/netweaver/blog • NW 7.sap.sap.keller/blog • Netweaver Blog http://scn.Online References NW 7. All rights reserved 8/13/2013 45 .4 Landing Page http://scn.com/people/horst.com/docs/DOC-35002 © 2013 smartShift Technologies.4 ABAP Enhancements • Blog Series by Host Keller http://scn.

© 2013 smartShift Technologies.sap.com/datasets.com/docs/DOC-35518 (needs SCN account) o Other large data Should you need large amounts of data to play with you can also look at http://www.Online References • Where to get sample data? o ERP data / SFLIGHT Please refer to http://scn.com/docs/DOC-32854 (needs SCN account) o Open Items Analytics Please refer to http://scn. All rights reserved 8/13/2013 46 .infochimps. They come as CSV files which you can easily import into your HANA instance.sap.