Skip to content

Keywords

One line: One page per ABAP keyword — what it does, the trap it comes with, and a program that demonstrates it.

ABAP's vocabulary is unusually large and unusually layered. Statements added in 1998 still work, still appear in production code, and sit three lines away from expressions added in 2013 that do the same job differently. A keyword page here answers four questions: what it does, what it quietly does not do, which release it needs, and what to write instead when the answer is "something newer".

Most pages carry a program in a snippets/ folder. Topics take the other cut through the same material: one page per idea, pulling several keywords together.

What the machine checks here, and what it cannot

Every program under snippets/ is parsed and syntax-checked by abaplint on every push, against the release named in abaplint.json. None of them has been run, because nothing in CI can run ABAP — so a snippet page shows code and never shows output. The examples/ folder is the other half of that rule: a program in there was run by a human, and carries the transcript to prove it.

Knowing exactly where the gate stops matters more than the reassurance that one exists. Measured against abaplint 2.120.19:

A mistake like this Caught?
lv_total = lv_does_not_exist + 1. Yes — "lv_does_not_exist" not found, findTop (check_syntax)
FOR x IN itab WHERE ( table_line MOD 2 = 1 ) — arithmetic in a WHERE Yes, as a parser error; the construct is not ABAP
MESSAGE 'text' TYPE 'S' INTO lv_var. — an addition that form does not take Yes, as a parser error
cl_abap_typedescr=>describe_by_data_no_such_method( x ) No — the SAP class library is not in this repo, so a wrong method or parameter on a standard class passes untouched
A class that inherits from cx_static_check Reported as not found, which is why local exception classes appear on the page as prose rather than in a snippet

So: the syntax is checked, the SAP-side names are not, and the behaviour is not. Where a page states what a construct produces, it is stating the documented rule, not a recorded run.

Declaring things

Keyword Page In one line
DATA DATA — and DATA( ) A variable, declared up front or born where it is first written
TYPES, CONSTANTS TYPES and CONSTANTS Naming a shape once so the rest of the program refers to it
FIELD-SYMBOLS, ASSIGN FIELD-SYMBOLS and ASSIGN Another name for memory you already have — and the dynamic escape hatch
REF, REF TO data, ->* Data references A value that points at memory, and can be kept and stored
STATICS STATICS A local variable that survives between calls
TYPES BEGIN OF ENUM Enumerations A fixed set of values the compiler can check
TYPE RANGE OF Ranges tables Sign, option, low, high — what a SELECT-OPTIONS hands you
TYPES BEGIN OF MESH Meshes Tables with declared associations between them; rare, and worth recognising

Building values

Keyword Page In one line
VALUE VALUE A structure or a whole table as one expression
FOR FOR The loop that lives inside an expression
REDUCE REDUCE Many rows folded into one value
FILTER FILTER A subset of a table, if the table has the right key
CORRESPONDING CORRESPONDING and MOVE-CORRESPONDING Copy by matching names — and the difference that costs a field
LET LET A local name inside an expression
NEW NEW An object, or a data reference, in one expression
CAST, CONV, EXACT CAST, CONV and EXACT Changing the type of a reference, of a value, or refusing to
\|…\| String templates Text with expressions in it, and formatting options that do the work
xsdbool( ), boolc( ) Booleans There is no boolean type; here is the convention, and the trap
abs, round, nmax, DIV, MOD Numeric functions and operators Rounding modes, integer operators, and the MOD that is never negative

Choosing and repeating

Keyword Page In one line
IF, CASE IF and CASE The statements — and when each is the wrong one
COND, SWITCH COND and SWITCH The same two choices as expressions
CASE TYPE OF, IS INSTANCE OF CASE TYPE OF Branching on an object's class — and why that is usually a missing method
DO, WHILE DO and WHILE Counting loops, and sy-index
CHECK, CONTINUE, EXIT, RETURN CHECK, CONTINUE, EXIT, RETURN Four ways out, and only two of them mean what they look like
LEAVE, STOP LEAVE and STOP Leaving a screen, a list, a transaction or the program

Internal tables

Keyword Page In one line
LOOP AT LOOP AT INTO copies, ASSIGNING does not, GROUP BY replaces the control break
READ TABLE, itab[ ] READ TABLE and table expressions sy-subrc or an exception — you choose which by how you write the read
APPEND, INSERT, MODIFY, DELETE Changing a table Which statement the table kind allows, and what each costs
COLLECT COLLECT Summing rows into a table by key, in one statement
SORT, DELETE ADJACENT DUPLICATES SORT and adjacent duplicates The pair that must be used together, and usually is not
AT NEW, AT END OF, SUM Control breaks Totals per group the 1990s way, and the masking rule nobody expects
DESCRIBE, lines( ) DESCRIBE and lines( ) How many rows, and why the old statement lingers

Talking to the database

Keyword Page In one line
SELECT SELECT Columns, joins, aggregates, and the @ that the strict syntax insists on
INSERT, UPDATE, MODIFY, DELETE Database writes Four write statements, sy-dbcnt, and the commit that is a separate decision
WITH WITH — common table expressions A named subquery, used like a table, in one round trip (7.51)
OPEN CURSOR, FETCH, SELECT … ENDSELECT Cursors Reading a result set too big to hold, and the commit that closes it
EXEC SQL, ADBC Native SQL Bypassing Open SQL, and everything that bypasses with it
COMMIT WORK, ROLLBACK WORK COMMIT WORK and ROLLBACK WORK Where the database LUW ends, and what ends it without asking
AUTHORITY-CHECK AUTHORITY-CHECK The check the database will not do for you

Text and files

Keyword Page In one line
CONCATENATE, SPLIT CONCATENATE and SPLIT The statements, and the expressions that replaced one of them
CONDENSE, TRANSLATE, SHIFT In-place string statements Change the variable where it stands — and the function twins that return a value
FIND, REPLACE FIND and REPLACE Searching with and without regular expressions
CALL TRANSFORMATION CALL TRANSFORMATION ABAP to XML and JSON, with the identity transformation and your own
OPEN DATASET OPEN DATASET Files on the application server, and the encoding you must name

Errors and messages

Keyword Page In one line
TRY, CATCH, RAISE TRY, CATCH, RAISE Class-based exceptions, and the three flavours the compiler treats differently
RETRY, RESUME, RESUMABLE RETRY and RESUME Going back after an exception — the batch that must not stop
RAISE SHORTDUMP RAISE SHORTDUMP A dump on purpose, carrying the facts (7.53)
MESSAGE MESSAGE Six types, and each one decides what happens to the program next
ASSERT ASSERT A claim that ends the program when it is false — on purpose
BREAK-POINT, LOG-POINT, ASSERT ID Checkpoint groups Debugging aids that stay in shipped code and never fire unless switched on

Objects and modularization

Keyword Page In one line
CLASS CLASS Definition and implementation, visibility, inheritance
INTERFACE, INTERFACES INTERFACE and INTERFACES The contract, and the ~ that names a method through it
METHODS METHODS and parameters IMPORTING, EXPORTING, CHANGING, RETURNING, and which to reach for
EVENTS, RAISE EVENT, SET HANDLER Events Objects that publish, and the handlers that subscribe
FRIENDS, ALIASES, ABSTRACT, FINAL The class additions Who may instantiate, inherit, see the private section, or use a short name
CALL FUNCTION CALL FUNCTION Function modules, DESTINATION, and classic exceptions
GET BADI, CALL BADI GET BADI and CALL BADI Calling an enhancement spot, and finding out whether yours will run
ENHANCEMENT-POINT, ENHANCEMENT-SECTION Enhancement points Source-level hooks in SAP's code, explicit and implicit

Programs, screens and output

Keyword Page In one line
INITIALIZATION, AT SELECTION-SCREEN, START-OF-SELECTION Report events A report is event blocks in a fixed order, not a script
PARAMETERS, SELECT-OPTIONS PARAMETERS and SELECT-OPTIONS The selection screen you get for free, and its ranges table
SUBMIT SUBMIT Running another report, with its parameters, its list, or as a job
CALL TRANSACTION, LEAVE TO TRANSACTION CALL TRANSACTION Running a transaction from code — with or without driving its screens
EXPORT, IMPORT, SET/GET PARAMETER EXPORT and IMPORT ABAP memory, SAP memory and the shared buffer
CALL SCREEN, MODULE, PROCESS BEFORE OUTPUT Classic screens Dynpros and flow logic — the model every classic transaction runs on
WRITE WRITE List output: still the fastest way to see a number, still not a UI

The system, and time

Keyword Page In one line
sy-subrc, sy-tabix, sy-index, … System fields The structure the kernel keeps for you, and the three fields that cause bugs
GET TIME, GET RUN TIME, GET TIME STAMP, WAIT Asking what time it is Refreshing the clock, timing a block, and the WAIT that commits

Legacy you will read

Keyword Page In one line
FORM, PERFORM FORM and PERFORM Obsolete, everywhere, and worth reading fluently
TABLES, OCCURS, WITH HEADER LINE, RANGES, TYPE-POOLS Obsolete declarations Recognise them, and the header line above all
MOVE, ADD, SUBTRACT, COMPUTE Obsolete statements Assignment and arithmetic before operators existed
DEFINE Macros Text substitution you cannot debug

See also