Getting Started
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
ABAP is the programming language in which SAP writes its business software, and the language you use to extend it. A program
written in ABAP does not run on your own computer: it runs on an application server that sits between the people using the
software and the database that stores the data. This page explains that three-part layout, what a work process is, and which
SAP products run ABAP today, so that the rest of this section has a place to hang its examples. It is written against
Standard ABAP release 8.16 and ABAP for Cloud Development release 9.20 (2608). Standard ABAP is the full language as it runs
on an SAP S/4HANA on-premise or Private Edition system, where classic features such as reports and WRITE output are still
available. ABAP Cloud is the restricted, cloud-ready model used on SAP BTP and in SAP S/4HANA Cloud Public Edition, and it
allows only released APIs. After reading you can name the three tiers, say where your code runs, and tell which examples in
this section need a real SAP system and which run in a free local playground.
Before you read
-
No ABAP knowledge is needed. If you know another language, the section on COBOL, the other classic business-application language, is a useful comparison: COBOL.
-
The next page, Programming Concepts for Newcomers, introduces variables, conditions, loops and objects in plain words (it follows in this section).
-
The local playground used for the examples that need no SAP system is set up on the Hands-on Lab page (it follows in this section).
Key terms
-
Application server: the program layer that runs your ABAP code and talks to both the user’s screen and the database.
-
Work process: a worker inside the application server that runs your ABAP code when it is given a request.
-
Dispatcher: the part of the application server that hands each incoming request to a free work process.
-
ABAP Cloud: the cloud-ready way of writing ABAP that uses only released APIs and can be upgraded safely.
-
Standard ABAP: the unrestricted language version of classic ABAP, which covers all elements of the ABAP technology.
-
ABAP Development Tools (ADT): the Eclipse-based programming environment in which modern ABAP is written.
What ABAP is
ABAP is a statement-based language for business applications: it has built-in support for tables of records, amounts, dates, database access and, in its modern form, classes and interfaces. Your source code is kept as development objects inside the SAP system itself, not as loose files on your computer. This is the main difference from most languages you may know: the system is both the place you develop and the place the program runs.
The language exists in two flavours, and you will meet both. Standard ABAP is the unrestricted language version and covers all elements of the ABAP technology. ABAP for Cloud Development is a restricted language version, and ABAP Cloud is the programming model built on it: you may use only the repository objects SAP has released for that purpose (released APIs), and development with ABAP Cloud is meant to give cloud-ready, upgrade-stable solutions. On S/4HANA on premise and Private Edition you can use both. The page Language Versions and Released APIs explains the difference in detail.
The three tiers
An SAP system that runs ABAP is built in three tiers, shown in the diagram below.
The presentation tier is what people see: SAP Fiori apps in a web browser, the older SAP GUI desktop client, and ADT, the development tool. None of them runs business logic. They send a request to the application server and show the answer.
The application tier is the application server for ABAP. The ABAP dispatcher distributes the requests it receives to the work processes. A work process is a worker that runs your ABAP code for a request. The server has several work processes, so requests from many users can be handled side by side. Work processes come in types: a dialog work process executes the dialog steps that an active user triggers, and a background work process processes background jobs. Your program reaches the database from the application server, never from the presentation tier.
The database tier stores the data. In the diagram it is SAP HANA, the database of the S/4HANA products. Modern ABAP lets the database do as much of the work as it can, using ABAP SQL and CDS views, instead of reading every row into the program. Later pages of this section return to that idea.
Where ABAP runs
You will usually meet ABAP through one of these products. Pick the row that matches the system you work on.
| Product | What it is for ABAP developers | Which ABAP |
|---|---|---|
SAP S/4HANA, on premise |
The current ERP suite installed and run by the customer. Documented release label "2025 FPS02 (Oct 2026)". |
Standard ABAP, and ABAP Cloud |
SAP S/4HANA Cloud Private Edition |
The single-customer cloud edition of SAP S/4HANA. Its ABAP keyword documentation is the Standard ABAP one. |
Standard ABAP, and ABAP Cloud |
SAP S/4HANA Cloud Public Edition |
The cloud edition of SAP S/4HANA, documented release 2608. |
ABAP Cloud only |
SAP BTP ABAP environment |
The ABAP environment of SAP BTP, documented release 2608, for developing in ABAP Cloud. |
ABAP Cloud only |
SAP ERP Central Component (ECC) and other older systems |
The previous generation. SAP’s published maintenance statement is mainstream support until the end of 2027, with optional extended maintenance until the end of 2030. |
Classic ABAP of an older release; newer statements may be missing |
ECC systems run on an older ABAP release, so the modern syntax shown in this section may not compile there. The Standard ABAP keyword documentation for release 8.16 is published for SAP S/4HANA 2025 and SAP S/4HANA Cloud Private Edition, and the ABAP for Cloud Development documentation for release 9.20 belongs to the 2608 line of S/4HANA Cloud Public Edition and the SAP BTP ABAP environment.
Your first ABAP class
Modern ABAP programs are written as classes. The smallest useful one implements the interface IF_OO_ADT_CLASSRUN, which
lets you run a class from ADT with Run As > ABAP Application (Console) (or the F9 key) and see its output in the ADT
console.
The method main( ) receives an output object, and out->write( ) prints whatever you give it. This example requires an
SAP system; not run here, because the playground below has no output class for IF_OO_ADT_CLASSRUN.
CLASS zcl_hello DEFINITION
PUBLIC
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
ENDCLASS.
CLASS zcl_hello IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
out->write( 'Hello' ).
ENDMETHOD.
ENDCLASS.
Source: ABAP Cheat Sheet: ABAP for Cloud Development; running a class: ABAP Cheat Sheets: README
Read it from the top. CLASS ... DEFINITION declares the class name and that it is public and cannot be subclassed
(FINAL). INTERFACES says the class promises to provide the methods of the interface. CLASS ... IMPLEMENTATION holds
the code, and METHOD implements the single method main of the interface, whose name is written with a tilde:
if_oo_adt_classrun~main. Each statement ends with a period, and the string literal 'Hello' is passed to the method.
Trying ABAP without an SAP system
You do not need an SAP system to learn the language. A free local playground transpiles ABAP to JavaScript with abaplint and
runs it on Node.js, using the open-abap runtime. It needs no account and no sign-in. Many language examples in this section
run there. In a report, output is
written with WRITE instead of out->write( ). This tiny program matches a file of the lab and runs in the local
playground:
REPORT zhello.
WRITE / 'Hello from the local ABAP playground'.
Some topics cannot run there and need a real SAP system: CDS views, the RAP programming model, ADT itself, and anything
that depends on SAP-delivered objects. The playground also lacks a few statements, such as LOOP AT ... GROUP BY,
COLLECT and SQL aggregate functions, and each page says when an example needs a real system. A page that does so marks its examples "requires an SAP system; not run here".
Older material you may meet
Many books, blog posts and older systems show ABAP written before release 7.40. Older code declares every variable at the
top of the program with DATA, fills internal tables with APPEND and READ TABLE, and builds text with CONCATENATE.
Current ABAP uses inline declarations such as DATA(name) = ..., constructor expressions such as VALUE and NEW, string
templates in | |, and table expressions such as itab[ 1 ]. Older code is still valid on Standard ABAP and you will
read a lot of it in maintenance work, but ABAP Cloud and new development favour the modern forms. Classic lists written with
WRITE, which the keyword documentation no longer recommends, and classic dynpro screens belong to classic ABAP; ABAP Cloud
has no access to SAP GUI and is built on classes and the RAP programming model.
Summary
-
ABAP is SAP’s business-application language; your code is stored in and runs inside the SAP system.
-
An SAP system has a presentation tier (Fiori, SAP GUI, ADT), an application tier (a dispatcher plus work processes) and a database tier (SAP HANA).
-
The dispatcher distributes requests to work processes, which run your ABAP code; dialog and background are two types.
-
Standard ABAP release 8.16 is documented for S/4HANA 2025 and Private Edition; ABAP for Cloud Development release 9.20 (2608) is documented for BTP and S/4HANA Cloud Public Edition and allows only released APIs.
-
A class that implements
IF_OO_ADT_CLASSRUNis the simplest way to run code from ADT; many language examples also run in a free local playground without an SAP system.
Try it
To do this by hand, follow the guide Set Up a Local ABAP Playground: it installs the free local playground and runs a first sample without an SAP system or an account.