# ABAP

ABAP (Advanced Business Application Programming, originally Allgemeiner Berichts-Aufbereitungs-Prozessor, German for "general report preparation processor") is a high-level programming language created by the German software company SAP SE. It is currently positioned, alongside Java, as the language for programming the SAP NetWeaver Application Server, which is part of the SAP NetWeaver platform for building business applications.

## Introduction

ABAP is one of the many application-specific fourth-generation languages (4GLs) first developed in the 1980s. It was originally the report language for SAP R/2, a platform that enabled large corporations to build mainframe business applications for materials management and financial and management accounting.
ABAP used to be an abbreviation of Allgemeiner Berichts-Aufbereitungs-Prozessor, German for "generic report preparation processor", but was later renamed to the English Advanced Business Application Programming. ABAP was one of the first languages to include the concept of Logical Databases (LDBs), which provides a high level of abstraction from the basic database level(s), which supports every platform, language and units.
The ABAP language was originally used by developers to develop the SAP R/3 platform. It was also intended to be used by SAP customers to enhance SAP applications – customers can develop custom reports and interfaces with ABAP programming. The language was geared towards more technical customers with programming experience.
ABAP remains as the language for creating programs for the client–server R/3 system, which SAP first released in 1992. As computer hardware evolved through the 1990s, more and more of SAP's applications and systems were written in ABAP. By 2001, all but the most basic functions were written in ABAP. In 1999, SAP released an object-oriented extension to ABAP called ABAP Objects, along with R/3 release 4.6.
SAP's current development platform NetWeaver supports both ABAP and Java.
ABAP has an abstraction between the business applications, the operating system and database. This ensures that applications do not depend directly upon a specific server or database platform and can easily be ported from one platform to another.
SAP Netweaver currently runs on UNIX (AIX, HP-UX, Solaris, Linux), Microsoft Windows, i5/OS on IBM System i (formerly iSeries, AS/400), and z/OS on IBM System z (formerly zSeries, S/390). Supported databases are HANA, SAP ASE (formerly Sybase), IBM Db2, Informix, MaxDB, Oracle, and Microsoft SQL Server (support for Informix was discontinued in SAP Basis release 7.00).

## ABAP Runtime Environment

All ABAP programs reside inside the SAP database. They are not stored in separate external files like Java or C++ programs. In the database all ABAP code exists in two forms: source code, which can be viewed and edited with the ABAP Workbench tools; and generated code, a binary representation somewhat comparable with Java bytecode. ABAP programs execute under the control of the runtime system, which is part of the SAP kernel. The runtime system is responsible for processing ABAP statements, controlling the flow logic of screens and responding to events (such as a user clicking on a screen button); in this respect it can be seen as a Virtual Machine comparable with the Java VM. A key component of the ABAP runtime system is the Database Interface, which turns database-independent ABAP statements ("Open SQL") into statements understood by the underlying DBMS ("Native SQL"). The database interface handles all the communication with the relational database on behalf of ABAP programs; It also contains extra features such as buffering of tables and frequently accessed data in the local memory of the application server.

### SAP Systems and Landscapes

All SAP data exists and all SAP software runs in the context of a SAP system. A system consists of a central relational database and one or more application servers ("instances") accessing the data and programs in this database. A SAP system contains at least one instance but may contain more, mostly for reasons of sizing and performance. In a system with multiple instances, load balancing mechanisms ensure that the load is spread evenly over the available application servers.
Installations of the Web Application Server (landscapes) typically consist of three systems: one for development; one for testing and quality assurance; and one for production. The landscape may contain more systems (e.g., separate systems for unit testing and pre-production testing) or it may contain fewer (e.g., only development and production, without separate QA); nevertheless three is the most common configuration. ABAP programs are created and undergo first testing in the development system. Afterwards they are distributed to the other systems in the landscape. These actions take place under control of the Change and Transport System (CTS), which is responsible for concurrency control (e.g., preventing two developers from changing the same code at the same time), version management, and deployment of programs on the QA and production systems.
The Web Application Server consists of three layers: the database layer; the application layer; and the presentation layer. These layers may run on the same or on different physical machines. The database layer contains the relational database and the database software. The 'application layer' knowledge contains the instance or instances of the system. All application processes, including the business transactions and the ABAP development, run on the application layer. The presentation layer handles the interaction with users of the system. Online access to ABAP application servers can go via a proprietary graphical interface, which is called "SAP GUI", or via a Web browser.

### Software Layers

ABAP software is deployed in software components. Examples for these are:
* SAP_BASIS is the technical base layer which is required in every ABAP system.
* SAP_ABA contains functionalities which is required for all kinds of business applications, like business partner and address management.
* SAP_UI provides the functionality to create SAP UI5 applications.
* BBPCRM is an example for a business application, in this case the CRM application

## Transactions

A transaction in SAP terminology is the execution of a program. The normal way of executing ABAP code in the SAP system is by entering a transaction code (for instance, VA01 is the transaction code for "Create Sales Order"). The common transaction codes (T-codes) used by ABAP developer are SE38, SE09, SE10, SE24, SE11, SE16N, SE80, SE37, ST22 etc. Transactions can be called via system-defined or user-specific, role-based menus. They can also be started by entering the transaction code directly into a command field, which is present in every SAP screen. Transactions can also be invoked programmatically by means of the ABAP statements CALL TRANSACTION and LEAVE TO TRANSACTION. The general notion of a transaction is called a Logical Unit of Work (LUW) in SAP terminology.

## Types of ABAP programs

As in other programming languages, an ABAP program is either an executable unit or a library, which provides reusable code to other programs and is not independently executable.
ABAP distinguishes two types of executable programs:
* Reports
* Module pools
Reports follow a relatively simple programming model whereby a user optionally enters a set of parameters (e.g., a selection over a subSET of data) and the program then uses the input parameters to produce a report in the form of an interactive list. The term "report" can be somewhat misleading in that reports can also be designed to modify data; the reason why these programs are called reports is the "list-oriented" nature of the output they produce.
Module pools define more complex patterns of user interaction using a collection of screens. The term “screen” refers to the actual, physical image that the user sees. Each screen also has a "flow logic", which refers to the ABAP code implicitly invoked by the screens, which is divided into a "PBO" (Process Before Output) and "PAI" (Process After Input) section. In SAP documentation the term “dynpro” (dynamic program) refers to the combination of the screen and its flow logic.
The non-executable program types are:
* INCLUDE modules – These get included at generation time into the calling unit; it is often used to subdivide large programs.
* Subroutine pools – These contain ABAP subroutines (blocks of code enclosed by FORM/ENDFORM statements and invoked with PERFORM).
* Function groups – These are libraries of self-contained function modules (enclosed by FUNCTION/ENDFUNCTION and invoked with CALL FUNCTION).
* Object classes – These are similar to Java classes and interfaces; the first define a set of methods and attributes, the second contain "empty" method definitions, for which any class implementing the interface must provide explicit code.
* Interfaces – Same as object classes
* Type pools – These define collections of data types and constants.
ABAP programs are composed of individual sentences (statements). The first word in a statement is called an ABAP keyword. Each statement ends with a period. Words must always be separated by at least one space. Statements can be indented as you wish. With keywords, additions and operands, the ABAP runtime system does not differentiate between upper and lowercase.
Statements can extend beyond one line. You can have several statements in a single line (though this is not recommended). Lines that begin with asterisk * in the first column are recognized as comment lines by the ABAP runtime system and are ignored. Double quotations marks (") indicate that the remainder of a line is a comment.

## Development environment

There are two possible ways to develop in ABAP. The availability depends on the release of the ABAP system.

### ABAP Workbench

The ABAP Workbench is part of the ABAP system and is accessed via SAP GUI. It contains different tools for editing programs. The most important of these are (transaction codes are shown in parentheses):
* ABAP Editor for writing and editing reports, module pools, includes and subroutine pools (SE38)
* ABAP Dictionary for processing database table definitions and retrieving global types (SE11)
* Menu Painter for designing the user interface (menu bar, standard toolbar, application toolbar, function key assignment) (SE41)
* Screen Painter, a screen generator for designing screens and flow logic (SE51)
* Function Builder for function modules (SE37)
* Class Builder for ABAP Objects classes and interfaces (SE24)
The Object Navigator (transaction SE80) provides a single integrated interface into these various tools.

### ABAP Development Tools

The ABAP Development Tools (ADT), formally known as "ABAP in Eclipse", is a set of plugins for the Eclipse IDE to develop ABAP objects.
In this scenario, the ABAP developer installs the required tools on his computer and works locally, whereas a continuous synchronization with the backend is performed.

## ABAP Dictionary

The ABAP Dictionary contains all metadata about the data in the SAP system. It is closely linked with the ABAP Workbench in that any reference to data (e.g., a table, a view, or a data type) will be obtained from the dictionary. Developers use the ABAP Dictionary transactions (directly or through the SE80 Object Navigator inside the ABAP Workbench) to display and maintain this metadata.
When a dictionary object is changed, a program that references the changed object will automatically reference the new version the next time the program runs. Because ABAP is interpreted, it is not necessary to recompile programs that reference changed dictionary objects.
A brief description of the most important types of dictionary objects follows:
* Tables are data containers that exist in the underlying relational database. In the majority of cases there is a 1-to-1 relationship between the definition of a table in the ABAP Dictionary and the definition of that same table in the database (same name, same columns). These tables are known as "transparent". There are two types of non-transparent tables: "pooled" tables exist as independent entities in the ABAP Dictionary but they are grouped together in large physical tables ("pools") at the database level. Pooled tables are often small tables holding for example configuration data. "Clustered" tables are physically grouped in "clusters" based on their primary keys; for instance, assume that a clustered table H contains "header" data about sales invoices, whereas another clustered table D holds the invoice line items. Each row of H would then be physically grouped with the related rows from D inside a "cluster table" in the database. This type of clustering, which is designed to improve performance, also exists as native functionality in some, though not all, relational database systems.
* Indexes provide accelerated access to table data for often used selection conditions. Every SAP table has a "primary index", which is created implicitly along with the table and is used to enforce primary key uniqueness. Additional indexes (unique or non-unique) may be defined; these are called "secondary indexes".
* Views have the same purpose as in the underlying database: they define subsets of columns (and/or rows) from one or – using a join condition – several tables. Since views are virtual tables (they refer to data in other tables) they do not take a substantial amount of space.
* Structures are complex data types consisting of multiple fields (comparable to struct in C/C++).
* Data elements provide the semantic content for a table or structure field. For example, dozens of tables and structures might contain a field giving the price (of a finished product, raw material, resource, ...). All these fields could have the same data element "PRICE".
* Domains define the structural characteristics of a data element. For example, the data element PRICE could have an assigned domain that defines the price as a numeric field with two decimals. Domains can also carry semantic content in providing a list of possible values. For example, a domain "BOOLEAN" could define a field of type "character" with length 1 and case-insensitive, but would also restrict the possible values to "T" (true) or "F" (false).
* Search helps (successors to the now obsolete "matchcodes") provide advanced search strategies when a user wants to see the possible values for a data field. The ABAP runtime provides implicit assistance (by listing all values for the field, e.g. all existing customer numbers) but search helps can be used to refine this functionality, e.g. by providing customer searches by geographical location, credit rating, etc.
* Lock objects implement application-level locking when changing data.

## ABAP syntax

This brief description of the ABAP syntax begins with the ubiquitous "Hello".

### Hello world

This example contains two statements: REPORT and WRITE. The program displays a list on the screen. In this case, the list consists of the single line "Hello, World!". The REPORT statement indicates that this program is a report. This program could be a module pool after replacing the REPORT statement with PROGRAM.

### Chained statements

Consecutive statements with an identical first (leftmost) part can be combined into a "chained" statement using the chain operator :. The common part of the statements is written to the left of the colon, the differing parts are written to the right of the colon and separated by commas. The colon operator is attached directly to the preceding token, without a space (the same applies to the commas in the token list on, as can be seen in the examples below).
Chaining is often used in WRITE statements. WRITE accepts just one argument, so if for instance you wanted to display three fields from a structure called FLIGHTINFO, you would have to code:
Chaining the statements results in a more readable and more intuitive form:
In a chain statement, the first part (before the colon) is not limited to the statement name alone. The entire common part of the consecutive statements can be placed before the colon. Example:
could be rewritten in chained form as:

### Comments

ABAP has 2 ways of defining text as a comment:
* An asterisk (*) in the leftmost column of a line makes the entire line a comment
* A double quotation mark (") anywhere on a line makes the rest of that line a comment
Example:

### Spaces

Code in ABAP is whitespace-sensitive.
assigns to variable x the substring of the variable a, starting from b with the length defined by the variable c.
assigns to variable x the sum of the variable a and the result of the call to method b with the parameter c.

### ABAP statements

In contrast with languages like C/C++ or Java, which define a limited set of language-specific statements and provide most functionality via libraries, ABAP contains an extensive amount of built-in statements. These statements traditionally used sentence-like structures and avoided symbols, making ABAP programs relatively verbose. However, in more recent versions of the ABAP language, a terser style is possible.
An example of statement based syntax (whose syntax originates in COBOL) versus expression-based syntax (as in C/Java):

## Data types and variables

ABAP provides a set of built-in data types. In addition, every structure, table, view or data element defined in the ABAP Dictionary can be used to type a variable. Also, object classes and interfaces can be used as types.
The built-in data types are:
| Type | Description |
| I | Integer |
| P | Packed decimal |
| F | Floating point |
| N | Character numeric |
| C | Character |
| D | Date |
| T | Time |
| X | Hexadecimal (raw byte) |
| STRING | Variable-length string |
| XSTRING | Variable-length raw byte array |
Date variables or constants (type D) contain the number of days since January 1, 1 AD. Time variables or constants (type T) contain the number of seconds since midnight. A special characteristic of both types is that they can be accessed both as integers and as character strings (with internal format "YYYYMMDD" for dates and "hhmmss" for times), which can be used for date and time handling. For example, the code snippet below calculates the last day of the previous month (note: SY-DATUM is a system-defined variable containing the current date):
All ABAP variables have to be explicitly declared in order to be used. They can be declared either with individual statements and explicit typing or, since ABAP 7.40, inline with inferred typing.

### Explicitly typed declaration

Normally all declarations are placed at the top of the code module (program, subroutine, function) before the first executable statement; this placement is a convention and not an enforced syntax rule. The declaration consists of the name, type, length (where applicable), additional modifiers (e.g. the number of implied decimals for a packed decimal field) and optionally an initial value:
Notice the use of the colon to chain together consecutive DATA statements.

### Inline declaration

Since ABAP 7.40, variables can be declared inline with the following syntax:
For this type of declaration it must be possible to infer the type statically, e.g. by method signature or database table structure.
This syntax is also possible in OpenSQL statements:

## ABAP Objects

The ABAP language supports object-oriented programming, through a feature known as "ABAP Objects". This helps to simplify applications and make them more controllable.
ABAP Objects is fully compatible with the existing language, so one can use existing statements and modularization units in programs that use ABAP Objects, and can also use ABAP Objects in existing ABAP programs. Syntax checking is stronger in ABAP Objects programs, and some syntactical forms (usually older ones) of certain statements are not permitted.
Objects form a capsule which combines the character to the respective behavior. Objects should enable programmers to map a real problem and its proposed software solution on a one-to-one basis. Typical objects in a business environment are, for example, ‘Customer’, ‘Order’, or ‘Invoice’. From Release 3.1 onwards, the Business Object Repository (BOR) of SAP Web Application Server ABAP has contained examples of such objects. The BOR object model will be integrated into ABAP Objects in the next Release by migrating the BOR object types to the ABAP class library. A comprehensive introduction to object orientation as a whole would go far beyond the limits of this introduction to ABAP Objects. This documentation introduces a selection of terms that are used universally in object orientation and also occur in ABAP Objects. In subsequent sections, it goes on to discuss in more detail how these terms are used in ABAP Objects. The end of this section contains a list of further reading, with a selection of titles about object orientation.
* Objects are instances of classes. They contain data and provide services. The data forms the attributes of the object. The services are known as methods (also known as operations or functions). Typically, methods operate on private data (the attributes, or state of the object), which is only visible to the methods of the object. Thus the attributes of an object cannot be changed directly by the user, but only by the methods of the object. This guarantees the internal consistency of the object.
* Classes describe objects. From a technical point of view, objects are runtime instances of a class. In theory, any number of objects based on a single class may be created. Each instance (object) of a class has a unique identity and its own set of values for its attributes.
* Object References are unique addresses that may be used to identify and point to objects in a program. Object references allow access to the attributes and methods of an object.
In object-oriented programming, objects usually have the following properties:
* Encapsulation – Objects restrict the visibility of their resources (attributes and methods) to other users. Every object has an interface, which determines how other objects can interact with it. The implementation of the object is encapsulated, that is, invisible outside the object itself.
* Inheritance – An existing class may be used to derive a new class. Derived classes inherit the data and methods of the superclass. However, they can overwrite existing methods, and also add new ones.
* Polymorphism – Identical (identically named) methods behave differently in different classes. In ABAP Objects, polymorphism is implemented by redefining methods during inheritance and by using constructs called interfaces.

## CDS Views

The ABAP Core Data Services (ABAP CDS) are the implementation of the general CDS concept for AS ABAP. ABAP CDS makes it possible to define semantic data models on the central database of the application server. On AS ABAP, these models can be defined independently of the database system. The entities of these models provide enhanced access functions when compared with existing database tables and views defined in ABAP Dictionary, making it possible to optimize Open SQL-based applications. This is particularly clear when an AS ABAP uses a SAP HANA database, since its in-memory characteristics can be implemented in an optimum manner.
The data models are defined using the data definition language (DDL) and data control language (DCL) provided in the ABAP CDS in the ABAP CDS syntax. The objects defined using these languages are integrated into ABAP Dictionary and managed here too.
CDS source code can only be programmed in the Eclipse-based ABAP Development Tools (ADT). The Data Definition Language (DDL) and the Data Control Language (DCL) use different editors.

### Features

| SAP NW ABAP | SQL Joins | SQL Set Operations | SELECT Clauses |
| 7.40 SP05 | INNER JOIN LEFT OUTER JOIN RIGHT OUTER JOIN | UNION UNION ALL | WHERE GROUP BY HAVING AS |
| 7.40 SP08 | | | |
| 7.50 | | | |
| 7.51 | CROSS JOIN | | |
| SAP NW ABAP | Literals | Arithmetic Operators | Conditional Expressions |
| 7.40 SP05 | In SELECT list, e.g. literal as FieldName As RHS value | + – ∗ | Boolean operators NOT, AND, OR Comparison operators BETWEEN, =, <>, <, >, <=, >=, LIKE IS [NOT] NULL (Only in WHERE condition) |
| 7.40 SP08 | | / (Float-based division) | |
| 7.50 | | | |
| 7.51 | | | Function as RHS value |
| SAP NW ABAP | Aggregate functions | Numeric functions | String functions |
| 7.40 SP05 | AVG( [DISTINCT] ) MAX MIN SUM( [DISTINCT] ) COUNT( [DISTINCT] ) COUNT(*) | CEIL MOD | SUBSTRING LPAD |
| 7.40 SP08 | | ABS DIV (Integer-based division) DIVISION (Decimal-based division) FLOOR ROUND | CONCAT REPLACE |
| 7.50 | | | CONCAT_WITH_SPACE INSTR LEFT LENGTH LTRIM RIGHT RPAD RTRIM |
| 7.51 | AVG( [AS] ) to specify return type | FLTP_TO_DEC | UPPER LOWER |
| SAP NW ABAP | Byte string functions | Date and time functions | Other functions |
| 7.40 SP05 | | | CAST to built-in DDIC types, e.g. abap.fltp |
| 7.40 SP08 | | | COALESCE CURRENCY_CONVERSION UNIT_CONVERSION DECIMAL_SHIFT |
| 7.50 | BINTOHEX HEXTOBIN | DATS_DAYS_BETWEEN DATS_ADD_DAYS DATS_ADD_MONTHS DATS_IS_VALID TIMS_IS_VALID TSTMP_IS_VALID TSTMP_CURRENT_UTCTIMESTAMP TSTMP_SECONDS_BETWEEN TSTMP_ADD_SECONDS | CAST to data elements, e.g. CHAR80 can be nested |
| 7.51 | | ABAP_SYSTEM_TIMEZONE ABAP_USER_TIMEZONE TSTMP_TO_DATS TSTMP_TO_TIMS TSTMP_TO_DST DATS_TIMS_TO_TSTMP | CAST PRESERVING TYPE SSTRING to other types CLNT, LANG, TIMS, UNIT to data elements of type CHAR and SSTRING CHAR, SSTRING, NUMC to ACCP and vice versa Aggregate function as operand |
| SAP NW ABAP | Conditional (CASE) expressions | Extensibility | (Unmanaged) Associations |
| 7.40 SP05 | "Simple" CASE (behaves like switch statement) Nested CASE statements | $EXTENSION.* (support for database table extensions) | Path expressions in SELECT list FROM clause WHERE clause HAVING clause Filter conditions in path expressions, e.g. Products._Texts[ lagu = 'EN' ] as english_name |
| 7.40 SP08 | "Searched" CASE (behaves like if ... else if) | EXTEND VIEW | |
| 7.50 | CASE expressions can be used as operands in CAST functions | EXTEND VIEW with input parameters, path expressions, conversions, date and time functions | |
| 7.51 | Function as RHS value | EXTEND VIEW with aggregate functions, GROUP BY clauses and UNIONs | Association definitions in views with UNIONs Default filters for associations (WITH DEFAULT FILTER) Cardinality "to many" (*:) can be specified in path filters |
| SAP NW ABAP | Session variables | Input parameters | Other |
| 7.40 SP05 | | | KEY elements |
| 7.40 SP08 | | input parameters on most DBs | |
| 7.50 | $session.user (sy-uname) $session.client (sy-mandt) $session.system_language (sy-langu) | Input parameters on AnyDB | Table function (SAP HANA only) |
| 7.51 | $session.system_date (sy-datum) | | Metadata extensions |

## Internal tables in ABAP

Internal tables are an important feature of the ABAP language. An internal table is defined similarly to a vector of structs in C++ or a vector of objects in Java. The main difference with these languages is that ABAP provides a collection of statements to easily access and manipulate the contents of internal tables. Note that ABAP does not support arrays; the only way to define a multi-element data object is to use an internal table.
Internal tables are a way to store variable data sets of a fixed structure in the working memory of ABAP, and provides the functionality of dynamic arrays. The data is stored on a row-by-row basis, where each row has the same structure.
Internal tables are preferably used to store and format the content of database tables from within a program. Furthermore, internal tables in connection with structures are an important means of defining complex data structures in an ABAP program.
The following example defines an internal table with two fields with the format of database table VBRK.

## History

The following list only gives a rough overview about some important milestones in the history of the language ABAP. For more details, see ABAP – Release-Specific Changes.
| Version | Release date | Major changes |
| 4.6C | May 2000 | ABAP Objects |
| 6.40 | 2004 | Shared Objects |
| 7.0 | 2006 | Switch framework/Enhancement concept |
| 7.02 | | Expressions like: check lcl=>mi(1) + abs( -2 ) >= 3. |
| 7.40 | 2012-11-29 | "Code pushdown"—use advanced features from the underlying database Constructor expressions (NEW, VALUE, REF, CONV, CAST, EXACT, COND, SWITCH) Partially Implemented test classes' interfaces Table Expressions Internal table line existence/line index functions |
| 7.40 SP05 | December 2013 | MOVE-CORRESPONDING for internal tables LET expression in constructor expressions CORRESPONDING operator CDS Views ABAP Managed Database Procedures |
| 7.40 SP08 | September 2014 | FOR expressions Constructor operator REDUCE Start value for constructor expressions GROUP BY for internal tables Filter expressions and default values for table expressions Open SQL inline declarations after INTO statement Optional interface methods |
| 7.50 | November 2015 | New built-in data type INT8 Relational expression IS INSTANCE OF Open SQL host expressions Open SQL expressions ROUND, CONCAT, LPAD, LENGTH, REPLACE, RIGHT, RTRIM and SUBSTRING Open SQL path expressions Open SQL SELECT UNION Open SQL INSERT FROM subquery |
| 7.51 | October 2016 | Enumerations Common table expressions in Open SQL Open SQL/CDS CROSS JOIN CDS client handling Metadata extensions in CDS Date and Time in Open SQL/CDS Floating point on Open SQL/CDS |
| 7.52 | September 2017 | Virtual sorting of internal tables |
| 7.54 | September 2019 | New Built-In Data Types New Built-In ABAP Type utclong Calculation Assignments Decimal Places in Time Stamps Client Handling Extensions of the INTO Clause Definition of Associations New Aggregate Function STRING_AGG New Built-In Functions Addition DISTINCT Optional in Aggregate Function COUNT Window Expressions SQL Conditions Revised Temporal Hierarchies New Hierarchy Navigators Aggregate Expressions in SQL Expressions CAST Matrix Revised Strict Mode in the Syntax Check Syntax Check for Literals and Host Constants Annotation for Database Hints Annotations for Releasing Elements Specifying CDS Entities After USING Quotation Marks for Logical Schemas Addition in place of the Statement late numbering Addition in class ... unique External name of an action Static Field Control Arbitrary Name for Handler Methods Behavior Pool No Exceptions Entity Manipulation Language TYPE STRUCTURE FOR Response Information Absolute Type Names Business Service Authorization Checks in Updates Implicit Message Type in IF_T100_DYN_MSG Using Test Classes Addition COMBINATION MODE OR|AND of the Statement GRANT SELECT ON Addition REDEFINITION of the Statement GRANT SELECT ON Predicate VOID Addition IN SCENARIO of the Statement GRANT SELECT ON Generic Aspect Condition of the Statement DEFINE ROLE New Variant INHERITING CONDITIONS FROM SUPER Different REPLACING Operators Definition of a Generic Aspect DCL Restrictions for ABAP CDS Hierarchies DCL Restrictions for Transactional Projection View Entities |
| 7.55 | September 2020 | The internal ABAP statement EXPORT NAMETAB cannot be used any more and leads to a runtime error. The internal ABAP statement IMPORT NAMETAB is still partly supported for reasons of downward compatibility. Any access to entries for DDIC table types leads to a runtime error. Any other access leads to errors from ATC. The former native database table DDNTF for separate nametab field descriptions is not supported any more and will be deleted. It is now possible to define new associations to external data sources in CDS projection views. A new kind of CDS view is available: the CDS view entity. The default value of profile parameter rdisp/max_alt_modes, that determines the possible number of ABAP sessions per user session, was enhanced from 6 to 16 and is now the same as the maximum number of ABAP sessions per user session. In the assignments behind the addition NEXT of the constructor operator REDUCE the calculation assignment operators +=, +=, *=, /= or &&=, can be used now and the respective rules apply. Support of Perl Compatible Regular Expressions Verbatim Replacements New Catchable Exception CX_SY_STRING_SIZE_TOO_LARGE Formatting option CURRENCY for decimal floating point numbers SQL: New aggregate function ALLOW_PRECISION_LOSS SQL: Optional window frame specification within a window function SQL: New window functions FIRST_VALUE and LAST_VALUE SQL: New date/time conversion functions for TIMESTAMPL, DATS and TIMS SQL: New time stamp functions UTCL_CURRENT, UTCL_ADD_SECONDS, and UTCL_SECONDS_BETWEEN SQL: New date functions DATN_DAYS_BETWEEN, DATN_ADD_DAYS, and DATN_ADD_MONTHS SQL: New additions after the ORDER BY clause: NULLS FIRST and NULLS LAST SQL: New aggregate functions MEDIAN, STDDEV, VAR, CORR, and CORR_SPEARMAN SQL: New geometry conversion function as_geo_json SQL conditions revised SQL: New window function NTILE SQL: SELECT, INTO target – host variables can now be declared inline even when the FROM-clause is dynamic SQL: New type conversion functions to_clob and to_blob SQL: New currency conversion function currency conversion SQL: Streaming and locators can now be used on SQL expressions SQL: Further data types allowed in elementary SQL expressions SQL: Hierarchy load options SQL: Typed literals SQL: New string functions SQL: Addition to the UPDATE FROM clause SQL: Strict mode of syntax check CDC Access: Check with element IS [NOT] INITIAL in a literal condition CDC Access: Addition bypass when CDC Access: Check on the user name in user conditions CDC Access: Data types CDC Access: Aspect bypass conditions Declaration of CX_NO_CHECK exceptions |
| 7.56 | October 2021 | In ABAP Dictionary, the load unit has been extended. There are now the following settings available: Column Preferred Page Preferred Column Enforced Page Enforced The new statement EXTEND ABSTRACT ENTITY of the DDL of ABAP CDS makes it possible to add new elements to existing CDS abstract entities by using CDS abstract entity extensions In CDS abstract entities, it is now possible to define to-parent associations without ON condition. The ON condition can be left out if the association target is also a CDS abstract entity A hierarchy definition DEFINE HIERARCHY can now use the new addition CACHE ON|OFF|FORCE to specify the caching policy for a generated hierarchy For each CDS DDIC-based view (obsolete), a CDS-managed DDIC view (obsolete) is created in ABAP Dictionary upon activation In CDS view entities, it is now possible to reuse expressions defined in the SELECT list in other operand positions of the same CDS view entity by using the syntax $projection.reuse_exp UNION clauses are now supported in CDS view entities. There are a few differences to UNION clauses in CDS DDIC-based views. The most important difference is that branches of union clauses can be nested within each other in CDS view entities The addition DISTINCT is now available for SELECT statements in CDS view entities In CDS view entities, two new set operators are available: EXCEPT INTERSECT Two new conversion functions are available in CDS view entities: GET_NUMERIC_VALUE CURR_TO_DECFLOAT_AMOUNT Typed literals are now available for CDS view entities. Typed literals allow an explicit type declaration and they are available for many built-in ABAP Dictionary data types In CDS view entities, special handling for CDS amount fields and CDS quantity fields has been implemented. It differs from the handling of amount fields and quantity fields in DDIC, for example, more data types are possible and the currency key/unit key reference is considered in expressions In CDS view entities, the expression matrix has been extended: In the WHERE clause, arithmetic expressions and case expressions are supported as operands In the HAVING clause, arithmetic expressions and case expressions are supported as operands In a searched case expression, arithmetic expressions and case expressions are supported as operands In CDS projection views, it is now possible to redefine the CDS associations from the projected entity in the header part. This is done using the keyword REDEFINE ASSOCIATION. Redefinition can include a new filter, alias name, and redirection to a new association target, which must also be a CDS projection view, thus moving the complete data model to the projection layer It is now possible to specify a provider contract for CDS projection views using the keyword PROVIDER CONTRACT. The provider contract specifies in which scenario a CDS projection view is used, and the scenario in turn determines in which runtime the view is executed and which features are available The following documented ABAP program is now available for evaluating whether a migration from a CDS DDIC-based view (obsolete) to a CDS view entity is possible: RUTDDLS_MIGRATION_CANDIDATES The following documented ABAP program is now available for migrating CDS DDIC-based views to CDS view entities: RUTDDLSV2MIGRATION A new reference type for annotations is available: LocalDefinitionRef The following new AbapCatalog.extensibility annotations have been released: AbapCatalog.extensibility.allowNewdataSources AbapCatalog.extensibility.dataSources AbapCatalog.extensibility.elementSuffix AbapCatalog.extensibility.extensible AbapCatalog.extensibility.quota.maximumBytes AbapCatalog.extensibility.quota.maximumFields The following new CDS system table functions are available: ... SERIES_GENERATE_DATE( step = ... from_value = ... to_value = ... ) ... ... SERIES_GENERATE_INTEGER( step = ... from_value = ... to_value = ... ) ... ... SERIES_GENERATE_TIME( step = ... from_value = ... to_value = ... ) ... ... SERIES_GENERATE_TIMESTAMP( step = ... from_value = ... to_value = ... ) ... The following syntax can be used for the object component selector -> to access components and attributes dynamically now: ... { dref->(comp_name) } | { cref->(attr_name) } | { iref->(attr_name) } ... The dereferencing operator->* can be used for generically typed data reference variables in almost all operand positions now. Before, that was possible in the ASSIGN statement only It is now possible to specify MOVE-CORRESPONDING statements with the following additions in the context of nested tables in deep structures. Both ensure that nested tables of the deep target structures are not deleted and new lines of nested tables in deep source structures are added It is now possible to specify statements with the component operator CORRESPONDING with the following additions in the context of nested tables in deep structures. Both ensure that the nested tables of deep target structures are not deleted and new lines of nested tables in deep source structures are added: APPENDING BASE Besides the existing support of PCRE regular expressions and POSIX regular expressions (obsolete) ABAP supports now also XPath regular expressions and XSD regular expressions. Internally, those are transformed to PCRE regular expressions and processed by the PCRE2 Library Both kinds of regular expressions can be used by the new (factory) methods CREATE_XPATH2 and CREATE_XSD of the system classes CL_ABAP_REGEX and CL_ABAP_MATCHER XPath regular expressions can be used by the new argument xpath in some built-in functions The class CL_ABAP_MATCHER supports callouts in PCRE syntax now. The method SET_CALLOUT can be used to register a handler class that implements the interface IF_ABAP_MATCHER_CALLOUT. The special characters (?C...) of a PCRE regular expression then call the interface method CALLOUT when the method MATCH is executed Now, this restriction is partly removed. In the statements INSERT, APPEND, COLLECT, MODIFY, DELETE, READ, LOOP, and SORT, operands can be field symbols and formal parameters that are typed fully generically with TYPE data or TYPE any. Such operands can be used as if typed with any table. If an index access is involved, operands are still required that are typed at least with TYPE index_table Alias names can now be declared for secondary keys of internal tables by using the addition ALIAS of TYPES and DATA. This can be helpful when changing existing secondary keys without invalidating users ABAP SQL now supports the new string function INITCAP New Date and Time Functions New Casts ABAP SQL now supports the new set operators INTERSECT and EXCEPT The new parameter start can now be used in the function REPLACE_REGEXPR. Additionally, the parameter occurrence can now include expressions ABAP SQL now supports the new string function SUBSTRING_REGEXPR which supports regular expressions If one the new features listed above or one of the new CDS system table functions SERIES_GENERATE_ is used in an ABAP SQL statement, the syntax check is performed in a strict mode, which handles the statement more strictly than the regular syntax check From this release on, authors of access controls can mark a subset of the CDS elements used in their access conditions as optional, so that CDS entities which inherit their access conditions are not affected by a Day-1-impact any more With the new addition ALL, access conditions can express that access shall only be granted when from a set-valued association all values satisfy the condition At all locations of access controls, references to authorization objects, authorization fields, and SACF scenario names can be written in identifier syntax when they comply with it and in string syntax with single apostrophes as an alternative When using self-defined aspects, these can now denominate an arbitrary set of their elements (path expressions are supported) as filter element. These filter elements can by referenced when using the self-defined aspect in an access condition The REPLACING section formerly only available to entity-based inheritance INHERITING CONDITIONS FROM ENTITY cds_ntity is now also available for role-based inheritance INHERIT role FOR GRANT SELECT ON cds_entity The REPLACING section of condition inheritance now supports a generic replacement step to replace an arbitrary field or association of the inheritance source with an arbitrary field or association of the inheritance target Respecting settings in the switchable authorization framework (SACF) was already possible for dedicated PFCG conditions: ASPECT PFCG_AUTH ( S_OBJECT IN SCENARIO ... ) For CDS hierarchies, access control was restricted to the use of conditions not resulting in database filtering. Now elements located in the declared hierarchy directory DIRECTORY ... FILTER BY can be used to formulate such conditions When operating the system with the emergency user SAP*, CDS access control is now deactivated From release 7.56 on, important settings of the ABAP Keyword Documentation can be configured explicitly. Before, the documentation was configured implicitly from system settings Program ABAP_DOCU_CONFIG allows a choice to be made between different sets of parameters: Parameter set typical for SAP development systems Parameter set typical for customer development systems Parameter set typical for SAP S/4HANA systems Parameter set typical for SAP S/4HANA Cloud ABAP Environment Parameter set typical for SAP BTP ABAP Environment Current parameter set The ABAP RESTful Application Programming Model (RAP) was enhanced |
| 7.57 | October 2022 | Components of structures can be assigned to field symbols with the new syntax struc-(comp) that largely replaces the variant ASSIGN COMPONENT OF The new addition ELSE UNASSIGN can be specified for the following variants of the statement ASSIGN: dynamic assignments assignments of dynamic components dynamic access assignment of a table expression SAP HANA XSA replaces SAP HANA XSC. The access methods designed specifically for XSC objects are not suitable for XSA objects and have been declared obsolete. DDIC external views are one of those access methods. They have been declared obsolete. More information can be found in SAP Notes 2465027 and 3116165 The new declaration operator FINAL declares an immutable variable that cannot be assigned another value at other write positions of the same context The new addition STEP defines the step size and the order for processing an internal table. For the statements LOOP and FOR, STEP can be used to control the step size and the processing order. For the statements APPEND, DELETE, INSERT, VALUE, and NEW, STEP can only be used to define the step size. It is not possible to change the processing order with STEP for these statements Access to a table index when accessing an internal table using a hash key (accessing a hashed table using its primary key or accessing any internal table using a hashed secondary key) is not allowed. When a hashed key is specified dynamically behind USING KEY in statement LOOP AT or expression FOR ... IN, usage of FROM and TO must result in an exception. This was not the case before release 7.57. From release 7.57 on, the runtime error ITAB_ILLEGAL_INDEX_OP occurs in such a situation. Before release 7.57, the behavior was undefined. When a negative value is specified for FROM in statement LOOP AT or expression FOR ... IN, it is set to 1 implicitly. Before release 7.57, this was not the case in the following situation: The internal table is accessed using a sorted key The internal table contains more than 10 table lines A WHERE condition is specified that can be optimized The statement IMPORT now allows assignments of data of type n to data objects of type c if they have the same length. This change might lead to incompatible behavior if handling of the former exception leads to different results than the new behavior CDS entity buffering was enhanced: View on view buffering is now supported, under the precondition that the CDS view entity used as data source meets certain requirements In CDS view entities, the addition ELSE NULL is available in simple and complex case distinctions. It defines the null value as return value of the ELSE branch New casting options have been added in CDS view entities Table buffering can be defined for CDS view entities now: Table buffering can be enabled and disabled with the annotation @AbapCatalog.entityBuffer.definitionAllowed: true|false The buffering type can be specified with a CDS entity buffer defined by DEFINE VIW ENTITY BUFFER ON cds_view_entity ... In CDS view entities, the SUBSTRING function has been enhanced. It now accepts not only literals, but also fields, parameters, expressions, and built-in functions as arguments pos and len In CDS view entities, the functions LEFT and RIGHT have been enhanced. They now accept literals, fields, parameters, expressions, and built-in functions as argument len In CDS view entities, two new application session variables are available: bs_system_id bs_zone_id Using CDS-managed DDIC views has been declared obsolete. The following ABAP program lists all repository objects that use CDS-managed DDIC views: RUT_WHERE_USE_SQLVIEW CDS analytical projection views for modelling analytical queries are available. A CDS analytical projection view is defined using DEFINE TRANSIENT VIEW ENTITY AS PROJECTION ON. The value for the provider contract must be set to ANALYTICAL_QUERY A new type of CDS projection view is available: the CDS transactional interface. CDS transactional interfaces serve as stable public interface layer in a CDS data model. They are typically used in the context of the ABAP RESTful Application Programming Model to provide the basis for a RAP BO interface. A CDS transactional interface view is defined using DEFINE VIEW ENTITY AS PROJECTION ON. The value for the provider contract must be set to TRANSACTIONAL_INTERFACE Special handling for CDS amount fields and CDS quantity fields for comparisons in CDS view entities has been implemented Data type abap.string is now supported for input parameters in the parameter list of a CDS view entity and in the parameter list of a CDS table function Data type abap.string is now supported when binding actual parameters to the input parameters of a CDS view entity, if a CDS table function is used as data source after FROM The new statement EXTEND CUSTOM ENTITY of the DDL of ABAP CDS makes it possible to add new elements to existing CDS custom entities by using CDS custom entity extensions CDS DDIC-based views (obsolete), defined using the statement DEFINE VIEW, are obsolete. When creating new data models, CDS view entities, defined using DEFINE VIEW ENTITY, should be used instead The obsolete ABAP language versions Static ABAP with restricted object use Standard ABAP with restricted object use SAP HANA XSA replaces SAP HANA XSC. The access methods designed specifically for XSC objects are not suitable for XSA objects and have been declared obsolete. This includes DDIC external views and database procedure proxies. More information can be found in SAP Notes 2465027 and 3116165 The ABAP RESTful Application Programming Model (RAP) was enhanced ABAP Cheat Sheets are now available as part of the ABAP Keyword Documentation |
| 7.58 | October 2023 | CDS analytical projection views can now also have analytical dimension views as projected entity. The CDS annotation @AbapCatalog.preserveKey is obsolete and has partly a different behavior now. CDS simple types define elementary data types natively in ABAP CDS. A CDS simple type can be enriched with metadata using CDS annotations. The syntax statement for defining a CDS simple type is DEFINE TYPE. CDS enumerated types define enumerated types natively in ABAP CDS. The syntax statement for defining a CDS enumerated type is DEFINE TYPE ENUM. The ABAP annotation Environment.sql.passValue is now also available for CDS parameters in CDS view entities, CDS projection views, and CDS hierarchies. The annotation scope has been enhanced. A new ABAP annotation is available in CDS view entities, CDS projection views, and CDS hierarchies: Environment.sql.passValueForClient. It works in a similar way to the annotation Environment.sql.passValue, but for client fields. It specifies whether a placeholder ? or a literal value is passed to the database in an ABAP SQL condition when the client field is compared with a host variable. A new syntax for specifying the cardinality of CDS associations, CDS joins, and of filter conditions of CDS path expressions is now available The new CDS entity is available: the CDS scalar function. It is defined using the CDS DDL statement DEFINE SCALAR FUNCTION. A CDS scalar function is linked with an AMDP function in which it is implemented using SQLScript. The matrix of types that can be converted to each other using CAST has been enhanced for CDS DDIC-based views (obsolete) and for CDS view entities. Data types DECFLOAT16 and DECFLOAT34 can now be cast into data type CURR. A WHERE condition is now available also for CDS transactional interfaces to restrict the result set that is returned when the transactional interface is accessed. Typed literals can now be used in more operand positions in ABAP CDS. They can now be used in the WHERE condition of CDS projection views and in the ON condition of CDS associations. A reuse expression $projection.Field can now also be used to reuse fields selected via a path expression. A new type of access rule is available for CDS projection views of type CDS transactional query: the projection_rule defined with the statement GRANT SELECT ON ... AS PROJECTION ON ... FALLBACK ASSOCIATION .... Two new DCL functions are available: SWITCH_RUNTIME_STATE TOGGLE_RUNTIME_STATE Two new system classes for numeric calculations are available: CL_ABAP_BIGINT contains methods for calculations with any size of integer in ABAP. CL_ABAP_RATIONAL contains methods for calculating with rational numbers without any precision loss. The new class CL_ABAP_DIFF compares the content of internal tables and returns information about any differences found. The new methods MOVE_TRUNC, MOVE_TO_SHORT_TRUNC, ADD_TO_SHORT_TRUNC and SUBTRACTSECS_TO_SHORT_TRUNC of system class CL_ABAP_TSTMP round the fractional seconds of long time stamps down while the existing methods MOVE, MOVE_TO_SHORT, ADD_TO_SHORT and SUBTRACTSECS_TO_SHORT round commercially. Since the latter might be unexpected, the new methods can be used now in order to preserve the integer part of a long time stamp. Using the new method GET_CURRENT_PHASE, you get information about the current RAP transactional phase. The new specification \LINE allows the line type of an internal table to be specified in an absolute type name. \LINE can be followed by -comp to specify the type of a component of the line type. In functional methods, the statement RETURN can be used to assign the result of an expression expr to the return value when terminating the method. The addition DEFAULT allows the assignment of values for a target component based on an expression. Up to now, an optimization of the WHERE condition by using key access took place only under very limited circumstances where the key value pairs had to be compared explicitly for equality and combined by AND. Now, the compiler analyzes the WHERE condition thoroughly and tries itself to extract the key/value pairs that are necessary for the key access. ABAP SQL expressions can be defined on the right side of a condition enclosed in parentheses. A new syntax for specifying the cardinality of joins is available: {MANY | ONE | {EXACT ONE}} TO {MANY | ONE | {EXACT ONE}} It is now possible to process multiple internal tables accessed with FROM @itab within one ABAP SQL statement with the ABAP SQL engine. Currently, this is restricted to joins of internal tables where no database tables are involved. With the new addition PRIVILEGED ACCESS, CDS access control can be disabled for a complete SELECT statement. From release 7.58 on, the ABAP Keyword Documentation display offers a function to send a feedback in non-SAP development systems and in the SAP Help Portal. Up to now, the possibility for a feedback mail existed only in SAP's own development systems. The function can be switched on or off in the configuration of the ABAP Keyword Documentation, see SAP Note 3051036. From release 7.58 on, the ABAP Keyword Documentation presents a new layout in ABAP development tools for Eclipse (ADT) where also a toggle between Standard ABAP and ABAP Cloud is available. The new layout includes: New header bar with links to the mail feedback and the web version Highlighted key blocks for hints, code blocks, and others Tables with zebra stripes In release 7.58, the ABAP RESTful Application Programming Model (RAP) was enhanced as follows: RAP BDL in ABAP Release 7.58 ABAP EML in ABAP Release 7.58 |