Type Groups 

Dictionary

ABAP Dictionarys

Typen

You use type groups to store user-defined data types or constants in the ABAP Dictionary for cross-program use.

In your ABAP program, you declare type groups with the TYPE-POOLS statement as follows:

Syntax

TYPE-POOLS <name>.

This statement allows you to use all the data types and constants defined in the type group <name> in your program. You can use several type groups in the same program.

You maintain type groups either by choosing Tools ® ABAP Workbench ® Development ® ABAP Dictionary or directly from your ABAP program.

In the first case, you specify a one- to five-character name for the type group in the field Object name on the ABAP Dictionary: Initial Screen and then choose Type groups followed by Display, Change, or Create:

In the second case, you double-click on the name <name> of the type group after the TYPE-POOLS statement in your ABAP program. If no type group of this name exists, you can create it. Otherwise, the system displays the definition of the existing type group and you can change it.

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

Syntax

TYPE-POOL <name>.

After this come the definitions of the data types and constants using the TYPES and CONSTANTS statements. All the names of these data types and constants must begin with the name of the type group and an underscore: <name>_.

Let the type group HKTST be created as follows in the ABAP Dictionary:

TYPE-POOL HKTST.

TYPES: BEGIN OF HKTST_TYP1,
COL1(10),
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, as shown in the following program:

PROGRAM SAPMZTST.

TYPE-POOLS HKTST.

DATA: DAT1 TYPE HKTST_TYP1,
DAT2 TYPE HKTST_TYP2 VALUE '1.23'.

WRITE: DAT2, / HKTST_ELEVEN.

The output is:

1,23

11

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.