Syntax

Concept

An ABAP statement consists of language elements (or key words) and operands, which must be separated by at least one space, and is closed by a period ( .). ABAP statements are usually introduced by an ABAP key word. Further language elements can be additions of an ABAP key word, operators, and parentheses. The syntax is not case-sensitive. A statement can cross multiple lines of the program and a line can contain more than one statement.

Consecutive statements that have the same initial part can be combined in a chained statement. This is done by specifying the initial part once and closing it using a colon ( :). The remaining parts then follow, separated by commas ( ,). Semantically, a chained statement is handled in the same way as the corresponding sequence of individual ABAP statements. Chained statements are intended for use in declarations, but it is possible to use them elsewhere.

An asterisk ( *) in the first column flags the entire line as a comment. A quotation mark ( ") anywhere in a line flags the rest of the line as a comment.

Data objects with an appropriate data type must be used in operand positions. In reader positions, literals defined in the source code can also be used. Number literals are sequences of digits with optional signs; text field literals are characters enclosed in quotation marks ('); string literals are characters enclosed in back quotes ( ').

The names of all objects that can be defined in ABAP programs, such as data types, data objects, classes, or procedures, can be up to 30 characters long, should contain letters, digits, and the underscore character ( _) only, and cannot start with a digit. In composite objects, the names of the individual components are separated by selectors. The following selectors can be used: - Structure component selector, -> object component selector, => class component selector ~ interface component selector.