ABAP Keyword Documentation → ABAP - Reference → Program structure → Introductory Statements for Programs
TYPE-POOL
Other versions: 7.31 | 7.40 | 7.54
Syntax
TYPE-POOL tpool.
Effect
The TYPE-POOL
statement introduces a
type group. It must be the first statement of a type group following the triggering of any
include programs. You can maintain type groups only in
ABAP Dictionary in
ABAP Workbench, whereby
an ABAP program is automatically generated including the TYPE-POOL
statement.
The actual name of the program of a type group in the repository does not completely match the name of the type group and is of internal relevance only.
Type groups can only contain the statements
-
INCLUDE
, -
INCLUDE TYPE|STRUCTURE
, -
TYPES
, -
CONSTANTS
, -
DEFINE
, andEND-OF-DEFINITION
, -
CLASS DEFINITION ... DEFERRED PUBLIC
and the declared data types, constants, and
macros must be prefixed with the name tpool
of the type group. The elements
declared in a type group can be addressed statically or dynamically by name in every ABAP program in which the type group can be used. This is loaded when an element of a type group is first accessed.
Notes
- Types in type groups are the predecessors for general type definitions in ABAP Dictionary.
- Since you can also define data types and constants in the public visibility section of global classes, type groups are obsolete and should no longer be created. Existing type groups can still be used.
-
To avoid conflicts in the type reference with the addition
LIKE
, you must ensure that constants in type groups do not have the same name as existing flat structures or database tables in ABAP Dictionary. - The name of a type group may contain a maximum of five characters.
-
Previously, type groups had to be made known in ABAP programs using the
TYPE-POOLS
statement before its elements could be accessed statically or dynamically. This restriction is now obsolete. TheTYPE-POOLS
statement is no longer necessary.
Example
Type groups with the definition of a table type.
TYPES mytgr_spfli_tab TYPE HASHED TABLE
OF spfli
WITH UNIQUE KEY carrid connid.