Show TOC

LiteralsLocate this document in the navigation structure

Literals are unnamed data objects that you create within the source code of a program. They are fully defined by their value. You cannot change the value of a literal. There are two types of literals: numeric and character.

Numeric Literals

Number literals are sequences of digits which can have a prefixed sign. In number literals there are no decimal separators and no notation with mantissa and exponent

'[mantissa][E][exponent]'

are possible as well.

Tip

Examples of numeric literals:

123-93+456

Numeric literals in ABAP statements:

DATA number TYPE i VALUE -1234.

WRITE 6789.

MOVE 100 TO number.

Character Literals

Character literals are sequences of alphanumeric characters in the source code of an ABAP program enclosed in single quotation marks or backquotes. Character literals enclosed in quotation marks have the predefined ABAP type c and are described as text field literals. Literals enclosed in backquotes have the ABAP type string and are described as string literals. The field length is defined by the number of characters. With text field literals trailing blanks are ignored while in string literals they are taken into account.

Tip

Examples of text field literals:

'Antony Smith''69190 Walldorf'

Examples of string literals:

`Antony Smith    ``69190 Walldorf   `

If you use character literals in operand positions at which a numeric value is expected, they are converted into a numeric value.

Tip

Examples of character literals that can be converted into numeric types:

'12345678901234567890''+0.58498''-8473.67''-12.34567''-765E-04''1234E5''+12E+23''+12.3E-4''1E160'