Show TOC

Data Types in ABAP DictionaryLocate this document in the navigation structure

The ABAP Dictionary allows you to define global data types. You can use the TYPE addition of an appropriate ABAP statement to refer to these data types in any ABAP program.

These data types are defined using the Dictionar tool in the ABAP Workbench. The following input fields there are relevant to data types:

There are three groups on the initial screen:

Database Tables and Views

One of the most important tasks of the ABAP Dictionary is to administer database tables in the central database of the SAP system.. The dictionary contains meta-descriptions of the database tables, and uses these to create the physical tables in the database. A view is a "virtual table" containing fields from one or more tables.

In the description of a database table, the table rows consist of single fields or columns. An elementary data type must be assigned to each column. The elementary types in ABAP Dictionary are data elements. Like data objects in ABAP programs, database tables and views have data types as attributes. A row of a database table or view has the data type of a flat structure, which consists of individual data elements.

In ABAP programs, you can use the TYPE addition with the data type of a database table or view. You may refer to the whole structure or to individual components:

... TYPE dbtab ...

refers to the complex data type of the structure,

... TYPE dbtab-comp ...

refers to the elementary data type of component comp.

If you define a complex data type type as a structure using

TYPES type TYPE dbtab.

the components of the data type type inherit the names of the components of the database table or view, and can be addressed in the program using type-comp.

To ensure compatibility with previous releases, you can still use the LIKE addition to refer to database tables or views, except within classes. The reason for this is that in earlier releases, the physical presence of the database tables as objects was emphasized, even though the dictionary only contains meta-descriptions and data types.

Defining program-local data types by referring to database tables and views is one of the essential techniques for processing data from database tables in ABAP. Data objects that you define in this way always have the right type to contain data from the corresponding database table. ABAP Open SQL allows you to read a single field, a range of fields, or an entire database table or view into an internal table.


TYPES: city       TYPE spfli-cityfrom,       spfli_type TYPE STANDARD TABLE OF spfli WITH DEFAULT KEY.

DATA: wa_city  TYPE city,      wa_spfli TYPE spfli_type.


SELECT SINGLE cityfrom FROM spfli                       INTO wa_city                       WHERE carrid = 'LH' AND connid = '400'.


SELECT * FROM spfli INTO TABLE wa_spfli.


This example defines an elementary data type "city" that refers to a single field of the database table SPFLI and an internal table spfli_type, whose row type is the same as the structure of the database table. The Open SQL statement SELECT reads data from the database into the corresponding declared data objects.

Data Types

Data types are the actual type definitions in ABAP Dictionary. They allow you to define elementary types, reference types, and complex types of the ABAP type concept that are visible globally in the system. The data types of database tables are a subset of all possible types, namely flat structures. Global object types (classes and interfaces) are not stored in ABAP Dictionary, but in the class library. You create them using the Class Builder tool.

For a detailed description of data types and their definitions, refer to the Types section of the ABAP Dictionary documentation. The following descriptions mention the types only briefly, along with how you can refer to them from ABAP programs.

Data Elements

Data elements in ABAP Dictionary describe individual fields. They are the smallest indivisible units of the complex types described below, and are used to specify the types of columns in the database. Data elements can be elementary types or reference types.

  • Elementary types

    Elementary types are part of the dual-level domain concept for fields in ABAP Dictionary. The elementary type has semantic attributes, such as texts, value tables, and documentation, and has a data type. There are two different ways to specify a data type:

    • By directly assigning an ABAP Dictionary type.

    You can assign a predefined ABAP Dictionary type and a number of characters to an elementary type. The ABAP Dictionary has considerably more predefined types than the ABAP programming language. The number of characters here is not the field length in bytes, but the number of valid characters excluding formatting characters. The data types are different because the predefined data types in the ABAP Dictionary have to be compatible with the external data types of the database tables supported by SAP Web AS ABAP.

    When you refer to data types from the ABAP Dictionary in an ABAP program, the predefined dictionary types are converted to ABAP types as follows:

    Dictionary Type Meaning Maximum Length n ABAP Type


    Calculation/amount field

    1-31, in Tabellen 1-17



    Single-byte integer


    Internal only


    Two-byte integer


    Internal only


    Four-byte integer




    Currency field




    Currency key












    Obsolete data type


    Internal only


    Floating point number




    Numeric text








    Long Character




    String of variable length




    Byte string of variable length








    Accounting period YYYYMM




    Time HHMMSS




    Byte string




    Long byte string









    internal 1, external 2


    ("max" in LCHR and LRAW is the value of a preceding INT2 field. The "internal" length of a LANG field is in the dictionary; the "external" length refers to the display on the screen.

    • Assigning a domain

    The technical attributes are inherited from a domain. Domains are standalone repository objects in ABAP Dictionary. They can specify the technical attributes of a data element. One domain can be used by any number of data elements. When you create a domain, you must specify a dictionary data type (see above table) and the number of characters.

  • Reference Types

    Reference types describe single fields that can contain references to global classes and interfaces from the ABAP class library.

In an ABAP program, you can use the TYPE addition to refer directly to a data element. The predefined dictionary data types of the domain are then converted into the corresponding ABAP types.

If you define a local data type in a program by referring to a data element as follows:

TYPES dtype TYPE data_element.

the semantic properties of the data element are inherited and are used, for example, when you display a data object with type dtype on the screen. Since all data types in ABAP Dictionary are based on data elements, they all contain the corresponding semantic attributes.


TYPES company TYPE s_carr_id.

DATA wa_company TYPE company.

wa_company = 'UA '.

WRITE: 'Company:', wa_company.

This example defines a local type company that refers to the data element S_CARR_ID. The data element is associated with the identically named domain S_CARR_ID. The domain defines the technical attributes as data type CHAR with length 3. The local data type COMPANY in the program therefore has the ABAP type c(3). COMPANY also adopts the semantic attributes of the data element. In the above example, we declare a data object wa_company with this type and display it on a list. If the user chooses F1 help for the output field, the help text stored in ABAP Dictionary appears in a dialog box.


A structure is a sequence of any other data types from ABAP Dictionary, that is, data elements, structures, table types, or database tables. When you create a structure in the ABAP Dictionary, each component must have a name and a data type.

In an ABAP program, you can use the TYPE addition to refer directly to a structure.

If you define a local data type in a program by referring to a structure as follows:

TYPES dtype TYPE structure.

the construction blueprint of the structure is used to create a local structure dtype in the program. The predefined dictionary data types of the domains used by the data elements in the structure are converted into the corresponding ABAP types. The semantic attributes of the data elements are used for the corresponding components of the structure in the program. The components of the local structure dtype have the same names as those of the structure in ABAP Dictionary.

To ensure compatibility with previous releases, it is still possible to use the LIKE addition in an ABAP program to refer to a structure in ABAP Dictionary (except in classes).


Suppose the structure STRUCT is defined as follows in ABAP Dictionary:

Field Name type Name Description



Character field with length 1



Character field with length 8



Character field with length 10

The types CHAR01 to CHAR10 are data elements with corresponding domains. We can refer to this structure in ABAP:

TYPES struct_type TYPE struct.

DATA wa TYPE struct_type.

wa-col1 = '1'.wa-col2 = '12345678'.wa-col3 = '1234567890'.

This program creates a local structure in the program, struct_type, and a corresponding data object wa. You can address the components using the component names from the original structure.

Table Types

Table types are construction blueprints for internal tables that are stored in ABAP Dictionary. When you create a table type in ABAP Dictionary, you specify the row type, access type, and key. The row type can be any data type from ABAP Dictionary, that is, a data element, a structure, a table type, or the type of a database table. You can also enter a predefined dictionary type directly as the row type, in the same way that you can with a domain.

In an ABAP program, you can use the TYPE addition to refer directly to a table type.

If you define a local data type in a program by referring to a table type as follows:

TYPES dtype TYPE table.

the construction blueprint of the table type is used to create a local internal table dtype in the program. The predefined dictionary data types of the domains used by the data elements in the structure are converted into the corresponding ABAP types. The semantic attributes of the data elements are used for the corresponding components of the internal table in the program.


Suppose the table type STRUCT_TABLE is defined in the dictionary with the row type STRUCT from the previous example. We can refer to the table type in ABAP:

TYPES table_type TYPE struct_table.

DATA: table_wa TYPE table_type,      line_wa  LIKE LINE OF table_wa.


LOOP AT table_wa INTO line_wa.  ...  WRITE: line_wa-col1, line_wa-col1, line_wa-col1.  ...ENDLOOP.

This program defines an internal table type table_type . From it, we define data objects table_wa and, consequently, line_wa. line_wa corresponds to the row type of the table type in the dictionary, and is therefore compatible with the structure STRUCT

Type Groups

Before Release 4.5A, it was not possible to define standalone types in the ABAP Dictionary to which you could refer using a TYPE addition in an ABAP program. It was only possible to refer to flat structures. Structures in programs corresponded to the structures of database tables or structures in ABAP Dictionary. In ABAP programs, you could only refer to database tables and structures in ABAP Dictionary using LIKE. It was, however, possible to refer to individual components of the dictionary type. Complex local data types such as internal tables or deep structures had no equivalent in the ABAP Dictionary. The solution to this from Release 3.0 onwards was to use type groups. Type groups were based on the include technique, and allowed you to store any type definitions globally in the dictionary by defining them using TYPES statements.

The definition of a type group is a fragment of ABAP code which you enter in ABAP Editor. The first statement for the type group pool is always:


After that, you define data types using the statement TYPES. As before, It is also possible to define global constants using the CONSTANTS statement. All the names of these data types and constants must begin with the name of the type group and an underscore: pool_

In an ABAP program, you must declare a type group as follows before you can use it:


This statement allows you to use all the data types and constants defined in the type group pool in your program. You can use multiple type groups in the same program.


From Release 6.40, you can also define data types and constants in the public visibility section of global classes, which makes type groups completely replaceable.

The type group HKTST is created as follows in the ABAP Dictionary:

TYPE-POOL hktst.

TYPES: BEGIN OF hktst_typ1,                col1(10) TYPE c,                col2 TYPE i,       END OF hktst_typ1.

TYPES hktst_typ2 TYPE p DECIMALS 2.

CONSTANTS hktst_eleven TYPE i VALUE 11.

This type group defines two data types HKTST_TYP1 and HKTST_TYP2, as well as a constant HKTST_ELEVEN with the value 11.

Any ABAP program can use this definition with the TYPE-POOLS statement:


DATA: dat1 TYPE hktst_typ1,      dat2 TYPE hktst_typ2 VALUE '1.23'.

WRITE: dat2, / hktst_eleven.

The output is:



The data types defined in the type group are used to declare data objects with the DATA statement and the value of the constant is, as the output shows, known in the program.