0% found this document useful (0 votes)
112 views75 pages

ABAP On HANA Printversion PDF

Uploaded by

蔡裕峰
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
112 views75 pages

ABAP On HANA Printversion PDF

Uploaded by

蔡裕峰
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 75

ABAP on HANA

SoH Technology Training – From Prospect to Live Customer


Xiaohua Cao
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.

© 2013 SAP AG. All rights reserved. 2


HANA Platform

Agenda
Consumption Browser Native Device
HANA
HANADatabase
Data Platform (DB)
Development
Professional Developer / IDE Business Expert / RDE
Experience Application Server ABAP
HANA Application Platform
Apps

ABAP Java
Development Tools
XS
JavaScript
Porting your Apps
HANA Cloud Platform
DB Application Logic
HANA Data Store Views Procedures

© 2013 SAP AG. All rights reserved. 3


HANA Database

ABAP Java others

DBI JDBC ODBC/ODBO

Database XS
R Connection R R
JavaScript
SQL/MDX
R

DB Application Logic
Attribute, Analytics
Views Procedures SQLScript
& Calculation Views

HANA Data Store

Column and Multi-core/ In-memory


row store parallelization Compression

© 2012 SAP AG. All rights reserved. 4


SQL
Column and Row Store

 DBs typically use a row-based storage; SAP HANA supports rows, but is optimized
for column-order data organization
Order Country Product Sales 456 France corn 1000
456 France corn 1000
457 Italy wheat 900 457 Italy wheat 900
458 Italy corn 600
458 Italy corn 600
459 Spain rice 800
459 Spain rice 800

Row order organization


Single-record access:
456 France corn 1000
SELECT * FROM SalesOrders
wheat WHERE Order = ‘457’

457 Italy 900
458 Italy corn 600
459 Spain rice 800
Single-scan aggregation:
SELECT Country, SUM(sales) FROM
Column order organization SalesOrders WHERE Product=‘corn’ GROUP BY
Country
© 2012 SAP AG. All rights reserved. 5
Parallelization

 Concurrent users
 Concurrent operations within a query
 Data partitioning, on one host quant. type sales
150 43 $1000
or distributed to multiple hosts 60 12 $900
 Horizontal and vertical 100 12 $600 core3
45 33 $800
parallelization of a single query 75 33 $500
operation, using multiple 84 12 $750

96 32 $600
cores / threads 162 43 $600
45 12 $1100 core4
366 33 $450
Transparent to app developer $2000

core1 core2

© 2012 SAP AG. All rights reserved. 6


Columnar Dictionary Compression

 Dictionary per column


 Operations directly on compressed data, using integers

Compressed
column Inverted
Logical Table Dictionary (bit fields) index
Order Country Product Sales 1 Belgium 1 3 1 7
456 France corn 1000 2 Denmark 2 4 2 5,6
457 Italy wheat 900 3 France 3 5 3 1
458 Spain rice 600 4 Italy 4 4 4 2,4,8
459 Italy rice 800 5 Spain 5 2 5 3
460 Denmark corn 500 6 2
461 Denmark rice 600 Dictionary 7 1
462 Belgium rice 600 5 entries, so 8 4 Which orders
463 Italy rice 1100 need 3 bits to … … in Italy?
… … … … encode!
Where was
order 460?

© 2012 SAP AG. All rights reserved. 7


HANA Database

ABAP Java others

DBI JDBC ODBC/ODBO

Database XS
R Connection R R
JavaScript
SQL/MDX
R

DB Application Logic
Attribute, Analytics
Views Procedures SQLScript
& Calculation Views

HANA Data Store

Column and Multi-core/ In-memory


row store parallelization Compression

© 2012 SAP AG. All rights reserved. 8


Development in SAP HANA

SAP HANA provides two essential techniques for expressing operations


on data:
• Column Views allow to easily define optimized data models for fast read
access based on database tables and views. They support standard
operations (e.g. joins, aggregations, filters) but also business functions
(e.g. for currency/measure conversion).
Column views can be modeled via graphical tools or implemented via
SQLScript in SAP HANA studio. After activation, the generated views can
be accessed via standard SQL.
• Stored Procedures allow to implement data intensive logic via
SQLScript. Procedures can have multiple importing and exporting
parameters (scalar or table types).
Both Column Views and Procedures are highly optimized to leverage the
engines in SAP HANA and can make use of advanced features like built-in
library functions, text analysis and data mining.

© 2012 SAP AG. All rights reserved. 9


HANA Database

HTTP Client
ABAP Java others (Browser, Mobile)

R HTTP
DBI JDBC ODBC/ODBO

Database XS
R Connection R R
JavaScript
SQL/MDX
R

DB Application Logic
Column Attribute, Analytics
Procedures SQLScript
Views & Calculation Views

HANA Data Store

Column and Multi-core/ In-memory


row store parallelization Compression

© 2012 SAP AG. All rights reserved. 10


Agenda
Consumption Browser Native Device

HANA
HANADatabase
Data Platform (DB)
Development
Professional Developer / IDE Business Expert / RDE
Experience
Application Server ABAP
HANA Application Platform
Development Tools
ABAP
Java
XS
JavaScript Porting your Apps
HANA Cloud Platform

DB Data Store Application Logic


HANA
Views Procedures

© 2013 SAP AG. All rights reserved. 11


SAP Business Suite powered by SAP HANA
Unifying analytics and transactions into a single in-memory platform

Real-Time
Interactions

Real-Time
Planning

Real-Time
Reporting
and Analysis
Real-Time
Execution

Real-Time
Platform

The Most Modern Business Platform for Innovation Without Disruption

© 2013 SAP AG. All rights reserved. 12


SAP NetWeaver AS ABAP 7.4
Overview
ABAP 7.4 release strategy
• ABAP 7.4 is an enhancement package for NetWeaver 7.x Custom Applications

• Underlying application server for SAP Business Suite and


SAP NetWeaver BW SAP SAP
Business NetWeaver ...
• Available already; GA is planned for May 2013 Suite BW
• There is no formal ramp-up for ABAP 7.4
ABAP Development Tools for SAP NetWeaver
Major structural news in AS ABAP 7.4
• New ABAP kernel version 7.40 supporting new ABAP SAP NetWeaver AS ABAP 7.4
server and runtime features
• NetWeaver Gateway and SAPUI5 are part of AS ABAP 7.4 SAP HANA Database Any DB
• ABAP Development Tools are part of the SAP Eclipse
Release Train (central update site for SAP Eclipse tools)

SAP NetWeaver AS ABAP 7.4 is the “to-go” release for all SAP HANA based ABAP applications

© 2013 SAP AG. All rights reserved. 13


ABAP Development on SAP HANA
Accelerate, Extend, Innovate using proven SAP NetWeaver qualities
Custom Development Opportunities

SAP Business Suite

Apps

BW
Analytics
ACCELERATE EXTEND
CRM

SCM

SRM

PLM
ERP

INNOVATE

HANA DB

Guided performance optimizations

Real-time access to any data


Benefits for customers and partners
From batch to interactive
• Proven – Built on mature NetWeaver qualities Advanced view building

• Efficient – Leverage existing investments and skills Text search

Predictive Analysis
• Non-disruptive – Step-wise approach possible

© 2013 SAP AG. All rights reserved. 14


ABAP Development on SAP HANA
Bringing the power of SAP HANA to the end-user
The most important benefit of SAP HANA is to support customers to make smarter and faster decisions.
The power of SAP HANA has to “reach the end-user” by simplifying concrete business processes.

ABAP 7.4 will support this through existing UI technologies


• New ALV variant supporting fast navigation through large data sets
(usable in SAP GUI and Web Dynpro ABAP Floorplan Manager)
• Fault-tolerant value helps using SAP HANA text search
• Analytical side-panels allowing non-disruptive enrichment of
transactions providing additional insights for end-users
• New possibilities for combining transactional and analytical data in new
consumption scenarios through NetWeaver Gateway / SAPUI5
• Full suite of SAP BI clients supported based on embedded BW

© 2013 SAP AG. All rights reserved. 15


SAP NetWeaver AS ABAP 7.4
Options for customer / partner developments

1) Accelerators for 2) Add-Ons for SoH 3) New applications 4) Add-Ons for 5) New applications
Add-Ons (side-by-side with NetWeaver BW (no direct link to
Business Suite) Business Suite)
CD / CD /
SAP SAP
CD / SAP PD Customer SAP PD Customer / Partner
Business Business
PD Business Suite / Partner NetWeaver BW Development
Suite Suite

Any DB SAP Any DB SAP


SAP HANA SAP HANA SAP HANA
HANA HANA

 accelerate existing Z-coding,  customer-specific  develop new applications  customer-specific  develop new applications
develop application-specific developments in SoH context running side-by-side with developments in NetWeaver (but no direct link to Business
accelerators  enable existing Add-Ons to Business Suite (similar HPAs) BW context Suite)
 possible also with ABAP 7.x run on SoH  specifically designed and  along the lines of 2)  along the lines of 3)
 optimize them for SAP HANA implemented for SAP HANA
technology technology
 develop completely new
Add-Ons for SoH
CD / PD = customer development / partner development

© 2013 SAP AG. All rights reserved. 16


Agenda
Consumption Browser Native Device

HANA
HANADatabase
Data Platform (DB)
Development
Professional Developer / IDE Business Expert / RDE
Experience
Application Server ABAP
HANA Application Platform
Development Tools
ABAP
Java
XS
JavaScript Porting your Apps
HANA Cloud Platform

DB Data Store Application Logic


HANA
Views Procedures

© 2013 SAP AG. All rights reserved. 17


ABAP Development on SAP HANA
Code Pushdown as paradigm

Push data-intensive calculations to SAP


HANA leading to less data transfer
Exploit advanced SAP HANA
capabilities from ABAP

 Development on each layer

© 2013 SAP AG. All rights reserved. 18


ABAP Development on SAP HANA
Overview: Integrated Development Experience based on Eclipse

• It is possible to install the new ABAP Development


tools for SAP NetWeaver into the SAP HANA studio
via the Eclipse update site mechanism.

• This integrated installation offers developers a


combined environment for end-to-end application
development with ABAP on SAP HANA including
Lifecycle Management aspects.

• ABAP 7.4 provides a reference scenario (Open


Items Analytics) which demonstrates how to develop
an ABAP application on SAP HANA, and in
particular how to integrate into existing user
interface technologies such as Web Dynpro ABAP
Floorplan Manager and SAPUI5.

© 2013 SAP AG. All rights reserved. 19


Development in SAP HANA
Column Views

SAP HANA offers advanced view modeling, e.g.


• Attribute views (join views)
• Analytic views (star schemas)
• Calculation views (modeled or coded via SQL script)

These views can be accessed by standard SQL (see example)


• With ABAP < 7.4 these views can only be accessed low-level
via native SQL (ADBC)
• With ABAP 7.40 they are natively supported in ABAP
• Access possible via standard Open SQL
• Support for automatic client handling
• Mapping to DDIC types possible

© 2013 SAP AG. All rights reserved. 20


Development in SAP HANA
Database Procedures

SAP HANA offers writing stored procedures in SQLScript –


a extension to SQL - for expressing data intensive application
logic.
Stored procedures are invoked via the CALL SQL statement
by passing the importing and exporting parameters (which
can be scalars or table types)
• With ABAP < 7.40 stored procedures can be called using
ADBC, which requires
• Manual handling of transfer tables for input and output
parameters via temporary tables or result views
• Manual mapping of database types to DDIC types
• With ABAP 7.40 they are natively supported in ABAP
• Exporting/Importing parameters like for function modules
(including mapping parameter to DDIC types)

© 2013 SAP AG. All rights reserved. 21


Demo
Accessing SAP HANA views and procedures from ABAP
Example: create and use a
HANA Attribute View

© 2013 SAP AG. All rights reserved. 23


© 2013 SAP AG. All rights reserved. 24
© 2013 SAP AG. All rights reserved. 25
© 2013 SAP AG. All rights reserved. 26
© 2013 SAP AG. All rights reserved. 27
© 2013 SAP AG. All rights reserved. 28
Proxy

© 2013 SAP AG. All rights reserved. 29


© 2013 SAP AG. All rights reserved. 30
© 2013 SAP AG. All rights reserved. 31
© 2013 SAP AG. All rights reserved. 32
© 2013 SAP AG. All rights reserved. 33
© 2013 SAP AG. All rights reserved. 34
© 2013 SAP AG. All rights reserved. 35
© 2013 SAP AG. All rights reserved. 36
Remark
• Open SQL
enhancement
available as of
NW 7.40 SP 2

© 2013 SAP AG. All rights reserved. 37


Example: use a HANA
SQL Procedure

© 2013 SAP AG. All rights reserved. 38


© 2013 SAP AG. All rights reserved. 39
© 2013 SAP AG. All rights reserved. 40
Proxy

© 2013 SAP AG. All rights reserved. 41


© 2013 SAP AG. All rights reserved. 42
© 2013 SAP AG. All rights reserved. 43
© 2013 SAP AG. All rights reserved. 44
Remark
• New ABAP
language element
available as of
NW 7.40 SP 2

© 2013 SAP AG. All rights reserved. 45


Code Pushdown – Buttom-up

Development Experience
NW AS ABAP 7.40

2. Consumption
ABAP Orchestration (ABAP Coding)
Development External Procedure
Tools DDIC Views Proxies

Bottum-up R SQL
XS

HANA
DB
Application Logic

Views Procedures
HANA Studio

1. Modelling

© 2013 SAP AG. All rights reserved. 46


Code Pushdown – Top-down

Development Experience
NW AS ABAP 7.40
Modelling &
Consumption
ABAP Orchestration (ABAP Coding)
Development ABAP managed
Views Procedures
Tools

Top-down

Generate
R SQL
XS

HANA
DB
Application Logic

Views Procedures
HANA Studio

Not needed for


ABAP development
in future

© 2013 SAP AG. All rights reserved. 47


Core Data Services (CDS)
A homogeneous approach for modeling of SAP data

Harmonize the programming model across all


SAP platforms on HANA to ensure reuse and
interoperability
River / XS

ABAP Java Other…


RDL JS

Provide
Database-/
HANA (DB)

Core Data Services DDL QL DML …


HANA
(S)QL Engine Calc Engine SQL Script optimized
programming
model
Extend SQL to capture
the business intent avoiding
complex & error prone statements

© 2013 SAP AG. All rights reserved. 48


Code Pushdown – Runtime

NW AS ABAP 7.40 NW AS ABAP < 7.40


Orchestration (ABAP Coding) NW ABAP < 7.40
call cl_sql_connection=>get_connection () • native SQL via
select ..
from .. database execute_query( ‚SELECT .. <view>‘ ) ABAP database
procedure .. execute_query(‚CALL <procedure>‘) connectivity
External Procedure (ADBC) is a valid
DDIC Views Proxies option

Open SQL IF DBI ADBC


R SQL
XS
HANA DB
Application Logic

Views Procedures

© 2013 SAP AG. All rights reserved. 49


Agenda
Consumption Browser Native Device

HANA
HANADatabase
Data Platform (DB)
Development
Professional Developer Business Expert / RDE
Experience
Application Server ABAP
Customer / Partner
Applications HANA Application Platform
Development Tools
ABAP
Java
XS
JavaScript Porting your Apps
HANA Cloud Platform

DB Data Store Application Logic


HANA
Views Procedures

© 2013 SAP AG. All rights reserved. 50


How to adapt Add-ons for SoH
How to adapt Add-ons for SoH

Mandatory Steps
Pool/Cluster (PC) Tables

Most PC tables of NW and Suite were migrated to transparent tables for SoH

Recommendation: Don‘t use own PC tables in the future

References to tables formerly defined as pool or cluster table


 Own PC tables using a table pool/cluster of NetWeaver or Suite (e.g. ATAB) lead to syntax errors during
deployment of the Add-on

Select statements on tables formerly defined as pool or cluster table


 SELECT statements on pool and cluster tables do return results implicitly sorted by primary key. After de-
pooling/de-clustering tables for HANA the results are no longer automatically sorted. This is no problem as long
the coding does not rely on sorted results and also no problem if the results are explicitly sorted by adding
ORDER BY PRIMARY KEY.

 ABAP Test Cockpit provides a check to find those select statements

© 2013 SAP AG. All rights reserved. 53


Pool/Cluster (PC) Tables

Order-by Code Check

© 2013 SAP AG. All rights reserved. 54


Column Store vs. Row Store

The HANA Database consists of a row storage and a column storage

The default storage is the column store


 All existing tables are automatically created in the column store during deployment of an Add-on (using
transaction SAINT) into an ECC System running on HANA
 Using transaction SE13 (tab strip DB specific attributes), you can check which store is used in case of HANA
 Example:

© 2013 SAP AG. All rights reserved. 55


Column Store vs. Row Store

Recommendation: Use column store for all existing and new tables of your add-on

The row store should only be used in very exceptional cases. Reasons why a table should be in
row store:
 Very huge OLTP load on the table (huge rate of single updates / inserts / deletes)

© 2013 SAP AG. All rights reserved. 56


New OpenSQL Compiler

New OpenSQL compiler is active as of NW7.4 SP2


 New compiler identifies syntactically wrong coding (errors) which were ignored before.
 Ignoring these errors in existing coding leads to unintended application behavior.
 Each errors in existing coding will either result in build errors or runtime errors.
 For background information see SAP note 1832139 - OpenSQL runtime environment

The risk of having errors in your code is very low


 For the whole ERP around 10 corrections had to be made

© 2013 SAP AG. All rights reserved. 57


How to adapt Add-ons for SoH

Optional Steps
Optimize your Code

HA400 – Programming on SAP HANA


 Provides information how to leverage the power of HANA for your applications/coding
 The course is currently based on NW 7.31
– the concepts how to improve coding for HANA are the same in NW 7.40
– but the development tools are significantly improved in NW 7.40

© 2013 SAP AG. All rights reserved. 59


Optimize your Code

Reasons why to optimize your code?


 With HANA, SQL statements can be processed extremly fast
– the bottleneck is no longer the database, but the transfer of the results to the application server
– therefore new programming paradigms are needed: move calculations into the database

 OLTP applications typically use select single


– Select single on HANA (column store) is up to two times slower compared to a traditional database
– Avoid selects single in loops and nested selects

© 2013 SAP AG. All rights reserved. 60


Detect optimization potential on SAP HANA
Performance Tools and Guidelines
Adapted Performance Guidelines
• Existing golden rules remain valid as general
recommendations
• There are some shifts of priorities (e.g. index definition
(lower) and avoidance of nested selects (higher))
• Available in SCN

Outlook: new tools for “Guided Optimization”


(ABAP 7.4 SP2; RTC May 2013)
• Improved ABAP profiler and new SQL monitor for runtime
analysis
• New performance checks in ABAP code inspector
• “Worklist tool” combining results from code checks and
runtime analysis
© 2013 SAP AG. All rights reserved. 61
Key takeaways and Outlook
ABAP Development on SAP HANA
Tools and best practices provided with ABAP 7.4
• Advanced view building in ABAP
• Guidelines, check tools, and best practices

Accelerate • New ABAP profiler and SQL monitor in Eclipse

• New usage options in existing environments (e.g.


ALV with integrated data access, fault tolerant
search helps, etc.)
Extend • Built upon proven SAP NetWeaver business
frameworks and extensibility concepts

• Native access to all SAP HANA features from ABAP


with proven SAP NetWeaver lifecycle management
• Integrated development environment across ABAP and
Innovate
SAP HANA in Eclipse

© 2013 SAP AG. All rights reserved. 63


SAP NetWeaver AS ABAP 7.4
What changes – and what doesn’t

No Change Change
 AS ABAP as a strong pillar of  Challenge existing application
SAP’s product strategy with and component designs
commitment to non-disruptive  Good SQL knowledge as the
innovation and the existing key enabling skillset
eco-system
 Eclipse as integrated
 Core architecture and qualities development environment
of the AS ABAP remain the across SAP HANA and ABAP
same (kernel, data dictionary, (and other domains, e.g.
security, connectivity, etc.) SAPUI5)

© 2013 SAP AG. All rights reserved. 64


HANA Platform

Suite Openess Embedded

ABAP Java
XS
JavaScript

DB Application Logic
HANA Data Store Views Procedures

© 2013 SAP AG. All rights reserved. 65


HANA XS in a nutshell

Presentation HTTP Client


ABAP Java others Logic (Browser, Mobile)

R HTTP/OData
DBI JDBC ODBC/ODBO

Database XS
R Connection R R
JavaScript
SQL/MDX
R SQL

DB Application Logic
Column Attribute, Analytics
Procedures SQLScript
Views & Calculation Views

HANA Data Store

Column and Multi-core/ In-memory


row store parallelization Compression

© 2013 SAP AG. All rights reserved. 66


Entity name
(used to call that service
via HTTP)

HANA View Entity name


(used to call that service via HTTP)

© 2013 SAP AG. All rights reserved. 68


Package Odata service definition file

© 2013 SAP AG. All rights reserved. 69


Odata service entity name

© 2013 SAP AG. All rights reserved. 70


Odata service definition file

Odata service entity name

© 2013 SAP AG. All rights reserved. 71


© 2013 SAP AG. All rights reserved. 73
HANA XS

HTTP Client
ABAP Open Data
Java Protocol others (Browser, Mobile)

R HTTP/OData
DBI JDBC ODBC/ODBO

Database XS
R Connection R R
JavaScript
SQL/MDX
R SQL

DB Application Logic
Column Attribute, Analytics
Procedures SQLScript
Views & Calculation Views

HANA Data Store

Column and Multi-core/ In-memory


row store parallelization Compression

© 2013 SAP AG. All rights reserved. 74


Consumption Browser Native Device
Questions
HANA Data Platform (DB)
Development
Professional Developer Business Expert / RDE
Experience

Customer / Partner
Applications
&
HANA Application Platform
ABAP
Java
XS Answers
JavaScript
HANA Cloud Platform

DB Data Store Application Logic


HANA
Views Procedures

© 2013 SAP AG. All rights reserved. 75


Thank you
Contact information: [email protected]
Code pushdown: Top down
Advanced ABAP view building via Core Data Services (CDS)

The first step to leverage CDS in ABAP is to ABAP in Eclipse ABAP


DDIC
massively improve the view building
Text-based View Table Definitions
capabilities in ABAP Editor
<<Resource>>
View Definition
•Support “standard” SQL feature even Graphical View
Editor “One View Model”
Column Views
(= CDS View Entity)
beyond current Open SQL capabilities (e.g.
CDS-QL
UNIONs). ViewsSQL
HANA Activation Transport
SQL 92
Open
•Possibility to support SAP HANA specific SQL

extensions via annotations


CREATE VIEW … CREATE CDS VIEW …

•Combine native SAP HANA development CDS-DDL Compiler


SQL DDL
with proven ABAP platform qualities Compiler CREATE VIEW … <CalcXML>…

(Lifecycle Management, Extensibility) SQL Engine Calc Engine


Other DB SAP HANA

© 2013 SAP AG. All rights reserved. 77

You might also like