ABAP is a proprietary programming language that was developed for programming applications in the SAP context. It is basically similar to the COBOL programming language.
Frequently asked questionsSee all questions
Anyone who gets to grips with SAP will sooner or later come across the term SAP ABAP. It is mostly known that this is a programming language. But where are the differences to other languages? How was SAP ABAP developed, how is it used in practice and is it still relevant in times of SAP S/4 HANA? This article deals comprehensively and comprehensibly with these and other questions concerning SAP ABAP.
What is SAP ABAP?
SAP ABAP is SAP's proprietary programming language. It was introduced in 1983. The abbreviation once meant "general report preparation processor", as companies could originally only program reports with the language. However, changes to the database table were not possible. This was followed by further developments of the ABAP language scope, in the context of which the name meaning of ABAP was finally changed to "Advanced Business Application Programming". This expresses that SAP ABAP is intended for the development of commercial applications. Since 1990 and the introduction of SAP R/3, all SAP modules have been based on ABAP. ABAP Objects (ABAP OO for short) was also an important addition, as this enabled object-oriented programming.
What can be implemented with the SAP ABAP programming language?
Initially, SAP ABAP is used by SAP SE programmers to develop new applications and statements, function modules, and updates for existing program parts. We are also talking here about the so-called SAP standard. However, despite the wide range of variants and numerous industry solutions, the language scope of this standard is often not sufficient to completely cover the individual requirements of companies. This is where internal or external SAP programmers come in, using SAP ABAP to develop solutions to close this gap. The possibilities are manifold and include not only the system basis but also all SAP modules such as finance, human resources, production, logistics, sales and purchasing. Just a few examples of how ABAP can be used:
- Development of own database tables
- Programming of individual user interfaces
- Development of own transactions
- Design of reports
- Generate specific lists
- Creation of new processes and instructions
What are the technical features of SAP ABAP?
The syntax of SAP ABAP is similar to the programming language COBOL, which was developed in the 1950s and is still in use. COBOL (Common Business Oriented Language) is clearly based on the natural language and is used in particular for commercial applications. The situation is very similar in SAP ABAP. SAP ABAP is also a so-called 4GL language (fourth generation language). Programming languages of this kind are designed to generate code as quickly as possible and with just a few lines of code. Furthermore, SAP ABAP is ideally suited for processing large amounts of data within commercial applications.
While elementary languages store their functions in libraries, SAP ABAP takes a different approach, which is characterized as follows:
- Database accesses are integrated into the source code via Open SQL statements.
- SAP buffering provides optimized performance for database access.
- Mass data in the working memory is stored dynamically in internal tables.
- OLTP (Online Transaction Processing) enables numerous users to access the database table at the same time.
There are also two main interfaces for SAP ABAP:
- Interface to other programming environments via RFC (Remote Function Call); enables calling of functions from remote systems
- XML interface
Although the integration of these functions and statements improves the speed and verifiability of programs, the large number of language elements also makes SAP ABAP complex.
Do SAP ABAP programs have downward compatibility?
SAP ABAP was originally a procedural programming model based on individual function modules and subroutines. As of ABAP Release 6.10, you can also use object-oriented commands (classes and interfaces). This is referred to as ABAP Objects, or ABAP OO for short (see next section for details).
From the outset, SAP has followed the principle of downward compatibility with ABAP. This means that old instructions do not lose their validity if they are replaced by new instructions. Altanweisungen therefore continue to exist, which over time leads to a considerable amount of language. Although the old elements should no longer be used, this is certainly possible. It should also be mentioned that ABAP and ABAP OO can be used together, i.e. are interoperable. If ABAP OO is used, old SAP ABAP language elements (with a few exceptions) can also continue to be used.
The advantage of this approach is obvious: Internally developed functions and programs always remain functional. Existing developments do not need to be updated. When programming, you should nevertheless make sure that you no longer use the old components, but instead use current and more powerful ABAP language elements. It is also possible to combine old and new components. Procedural elements can be used in object-oriented source code. The reverse case (object-oriented elements in ABAP procedural coding) is also possible. If old and new components are specifically combined, this can increase the effectiveness of the ABAP programming language.
What is ABAP Objects (ABAP OO)?
ABAP OO is an extension of SAP ABAP. It adds object-oriented concepts and elements to the programming language. The goal is to simplify application development through modularization. Put simply, source code can be encapsulated in clear, reusable modules of statements, which significantly reduces effort. ABAP OO also allows you to predefine the structures of objects abstractly and pass them on to subclasses. ABAP OO has been fully integrated into the SAP standard since Release 4.6. Previously, it was only possible to combine function modules of statements into function groups.
In addition to simplified programming, ABAP OO improves application performance. Unnecessary database queries are avoided. In addition, competing accesses to databases can be reduced.
Compared to other programming languages that are based on objects, ABAP OO has some special features. A class always has two constructors - an instance constructor and a static constructor. Constructors are procedures that are used to create objects. The instance constructor is executed automatically each time objects are created, thus initializing individual instances. The static constructor, on the other hand, is executed only once before the first access to a class.
Other special features of ABAP OO are:
- Single inheritance: Each class can inherit structures from only one superclass. However, several subclasses are possible.
- Grouping of interfaces: Several existing interfaces can be grouped together in a new interface.
- Object Services Framework: Includes a Persistence Service, a Transaction Service, and a Query Service, simplifying the development of object-oriented applications.
How does programming with SAP ABAP work?
The creation of new programs with SAP ABAP takes place in several process steps:
- Programming in the development environment
- Transport of changed objects into a test/consolidation environment
- Test, release and transport into the production system
SAP provides programmers with a development environment for writing source code in ABAP. This has the name ABAP Workbench. Existing programs are presented here in the form of a tree structure, structured according to content.
From a technical point of view, code and data types are strictly separated in SAP ABAP. If you want to define globally valid tables and data types, you do this in the Data Dictionary. In addition to the technical properties of the program, documentation for data types is also stored here.
The SAP ABAP programs themselves are stored in the central SAP database table. This distinguishes ABAP from other programming languages, where applications are often separate files. Within the database, the code is available as source code that can be displayed with the ABAP Workbench Tools. On the other hand, it also exists as generated code in a binary representation (similar to Java bytecode).
Since SAP must be executable at all times, source code is not developed in the production system. New programs must therefore be imported from the development environment into the subsequent systems using transport requests. The exact time of these transports can be defined. This is often done at night or on non-working days, especially for more extensive changes.
ABAP in Eclipse as Successor to the Workbench
The ABAP Workbench has always been criticized for its moderate ease of use. Small help features such as forward navigation, where you can jump directly to table definitions or variable declarations with a double-click, could not contribute significantly to the improvement. With the new ABAP development environment "ABAP in Eclipse", SAP has been offering an alternative or successor to the Workbench since 2012.
SAP ABAP in Eclipse was specially designed for agile software development. In addition to existing ABAP Workbench functions, some new features have been added. Examples are
- Syntax Highlighting (syntax highlighting)
- Code Completion (autocompletion of source code)
- Refactoring (structural improvement of source texts, also applicable for renaming variables and methods)
In addition, ABAP in Eclipse can be very flexibly adapted to individual scenarios using plug-ins. Tests for higher code quality can also be implemented. A new debugger rounds off the modern ABAP development environment in Eclipse.
SAP ABAP and Security
As in any application, SAP ABAP programs can have security gaps. These arise mainly from the ignorance and carelessness of ABAP developers or from a lack of transparency, since the enormous amounts of code are almost impossible to oversee manually.
The most common error in ABAP custom developments is a missing or poorly programmed authorization check. This makes it possible for unauthorized employees to access certain information and misuse the data. Even more dangerous, however, are vulnerabilities that allow external attackers to gain control over SAP systems. In this case, criminals are potentially in a position to manipulate, delete or steal entire SAP databases.
Several measures are required to minimize the risks associated with missing ABAP source codes. In particular, the following aspects should be mentioned:
- Ongoing safety training for internal programmers
- For external service providers: include code quality standards in agreements
- Scan of self-developed ABAP codes for vulnerabilities (possible with special software)
- Import security patches promptly
- Establish contingency plans in the event of successful attacks
What role does ABAP play in SAP S/4 HANA?
With the introduction of SAP S/4 HANA technology, a new era has dawned for SAP software. Both the user guidance and the data models have been significantly simplified. The database is no longer located on a database server, but with the program data in the main memory of the application server. Database and application are therefore merged in SAP S/4 HANA. This has resulted in various changes for ABAP developers.
First, the focus shifted from command instructions to a functional orientation. For performance reasons, it is also recommended that you program HANA in SAP S/4 with Native SQL (formerly Open SQL). The source code has been moved from the programs to the database layer. This means that programming takes place directly on the database, which is no longer possible with the familiar SAP ABAP. Developers therefore had to learn and use SQLScript as a new programming language for SAP S/4 HANA.
However, since the introduction of SAP S/4 HANA, SAP ABAP programming has been considerably simplified. While complex data modeling (analytical views) was initially required for data selections, the simpler ABAP CDS views are now sufficient. Predefined data models ensure that developers can conveniently access related data during programming.
Meinolf Schäfer, Senior Director Sales & MarketingDo you have any questions? I will be glad to help you.
+49 2241 8845-623