Entering content frame

Data Types Locate the document in its SAP Library structure

All programming languages distinguish between various types of data with various uses, such as ….. type data for storing or displaying values and numerical data for calculations. The attributes in question are described using data types. You can define, for example, how data is stored in the repository, and how the ABAP statements work with the data.

Data types can be divided into elementary, reference, and complex types.

Elementary Types

These are data types of fixed or variable length that are not made up of other types.

The difference between variable length data types and fixed length data types is that the length and the memory space required by data objects of variable length data types can change dynamically during runtime, and that these data types cannot be defined irreversibly while the data object is being declared.
Predefined and User-Defined Elementary Data Types

You can also define your own elementary data types in ABAP using the TYPES statement. You base these on the predefined data types. This determines all of the technical attributes of the new data type. For example, you could define a data type P_2 with two decimal places, based on the predefined data type P. You could then use this new type in your data declarations.

Reference Types

Reference types are deep data types that describe reference variables, that is, data objects that contain references. A reference variable can be defined as a component of a complex data object such as a structure or internal table as well as a single field.

Complex Data Types

Complex data types are made up of other data types. A distinction is made here between structured types and table types.


The instances of structured types are known as structures, and are used in ABAP programs to group work areas that logically belong together. Since the individual elements within a structure can be of any type, and can also themselves be structures or internal tables, the possible uses of structures are very wide-ranging. For example, you can use a structure with elementary data types to display lines from a database table within a program. You can also use structures containing aggregated elements to include all of the attributes of a screen or control in a single data object.

The following terms are important when we talk about structures:

        Nested and non-nested structures

        Flat and deep structures


Nestedstructures are structures that in turn contain one or more other structures as components.

Flatstructures contain only elementary data types of fixed length (no internal tables, reference types, or strings). The term flat structure can apply regardless of whether the structure is nested or not. Nested structures are flat so long as none of the specified types is contained in any nesting level.

Any structure that contains at least one internal table, reference type, or string as a component (regardless of nesting) is known accordingly as a deep structure.

Only in the case of flat structures is the data content of the structure actually within the memory of the structure itself, while deep structures contain pointers to the data at the position of the deepest components. Since the field contents are not stored with the field descriptions in the case of deep structures, assignments, offset and length specifications and other operations are handled differently from flat structures.

Internal Tables

Internal tables consists of a series of lines that all have the same data type. Internal tables are characterized by:

        Their line type

        A table key that is used to identify table rows. The key can be unique or non-unique.

        The table type that defines how ABAP will access individual table entries (non-sorted and sorted index tables and hash tables).

You should use internal tables whenever you need to use structured data within a program. One imprint use is to store data from the database within a program.

Examples for Complex Data Types

The following list contains examples of complex data types in ascending order of complexity:


       1.      Structures consisting of a series of elementary data types of fixed length (non-nested, flat structures)

       2.      An internal table whose line type is an elementary type (vector).

       3.      Internal tables whose line type is a non-nested structure ('real' table)

       4.      Structures with structures as components (nested structures, flat or deep)

       5.      structures containing internal tables as components (deep structures)

       6.      Internal tables whose line type contains further internal tables.

This graphic is explained in the accompanying text

The graphic shows how elementary fields can be combined to form complex types.

Further Information about Data Types

- Definition and visibility of data types at various levels of the SAP system.

- Compatibility.


Leaving content frame