ABAP Basics: Syntax, Data Types and First Statements
A plain-language guide to ABAP basics: how elementary statements are written, which data types to use, and where to find the keyword index.

ABAP is a typed, statement-based language: each line ends with a period, keywords are English words, and every variable is declared before it is used. Elementary statements follow a simple pattern of a keyword, an operand, and a terminator, and the language ships with a fixed set of built-in data types such as C, I, P, and STRING. The official keyword index is maintained by SAP in the ABAP Keyword Documentation, and a parallel Italian-language reference for the same material is available at ABAP syntax and statements, which covers syntax, data types, internal tables, and the Data Dictionary.
How is basic ABAP syntax and the elementary statements written?
ABAP syntax is built around statements, not expressions. A statement begins with a keyword, continues with operands separated by spaces, and closes with a period. The period is not optional: it tells the runtime where one statement ends and the next begins. Line breaks are cosmetic. You can write a single statement across several lines, or several statements on one line, as long as the periods are in the right places.
Elementary statements fall into a few families. Declaration statements create variables and give them a type. Assignment statements move values. Control statements branch and loop. Output statements write to a list. A minimal program that declares a variable, assigns a value, and writes it out looks like this:
DATA lv_name TYPE string.
lv_name = 'Action Strategies'.
WRITE lv_name.
The first line declares a variable named lv_name with the built-in type string. The second assigns a character literal. The third writes the value to the current list. Nothing else is required: no imports, no main function, no class wrapper. That is the practical meaning of elementary.
ABAP is not case-sensitive for keywords, but the convention is to write keywords in uppercase and identifiers in lowercase or with a prefix. The common prefixes are lv_ for local variables, ls_ for local structures, lt_ for local internal tables, and gv_, gs_, gt_ for global equivalents. These prefixes are not enforced by the compiler. They are a reading aid, and in maintenance work they save time.
Comments use a leading asterisk in column one for a full line, or a double quote for a trailing comment. Chained statements let you repeat a keyword across several lines with a colon, which is common in declarations. The syntax is strict about spaces around operators, and the compiler reports a syntax error with the exact offset when something is wrong. The debugger then lets you set a breakpoint and inspect values line by line.
Which data types are used in ABAP?
ABAP has two layers of typing. The first is the set of built-in elementary types. The second is the Data Dictionary, where types are defined centrally and reused across programs. Beginners meet the built-in types first.
The built-in elementary types you will use most often are:
C: fixed-length character field. The length is set at declaration, and shorter values are padded with blanks.N: numeric text. Digits only, used for codes such as customer numbers where leading zeros matter.I: integer. Whole numbers, typically 4 bytes.P: packed decimal. Used for amounts and quantities, with a defined number of decimals.F: floating point. Used for scientific calculations, not for money.D: date. Stored asYYYYMMDD.T: time. Stored asHHMMSS.STRING: variable-length character string.XSTRING: variable-length byte string.
A declaration names the variable and the type. DATA lv_count TYPE i. creates an integer. DATA lv_amount TYPE p LENGTH 8 DECIMALS 2. creates a packed number with two decimals. DATA lv_text TYPE string. creates a variable-length string. The TYPE addition refers to a type; the LIKE addition refers to another variable or a Dictionary field, which is useful when you want the new variable to match an existing one exactly.
Structured types group fields. A structure declared with BEGIN OF ... END OF or with a Dictionary type holds several components under one name. Internal tables are the ABAP workhorse for lists of data. A table is declared with DATA lt_items TYPE TABLE OF ... or with a standard table type, and rows are added with APPEND, read with READ TABLE, iterated with LOOP AT, and ordered with SORT. These four statements cover most report and maintenance work.
The Data Dictionary, transaction SE11, is where transparent tables, views, and primary keys are defined. A transparent table has a one-to-one relationship with a database table. A view combines fields from one or more tables. The primary key uniquely identifies a row. When you declare a variable with reference to a Dictionary field, you inherit its type, length, and decimal settings, which keeps the program aligned with the database.
Where is the index of ABAP keywords?
The authoritative index is the ABAP Keyword Documentation published by SAP. It lists every keyword, groups them by topic, and gives the exact syntax, additions, and examples. The documentation is available online and is also shipped with the SAP system, where it can be opened from the editor. The index is organized by statement, so you can look up APPEND, LOOP, READ TABLE, SORT, SELECT, CALL FUNCTION, and the rest in alphabetical order.
A second useful entry point is the list of ABAP statements by category: declarations, assignments, control flow, internal tables, database access, and output. That grouping helps when you know what you want to do but not which keyword does it. For Italian-speaking developers, the Registro ABAP site mirrors this structure in Italian and includes a keyword index alongside its sections on syntax, the Data Dictionary, ALV lists, Smart Forms, BAPI, and RFC.
What does a first ABAP program actually look like?
A first program is usually a report. It starts with a REPORT statement, declares variables, reads data, and writes output. A minimal report that reads a table and prints a few fields looks like this:
REPORT z_first_report.
DATA: lt_items TYPE TABLE OF mara,
ls_item TYPE mara.
SELECT * FROM mara INTO TABLE lt_items UP TO 10 ROWS.
LOOP AT lt_items INTO ls_item.
WRITE: / ls_item-matnr, ls_item-mtart.
ENDLOOP.
The REPORT statement names the program. The DATA statement declares an internal table and a work area, both typed on the Dictionary table MARA. The SELECT reads up to ten rows. The LOOP iterates and writes the material number and material type. The slash in WRITE: / starts a new line. This is the shape of most beginner reports, and it is also the shape of many production reports after years of maintenance.
From there, the natural next steps are selection screens, ALV grids, and function modules. Selection screens let the user enter parameters before the report runs. ALV grids replace plain WRITE output with a sortable, interactive list. Function modules and BAPI calls let the report exchange data with other systems over RFC. Each of these builds on the same elementary statements: declare, assign, loop, read, write.
How do you move from syntax to working code?
Syntax is the entry ticket, not the destination. The fastest way to learn ABAP is to write small reports against real tables, run them, and read the syntax errors when they appear. The debugger is part of the learning loop: set a breakpoint, step through the statements, and watch how values change. Internal tables and the Data Dictionary are the two areas where beginners spend most of their time, and both reward patience.
A practical sequence is: declare variables with the right types, read a small table, loop through it, write the output, then add a selection screen. After that, replace the plain list with an ALV grid. When the report needs to talk to another system, look up the relevant BAPI or RFC-enabled function module and call it with CALL FUNCTION. Transport orders and STMS come later, when the code has to move between systems.
The reference material matters less than the habit of running code. Keep the keyword index open, keep the debugger ready, and treat every syntax error as a short lesson in how the language is actually parsed.