Mastering SAP ABAP
eBook - ePub

Mastering SAP ABAP

A complete guide to developing fast, durable, and maintainable ABAP programs in SAP

  1. 548 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Mastering SAP ABAP

A complete guide to developing fast, durable, and maintainable ABAP programs in SAP

About this book

Take your SAP ABAP skills to the next level by mastering ABAP programming techniques with the help of real-world examples

Key Features

  • Become adept at building interfaces and explore ABAP tools and techniques
  • Discover the modern functionalities available in the latest version of ABAP
  • Learn the process of creating stunning HTML5 applications using SAPUI5

Book Description

Advanced Business Application Programming (ABAP) is an established and complex programming language in the IT industry. This book is designed to help you use the latest ABAP techniques and apply legacy constructions using practical examples.

You'll start with a quick refresher on language and database concepts, followed by agile techniques for adding custom code to a modern ABAP system. After this, you will get up to speed with the complete ABAP toolset for importing data to and from different environments. Next, you'll learn how to print forms and work with the different ABAP tools for Extensible Markup Language (XML) manipulation. While covering further chapters, you'll gain insights into building stunning UI5 interfaces, in addition to learning how to develop simple apps using the Business Object Processing Framework (BOPF). You will also pick up the technique of handling exceptions and performing testing in ABAP. In the concluding chapters, you can look forward to grasping various techniques for optimizing the performance of programs using a variety of performance analysis tools.

By the end of this book, you will have the expertise you need to confidently build maintainable programs in Systems, Applications, and Products (SAP).

What you will learn

  • Create stable and error-free ABAP programs
  • Leverage new ABAP concepts including object-oriented programming(OOP) and Model-View-Controller (MVC)
  • Learn to add custom code to your existing SAP program
  • Speed up your ABAP programs by spotting bottlenecks
  • Understand techniques such as performance tuning and optimization
  • Develop modern and beautiful user interfaces (UIs) in an ABAP environment
  • Build multiple classes with any nesting level

Who this book is for

This book is for developers who want to learn and use ABAP skills to become an industry expert. Familiarity with object-oriented programming concepts is expected.

Trusted by 375,005 students

Access to over 1 million titles for a fair monthly price.

Study more efficiently using our study tools.

Information

Year
2019
Print ISBN
9781787288942
eBook ISBN
9781787129498

Database Access in ABAP

Reading and operating on databases is one of the most frequently used skills for an Advanced Business Application Programming (ABAP) developer. A good understanding of the principles of ABAP OpenSQL is an essential skill that is required for operating in databases. To access the database in SAP, we can use two types of SQLs—ABAP OpenSQL and Native SQL. The main difference between these is that OpenSQL can be used in all database platforms to gain access to database tables declared in the ABAP Dictionary, while through Native SQL, you can use a database-specific SQL statement, which allows you to use a table that is not managed by the ABAP Dictionary. One of the biggest issues with Native SQL is the fact that a query written in Native SQL cannot be used in all databases and is specific to each type of database. In this chapter, we will be looking at OpenSQL only.
In this chapter, we will cover the following topics:
  • Extracting data from the database in an efficient way
  • Using an advanced function of SQL, for example, Subquery
  • The ability to change or delete data on databases
  • Optimizing queries

Technical requirements

All the code used in this chapter can be downloaded from the following GitHub link: https://github.com/PacktPublishing/Mastering-SAP-ABAP/tree/master/Chapter03.

Starting with OpenSQL

As ABAP was invented as a report language, it has a huge set of statements for accessing tables. ABAP was designed for high-performance database operations, but not for the definition or control of database tables. By definition, it's usually not the mission of the program to create or control database tables. However, those functionalities are included implicitly within the SAP system.
The section of ABAP that accesses the database tables is named OpenSQL and includes similar commands to standard SQL, such as SELECT, INSERT, UPDATE, and DELETE, which are known as data manipulation language (DML). The differences between standard SQL and OpenSQL include the fact that OpenSQL is platform independent and part of the ABAP language. This enables the syntax check to identify errors within the implementation of the SQL statement. Furthermore, there are several variants of the commands that are only for ABAP programs, which ease or accelerate the database accesses.
The platform-dependent SQL is generated by the database interface of the ABAP interpreter as part of the application server (AS) ABAP.
The data definition language (DDL), with all database-dependent commands such as CREATE, ALTER, and DROP, is given implicitly by the SAP Data Dictionary, as explained in Chapter 1, Creating Custom Code.
The DCL of standard SQL is not included in ABAP. Data consistency has to be guaranteed through the proper use of the concept of the SAP Logical Unit of Work (LUW) and the SAP concept of database locks.
In this chapter, we will see how the database tables can be accessed and manipulated, how several tables can be read at one time, and how huge amounts of data can be read with high performance. You will also learn about some obsolete statements, as well as the current recommendations and best practices for accessing data with high performance and optimized SQL statements.
When you access the database tables within an ABAP program, you always have to have an eye on performance. In development or consolidation systems, the amount of accessible data doesn't usually exceed a couple of thousands. The amount of the same data in productive systems can be measured even in millions (this amount can be even higher when it comes to the Internet of Things (IoT), big data, and the SAP High-Performance Analytic Appliance (HANA)).
You should think a little about performance while implementing database access, as the costs of implementing high-performance statements are insignificant in comparison to the costs of optimizing programs that are already productive.

Basics

In the first section, I'd like to present the most basic aspects of how to extract data from a database. In this subsection, we will explore how to create a basic select from table, as well as look at what components the SELECT statement is creating.
The SELECT statement is built from at least three mandatory parts. The first part in the SELECT statement is the resulting set. The resulting set is a list of fields that state what we want to get from the selected table. For the resulting set, we can use a list of fields directly entered in the statement, or we can use * to get all fields in the table. However, using * is not recommended due to performance issues, as we often do not need all fields in a table – only a few of them. The second part is a FROM statement, used to define which table we want to get the data from. The third part is INTO, which makes it possible to define which internal variable or variables input the data.
All examples presented in this chapter will be presented in SELECT from the sflight table. This SELECT statement will gradually be expanded by new capabilities.
The following is an ex...

Table of contents

  1. Title Page
  2. Copyright and Credits
  3. Dedication
  4. About Packt
  5. Contributors
  6. Preface
  7. Creating Custom Code
  8. The Basic Structure of ABAP
  9. Database Access in ABAP
  10. Import and Export to Document Formats
  11. Exposing Data to Print Forms
  12. ABAP and XML
  13. Building User Interfaces
  14. Creating Stunning UI5 Interfaces
  15. Business Object Processing Framework
  16. Modification and Customization Techniques
  17. Handling Exceptions in ABAP
  18. Testing ABAP programs
  19. Advanced Techniques in ABAP Objects
  20. Integrating SAP with Third-Party Systems
  21. The Background Processing of ABAP Programs
  22. Performance and Optimization of ABAP Code
  23. Assessments
  24. Another Book You May Enjoy

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Mastering SAP ABAP by Paweł Grześkowiak, Wojciech Ciesielski, Wojciech Ćwik in PDF and/or ePUB format, as well as other popular books in Business & Business Intelligence. We have over one million books available in our catalogue for you to explore.