Boolean values, or truth values, are results of logical expressions. A truth value is either true or false. ABAP does not, and probably never will support explicit Boolean data types.

The result of a logical expression cannot be assigned directly to a data object. Nevertheless, this can be achieved through Boolean functions.

It has become common practice to express the truth value true as value X and the truth value false as a ' ' (blank).

That being said, below source code serves as a bad example. It is not recommended to work with the literal 'X' or ' ' even though you will see this regularly in legacy code:

DATA does_exist TYPE c LENGTH 1.

does_exist = 'X'.

IF does_exist IS NOT INITIAL.

Using abap_true and abap_false

The type group abap contains a data type abap_bool of type char with length 1, and the constants abap_true and abap_false. These constants serve as substitutes for a real Boolean data type.

Use the type abap_bool when working with truth values. A data object declared in this way should only have abap_true and abap_false as values.

Below is the recommended example. Instead of declaring does_exist as TYPE c we use the type abap_bool and replace the text literal with the constants abap_true and abap_false:

DATA does_exist TYPE abap_bool.

does_exist = abap_true.

IF does_exist = abap_true.