Creating Data Objects and Data Types

This section describes how to create data objects and data types in your program. Apart from literals, you must declare each data object with a declarative statement.

In declarative statements, you must specify the data types of all data objects. To do this, you can use any data type described under Data Types.

You define the data type of an object in the declarative statement, either

TYPE and LIKE are optional additions to most of the data declaration statements listed below.

With the TYPE option, you assign the data type <datatype> directly to the declared data object.

With the LIKE option, you assign the data type of another data object <dataobject> to the declared data object. This means that you reference the data type indirectly.

There are separate name spaces for data objects and data types. This means that a name can at the same time be the name of a data object as well as the name of a data type.

In your program, you can either define data objects statically using data declaration statements or create them dynamically with an operational statement.

ABAP includes the following keywords for creating data objects and data types statically:

The DATA Statement

for creating variables

The CONSTANTS Statement

for creating constants

The STATICS Statement

for creating variables which exist as long as the program runs, but are only visible in a procedure

The TABLES Statement

for creating table work areas

The TYPES Statement

for creating user-defined data types

In the context of internal tables, you use the operational statements APPEND, COLLECT, and INSERT to create lines of an internal tables dynamically (see Filling Internal Tables).

In the context of selection screens, you use the additional statements PARAMETERS and SELECT-OPTIONS to create data objects with a special function (see Working with Selection Screens ).