Example of Predefined Elementary Data Types and Objects

The following program is an example of how to declare data objects with predefined elementary data types.
PROGRAM SAPMZTST.
DATA TEXT1(14) TYPE C.
DATA TEXT2 LIKE TEXT1.
DATA NUMBER TYPE I.
TEXT1 = 'The number'.
NUMBER = 100.
TEXT2 = 'is an integer.'.
WRITE: TEXT1, NUMBER, TEXT2.
This program produces the following output on the screen:
The number 100 is an integer.
In this example, the data objects TEXT1, TEXT2, and NUMBER are declared with the DATA statement. The data type of each is specified with the TYPE parameter or the LIKE parameter of the DATA statement. The data types used here (C, I) are predefined in the system. Then, values are assigned to the data objects and the contents of the data objects are displayed on the screen.