46
www.smartShiftTech.com ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift Technologies

ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

Embed Size (px)

Citation preview

Page 1: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

www.smartShiftTech.com

ABAP Code Optimization for SAP HANA

Webinar Presenter:

Albrecht Gass

Chief Architect, smartShift Technologies

Page 2: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

Moderator

8/13/2013 2 © 2013 smartShift Technologies. All rights reserved

Manasi Kakade

Product Marketing Manager

smartShift Technologies

Page 3: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

1. Introduction smartShift Technologies

2. SAP HANA Overview

3. New Performance Rules

4. Optimized ABAP Code Examples

5. Q & A

6. Further ABAP Resources

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

Agenda

© 2013 smartShift Technologies. All rights reserved 8/13/2013 3

Page 4: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

www.smartShiftTech.com

About smartShift

Technologies 1

Page 5: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

About smartShift Tech

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

Page 6: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

Select Customers

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

Page 7: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

We Partner with the Best of the Breed!

© 2013 smartShift Technologies. All rights reserved 8/13/2013 7

Page 8: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

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

smartScale for HANA Offering

8/13/2013 8

Page 9: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

Presenter

8/13/2013 9 © 2013 smartShift Technologies. All rights reserved

Albrecht Gass

Chief Architect

smartShift Technologies

Page 10: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

www.smartShiftTech.com

SAP HANA Overview 2

Page 11: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

• Column and Row Store

• Dictionary based (compression)

• ACID RDBMS

• Stand-alone or SAP Business Suite/BW

• JBDC, 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

SAP HANA Overview

8/13/2013 11

Page 12: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

• 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

SAP HANA Overview

8/13/2013 12

Page 13: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

• 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

HANA “Objectives”

8/13/2013 13

Page 14: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

© 2013 smartShift Technologies. All rights reserved

Attribute View

8/13/2013 14

• Can join multiple tables

• Perform simple calculations

• Only SQL Functions can be used

Page 15: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

© 2013 smartShift Technologies. All rights reserved

Analytical View

8/13/2013 15

• Replaces cubes in traditional BW

• Joins attribute views and fact tables

• Perform calculations and aggregations

• Only SQL Functions can be used

Page 16: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

© 2013 smartShift Technologies. All rights reserved

Calculated View

8/13/2013 16

• Full SQLScript

• Must define output record type

• Supports measures and hierarchies

• Callable via standard OPENSQL

Page 17: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

© 2013 smartShift Technologies. All rights reserved

DB Procedure

8/13/2013 17

• Full SQLScript

• Can define a output record type

• Callable via CALL DATABASE PROCEDURE

• Creates table types for input and output arguments

Page 18: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

© 2013 smartShift Technologies. All rights reserved

DB Procedure (cont.)

8/13/2013 18

Page 19: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

© 2013 smartShift Technologies. All rights reserved

Externalizing a HANA view to be used in ABAP

8/13/2013 19

• View defined in HANA

• Externalized so that it can be referenced by ABAP code

• Can be used in OpenSQL statements

Page 20: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

© 2013 smartShift Technologies. All rights reserved

Externalizing a view on MARA to be used by ABAP

8/13/2013 20

The view is now visible in DDIC and can be used in ABAP programming, e.g. for declarations, selections, etc.

Page 21: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

www.smartShiftTech.com

Performance Guidelines

and Rules 3

8/13/2013 21

Page 22: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

• 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. All rights reserved

HANA Optimization Guidelines

8/13/2013 22

Page 23: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

• Side-car vs. 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. All rights reserved

HANA Implementation Considerations

8/13/2013 23

Page 24: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

These patterns focus on the push-down paradigm as well as on restrictions that HANA

is imposing.

Locate joins on transactional table

Locate “SELECT … FOR ALL ENTRIES” statements

Locate SQL on SAP “index” tables (i.e. VAPMA)

Clusters of related table SQL (i.e. VBAK, VBUK, 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. All rights reserved

New HANA Performance Rules

8/13/2013 24

Page 25: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

www.smartShiftTech.com

Optimized ABAP Code

Examples 4

8/13/2013 25

Page 26: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

• Originally using nested SELECT FOR ALL ENTRIES

© 2013 smartShift Technologies. All rights reserved

Example 1 – Using an external view

8/13/2013 26

Page 27: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

• Model a view based on a join of LIKP and LIPS

© 2013 smartShift Technologies. All rights reserved

Example 1 – Using an external view (2)

8/13/2013 27

Page 28: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

• Make the new view visible to app layer: define a dictionary view

© 2013 smartShift Technologies. All rights reserved

Example 1 – Using an external view (2)

8/13/2013 28

Page 29: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

© 2013 smartShift Technologies. All rights reserved

Example 1 – Using an external view (3)

13.08.2013 29

Replacing SELECT ... FOR ALL ENTRIES:

• Required data is provides by View ZV_ERROR_DOCS, based on VBUK, VBFS,

VBSK,

• Join of ZV_ERROR_DOCS with ZV_DELIVERY_DATA,

• Integration of pre-requisite conditions, selection criteria and type

Page 30: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

• Original code as in example 1

© 2013 smartShift Technologies. All rights reserved

Example 2 – Pushing code to DB layer

8/13/2013 30

Page 31: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

• Define procedure parameters

© 2013 smartShift Technologies. All rights reserved

Example 2 – Pushing code to DB layer (2)

8/13/2013 31

Page 32: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

• Generated interface object, to be used in application logic

© 2013 smartShift Technologies. All rights reserved

Example 2 – Pushing code to DB layer (3)

8/13/2013 32

Page 33: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

• SQL script that implements reading from relevant tables

© 2013 smartShift Technologies. All rights reserved

Example 2 – Pushing code to DB layer (4)

8/13/2013 33

Page 34: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

• Modify code to use interface / call procedure

© 2013 smartShift Technologies. All rights reserved

Example 2 – Pushing code to DB layer (5)

8/13/2013 34

Page 35: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

• 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”, the new ALV grid model, also called IDA-ALV (inegrated data access list viewer), implements much of the processing in the DB layer

• Example from NW 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. All rights reserved

NetWeaver 7.4 ABAP Enhancements

8/13/2013 35

Page 36: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

• Internal Tables with Empty Keys

• New Internal Table Functions

• ABAP Objects (Exporting, 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. All rights reserved

NetWeaver 7.4 ABAP Enhancements (cont.)

8/13/2013 36

Page 37: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

© 2013 smartShift Technologies. All rights reserved

Use of Integrated Data Access List Grid (IDA-ALV)

8/13/2013 37

Page 38: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

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

smartScale for HANA Offering

8/13/2013 38

Page 39: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

www.smartShiftTech.com

Q & A 5

© 2013 smartShift Technologies. All rights reserved 8/13/2013 39

Page 41: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

Where to start?

8/13/2013 41 © 2013 smartShift Technologies. All rights reserved

Get Started with Your HANA Proof of Concept

Page 42: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

www.smartShiftTech.com

Further Resources 6

© 2013 smartShift Technologies. All rights reserved 8/13/2013 42

Page 43: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

High-level Info

• Main Landing Page

http://www.saphana.com/welcome

• HANA Academy (Instructional Videos)

http://www.saphana.com/community/implement/hana-

academy

• SAP HANA One Cloud

http://www.saphana.com/community/learn/cloud

• SAP HANA Marketplace

http://www.saphana.com/community/marketplace

© 2013 smartShift Technologies. All rights reserved

Online Resources

8/13/2013 43

Page 44: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

Developer Level

• SAP community center

It is highly recommended to join SCN (SAP Community Network,

www.scn.com ) if you have not done so. Besides a dedicated HANA space

(http://scn.sap.com/community/hana-in-memory) you can also find

interesting information on related spaces (e.g. NW 7.4, mobility, cloud

computing).

• 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.sap.com/community/developer-center/hana). 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.hana.ondemand.com/hanadevedition). Again,

a resource highly recommended for developers. Please do check from time

to time for the latest revision (yes, it makes a difference).

• openSAP

Massive Open Online Course for HANA at https://open.sap.com/

© 2013 smartShift Technologies. All rights reserved

Online Resources

8/13/2013 44

Page 45: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

NW 7.4 ABAP Enhancements

• Blog Series by Host Keller

http://scn.sap.com/people/horst.keller/blog

• Netweaver Blog

http://scn.sap.com/community/netweaver/blog

• NW 7.4 Landing Page

http://scn.sap.com/docs/DOC-35002

© 2013 smartShift Technologies. All rights reserved

Online References

8/13/2013 45

Page 46: ABAP Code Optimization for SAP HANAdocshare04.docshare.tips/files/31075/310753318.pdf · ABAP Code Optimization for SAP HANA Webinar Presenter: Albrecht Gass Chief Architect, smartShift

• Where to get sample data?

o ERP data / SFLIGHT

Please refer to http://scn.sap.com/docs/DOC-32854 (needs SCN

account)

o Open Items Analytics

Please refer to http://scn.sap.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.infochimps.com/datasets. They come as CSV

files which you can easily import into your HANA instance.

© 2013 smartShift Technologies. All rights reserved

Online References

8/13/2013 46