ABAP Programming for SAP HANA PARTICIPANT HANDBOOK INSTRUCTOR-LED TRAINING Course Version: 11 Course Duration: 4 Day(s) Material Number: 50124104 For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
ABAP Programming for SAP HANA
PARTIC IPANT HANDBOOKINSTRUCTOR-LED TRAINING
Course Version: 11 Course Duration: 4 Day(s) Material Number: 50124104
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company.
SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. Please see http://globall2.sap.com/corporate-en/legal/ copyright/index.epx for additional trademark information and notices.
Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors.
National product specifications may vary.
These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP SE or its affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP SE or SAP affiliate company products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.
In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality mentioned therein. This document, or any related presentation, and SAP SE's or its affiliated companies’ strategy and possible future developments, products, and/or platform directions and functionality are all subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, which speak only as of their dates, and they should not be relied upon in making purchasing decisions.
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
• Describe the Open Item Analytics sample applications and which computations it involves
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
Unit 1 Lesson 1
SAP HANA Basics and Technical Concepts
LESSON OVERVIEWIn this lesson, you learn how to describe SAP HANA goals, technical innovations, and challenges; understand the fundamental technical concepts of SAP HANA; explain the SAP HANA and ABAP evolution, architecture, and direction; and determine if SAP HANA's row store or column store is used for an ABAP transparent table and which indices are used on SAP HANA.
Business Example
Your company has recognized SAP HANA as an important strategic topic and has asked you to refresh your ABAP skills, paying particular attention to those required to develop or review code that leverages the strengths of SAP HANA.
LESSON OBJECTIVESAfter completing this lesson, you will be able to:
• Describe SAP HANA goals, technical innovations and challenges
• Understand the fundamental technical concepts of SAP HANA
• Explain the SAP HANA and ABAP evolution, architecture, and direction
• Determine if HANA’s row store or column store is used for an ABAP transparent table, and which indices are used on HANA
Developing applications using technology that pre-dates SAP HANA typically required making several trade-off decisions.
The figure shows the five dimensions of requirements that are typical for business applications. These dimensions have been conflicting so far.
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For example, you had to make trade-off decisions between providing a high-speed application and developing an application that doesn’t require preparing the data in a special way first, for example, by calculating aggregations beforehand and by storing the results in addition to the base data. Another example is that it was not possible to develop an application which is both real-time and able to analyze a large amount of data, maybe even unstructured data, at the same time.
DeepComplex & interactive
questions on granular data
BroadBig Data, many
data types
SAP HANA(
Real-TimeRecent data,
preferably real-time
High-SpeedFast response time,
interactivity
• SimpleNo data preparation, no pre-aggregation
Figure 2: SAP HANA: Delivers Across Five Dimensions
SAP HANA tries to deliver across all these five dimensions, so that you no longer have to make so many trade-off decisions. In other words, the ambition is to enable the development of applications that combine Online Transaction Processing and Online Analytical Processing usage patterns. This leads to certain goals HANA has to meet.
Enable New Applications and Optimize Existing Applications
• High Performance and Scalability
• Hybrid Data Management System
• Compatibility and Standard DBMS Features
• Support For Text Analysis, Indexing and Search
• Cloud Support and Application Isolation
• Support for Temporal Tables
• Executing Application Logic inside the Data Layer
Figure 3: SAP HANA Goals
SAP HANA has the following goals:
Enable new applications and optimize existing applications
SAP HANA is an In-memory data platform that is deployable as an appliance or in the cloud and makes full use of the capabilities of current hardware to increase application performance, reduce cost of ownership, and enable new scenarios and applications that were not possible before.
High performance and scalability
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
SAP HANA is designed to make full use of multi-core CPUs by parallelization of execution. It can be distributed across multiple servers to achieve good scalability in terms of both data volume and concurrent requests.
Hybrid data management system - combining different paradigms in one system
SAP HANA architecture integrates different in-memory storages (column-based, row- based, and object-based), traditional disk-based tables, text analysis and search, and built-in support for planning. Combining all these capabilities in a single product not only improves performance but reduces overall complexity and cost.
Compatibility and standard DBMS features
An important goal is the possibility to use the SAP HANA database system as a replacement for any standard relational database management system. The SAP HANA database system is a full relational database management system with SQL interface, transactional isolation and recovery (ACID properties) and high availability. SAP applications that use Open SQL should run on SAP HANA without changes.
Support For text analysis, indexing and search
An important goal of SAP HANA is to provide powerful analysis, and text indexing and search capabilities that support a state-of-the-art search experience. This includes full text search with advanced features, such as free style search (without knowing the name of attributes in the database), linguistic search, and fault-tolerant fuzzy search.
Cloud support and application isolation
In cloud deployments, it is required that a system be shared - including physical servers and installed software - between multiple customers. SAP HANA will support this in the future, with the planned ability to host multiple isolated databases within a single SAP HANA system. The databases inside one system will have their own data, metadata, and users, but will share the same hardware, the same SAP HANA software installation, and the system administration. This feature helps to support cloud scenarios - but it can also be used in an on-premise deployment, for example, for running multiple unrelated applications in one SAP HANA system with effective isolation and resource management.
Support for temporal tables
SAP applications that use Open SQL should run on SAP HANA without changes. In temporal tables, update operations do not modify the existing records. Instead, new versions of the data records are inserted. Applications may use temporal tables, for example, for time-based reporting and analysis or for versioning and change recording purposes.
Executing application logic inside the data layer
To benefit from the parallelization and optimization capabilities of SAP HANA, applications must execute data intensive operations on the database level. Pushing calculations to the database layer can also significantly reduce the amount of data that needs to be transferred between the database and application server. SAP HANA allows application developers to define application-specific functions that are executed inside the database layer.
SAP HANA Application Architectures
SAP HANA can be used in different architectural scenarios, which in turn provide thetechnological base for the different application areas.
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
Types of SAP HANA-Based Applications
Data marts based on SAP HANA New or native SAP HANA applications
Business Intelligence Tools, Microsoft Excel,Web Browser...
Figure 4: Architectural Scenarios
SAP HANA can be used in different architectural scenarios, which in turn provide the technological base for the different application areas.
From an ABAP programmer’s point of view, there are two groups of scenarios, as follows:
• Scenarios in which SAP HANA functions as the database for an Application Server ABAP.
• Scenarios based on a standalone SAP HANA Server.
Although the non-ABAP scenarios are mentioned here, they are not the focus of this course.
The first type are data warehouses, in which data is typically replicated from existing applications into a separate SAP HANA database, on top of which analytical content is developed and then consumed using business intelligence tools or simply Microsoft Excel.
A second type of HANA-based application consists of the newly-built, native applications developed using SAP HANA extended application services.
ABAP applications on SAP SAP HANA as AcceleratorHANA as primary database
SAP GUI, browser-based GUI
SAP NetWeaver Application Server
E.g., SAP CRM on SAP HANA
ABAP Schema Database Tables
0- 5s i
SAP GUI, browser-based GUI
SAP NetWeaver Application Server
Aggregation Levels
Figure 5: SAP HANA as Database for ABAP Applications
The primary concern of this course is to learn how to optimize ABAP applications directly running on SAP HANA, that is, applications using SAP HANA as the primary database
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
underneath the ABAP stack. A typical example of this kind of application is SAP CRM powered by SAP HANA, or the Business Suite powered by SAP HANA.
The course also covers type of applications shown on the right part of the figure: using SAP HANA to accelerate ABAP applications by using a separate HANA server besides the ABAP stack, replicating some of the ABAP system's data into HANA, and calling HANA remotely from ABAP to speed up selected reports or transactions.
SAP HANA Innovations and Challenges
HW Technology Innovations
Multi-core architecture (8 CPU x 10 cores per blade)
V"-
Massive parallel scaling with many blades
64bit address space - 1TB V on current servers
Dramatic decline in price/performance
SAP SW Technology Innovations
— + l[ ]Row and column store
** 0 * Compression
t
Partitioning
No aggregate tables
m Insert-only on delta+ +-1
Figure 6: What Made SAP HANA Possible?
Dramatically improved hardware economics and technology innovations in software made it possible for SAP to deliver on its vision of the real-time enterprise with in-memory business applications. Understanding them is important to an understanding of SAP HANA’s performance characteristics.
In-Memory Computing and the Shift of Performance Bottlenecks
Historically, database systems were designed to perform well on computer systems with limited RAM. This had the effect that slow disk I/O was the main bottleneck in data throughput. Consequently, the architecture of those systems was designed with a focus on optimizing disk access, for example, by minimizing the number of disk blocks (or pages) to be read into the main memory when processing a query. In addition, CPUs had a single core and networks were far slower.
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
Computer architecture has changed in recent years. Multi-core CPUs (multiple CPUs on one chip or in one package) are now standard, with fast communication between processor cores enabling parallel processing. Main memory is no longer a limited resource, and modern servers can have 2TB of system memory, which allows complete databases to be held in RAM.
Currently, server processors have up to 64 cores, and 128 cores will soon be available. With the increasing number of cores, CPUs are able to process increased data per time interval.
This shifts the performance bottleneck from disk I/O to the data transfer between CPU cache and main memory.
Figure 8: New Bottlenecks Become Important - How To Avoid Them
Two Challenges
1. Optimize loading data into the CPU cache
-> Introduce columnar data storage
-> Use compression for database tables
2. Avoid CPU idle time - make use of parallelism
-> Process one request on several cores in parallel
-> Distribute table contents across blades (partitioning)
To get the best performance from current hardware, the new bottlenecks have to be avoided by addressing the challenges as follows:
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
• Avoid CPU cache misses and expensive data transfer from main memory into the CPU - optimize loading the data into the CPU.
• Avoid idling CPU cores - make use of parallelism by using all the cores of a CPU, and several CPUs.
Column Store Versus Row Store
Data in table ... organized in rows
Order Country Product Sales
456 France corn 1000
457 Italy wheat 900
458 Italy corn 600
459 Spain rice 800
-------------SELECT *
WHERE ORDER = 457________ _
Works fine in row store
SELECT SUM(Sales)...
Row store not optimal
Figure 9: Row Store
By accessing data in column-store order, you benefit immensely from simplified table scan and data pre-caching. This can make all the difference in performance.
Very expensive on column store Ideal for column store
A Figure 10: Column Store
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
Data Compression
SAP HANA uses a dictionary per column:Operates directly on compressed data, using integers More in-cache, less main memory access
Log ica l Table
Order Country Product Sales
456 France corn 1000
457 Italy wheat 900
458 Spain rice 600
459 Italy rice 800
[ 460 Denmark corn 5001
461 Denmark rice 600
462 Belgium rice 600
463 Italy rice 1100
k. ... J
Compressed InvertedDictionary column index
1 Belgium 1 3 1 7
2 Denmark* *" _ A 2 5,6
3 France 3 1
4 Italy 4 ^ *C 4 2,4,8
5 Spain f i " 2 | 5 3
5 entries -> 6 2 Which orders
3 bits to encode 7 1 in Italy?
8 4
Where was order 460?
| Figure 11: Columnar Dictionary Compression
SAP HANA uses different, efficient compression methods, such as dictionary encoding, run- length encoding, and more. This has the following benefits:
• Reduces the amount of memory required.
• Speeds up operations on columns because the columns can be loaded into the CPU caches faster and with fewer loading cycles.
• Speeds up operations on columns because many comparisons become integer value comparisons. These are faster than string comparisons, for example.
Partitioning and Parallel Processing
processed by processed by
ColumnOrder
ColumnProduct
ColumnSales
456 corn 1000
457 wheat 1050
458 corn 600459 rice 800
460 wheat 2000
461 barley 300462 rye 900463 wheat 1200
processed
processed
Figure 12: Parallel Processing
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
On SAP HANA and with column storage, data is only partially blocked. This makes parallel processing possible. Even the same column can be split up and processed by different cores at the same time.
D is tr ib u tin g d a ta a c ro s s s e v e ra l b la d e s a llo w s w o rk in g on s m a lle r
cla ta s e ts in p a ra lle l
Table 1 Table 2 Table 3 Table ...Table 1 | | | ^ 0 Year A Year A Year A
% / <&>
■■■
■■■
■■m
l Table 2 Table 1 Table 2 Table 3 Table ...
—̂ BHQI Year B Year B Year B
______ < £ * >
Table $•■■
■■■
■■■
Table 1 Table 2 Table 3 Table ...
— O H O
< < **>
Figure 13: Using Partitioning to Further Leverage Parallelism
The use of parallelism can be taken a step further by creating different partitions of the data to be stored and processed on different blades. This allows for the management and processing of huge amounts of data.
ABAP Programming for SAP HANA: Evolution and Opportunities
Step 3
Stepl
ABAP can access SAP HANA
Side-by-Side Scenarios with AS ABAP 7.x
HANA DB
Step 2
ABAP can run on SAP HANA
SAP NetWeaver BW on SAP HANA
NetWeaver 7.31
HANA DB (SPS05)
Optimized ABAP on SAP HANA
Primary DB for AS ABAP
NetWeaver 7.40
HANA DB (SPS06)
Figure 14: SAP HANA Evolution
What's in it for ABAP Programmers?
The new capabilities of SAP HANA offer a huge variety of opportunities for ABAP Developers:
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
Accelerate Reduce time of background jobs
Extend Reach more usersTurn background jobs into interactive applications
Innovate New processes and applications
*| Figure 15: What's in it for ABAP Programmers
Accelerate
By optimizing the coding of long-running background jobs for SAP HANA, the runtime for these jobs can be reduced. More jobs can be executed in the same time, and particularly costly tasks are possible in one go, rather than splitting them up.
Extend
In the past, some reports had to be executed in the background, simply because their runtime was too long for dialog processing. Consequently, users worked on snapshots or pre-aggregated data sets. By optimizing these reports with SAP HANA, they can be offered as online reports again, displaying real-time data with full drill-down capability.
Innovate
With SAP HANA's analysis and calculation capabilities, ABAP developers can design new applications that would not have been possible in the past.
The arrival of in-memory technology on the database layer also requires a change in the way we design and implement applications.
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
Classical Approach
APPLICATION
LAYER
DATABASE
LAYER
Future Approach
-> MOVE calculations to database
-> Only transfer RESULTS
Figure 16: New Programming Approach
The basic approach of classic ABAP programming was as follows:
Keep the load from the database.Get all the data you need on the application server.Do your processing in ABAP.
In order to benefit the most from SAP HANA's capabilities, it is better to do expensive calculations and aggregations on the database itself, rather than transferring huge amounts of data onto the ABAP application server. This is a fundamental change to the ABAP programming paradigm. Now it becomes “ logic to data", rather than “data to logic” .
ABAP development guidelines
Improved tools for performance analysis
Extensions to ABAP language
Creating and consuming SAP HANA content with ABAP
Re-use components optimized for SAP HANA
Transparent optimizations
ABAPapplications using SAP HANA
Transparent Optimizations
SAP NetWeaver AS ABAP 7.4
Figure 17: Highlights of SAP NetWeaver AS ABAP 7.4 - Overview
ABAP 7.4 provides support for optimizing ABAP applications running on SAP HANA.
There are transparent optimizations you do not see as an application developer, but which you benefit from because they happen under the hood. An example is the s e l e c t ... f o r
a l l e n t r i e s ... statement in Open SQL, the implementation of which has been improved.
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
The ABAP language and the Open SQL language have been extended. For example, OpenSQL now supports more complicated joins and sub-queries, and there are ways to integrate SAP HANA stored procedures in ABAP code.
The use of SAP HANA artifacts has been simplified. For example, you can access SAP HANA column views through the ABAP Dictionary using Open SQL.
In addition, performance analysis tools, such as static code checks and the runtime analysis, have been improved. The ABAP Profiler perspective in the ABAP Development Tools in Eclipse has also been enhanced.
Some re-use components have been extended or optimized for SAP HANA, such as the SAP List Viewer (ALV).
In addition, the ABAP platform team provides guidelines for optimizing ABAP code running on HANA.
An example of an ABAP Dictionary extension in ABAP 7.4 is the ability to control which store a table of the ABAP system should live in.
A new tab has been added to the Maintain Technical Settings form for database tables. The new tab is called DB-Specific Properties, and allows for switching between three storage types when running on a SAP HANA database.
• Storage type Column Store creates the database table in the SAP HANA column store, or moves it there.
• Storage type Row Store creates the database table in the SAP HANA row store, or moves it there.
• This setting can be changed after the table has been created, and the table will be moved into the other store. Use this with caution, however, since it may involve reorganizing table contents, should such content exist already.
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
Unit 1 Exercise 1
Log on to ABAP Systems and Create Packages
Business Example
Your company has recognized SAP HANA as an important strategic topic and has asked you to refresh your ABAP skills, paying particular attention to those required to develop or review code that leverages the strengths of SAP HANA.
Log on to Application Server ABAP with SAP HANA as the Primary DatabaseUsing SAP Logon, log on to the Application Server ABAP that uses SAP HANA as a primary database — system NW740 on HANA with system ID T85. Create development package ZHA40CL##, where ## stands for your group ID.
Note:As a preliminary step, fill out the missing details below, as given by the instructor, and use this information for all exercises during this course:
Remote Desktop alias
Remote Desktop user name
Remote Desktop password
ABAP system using SAP HANA as primary database
NW740 on HANA. System ID T85
User name in ABAP system T85
Password in ABAP system T85
ABAP system using Sybase ASE as primary database
ZME on Sybase, System ID ZME
User name in ABAP system ZME
Password in ABAP system ZME
SAP HANA system host
SAP HANA system instance
SAP HANA user name
SAP HANA system password
1. Log on to the system labelled NW740 on HANA.
2. Open system status and check the system's release and database.
3. Create ABAP package ZHA400_##.
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]
For Any SAP / IBM / Oracle - Materials Purchase Visit : www.erpexams.com OR Contact Via Email Directly At : [email protected]