ABAP Keyword Documentation → ABAP − Reference → Declarations → Declaration Statements → Data Types and Data Objects → Declaring Data Types → TYPES
TYPES - BEGIN OF MESH mesh_type
Other versions:
7.31 | 7.40 | 7.54
Syntax
TYPES BEGIN OF MESH mesh_type.
...
TYPES node { TYPE {[REF TO] table_type}|ref_type }
| { LIKE {[REF TO] itab
}|dref }
[
association1],
[association2],
...
...
TYPES END OF MESH mesh_type.
Effect
Defines a mesh type for a mesh. A mesh type is a special structure type. The components of the structure type are referred to as mesh nodes and are subject to the following restrictions:
-
The type of a mesh node must be a non-generic table type or a
reference type with the static type of a non-generic internal table. The node type can be defined as follows:
- Using the addition
TYPE
while specifying a table typetable_type
with or withoutREF TO
or while specifying a reference typeref_type
of this kind directly.
- Using the addition
LIKE
while specifying an internal tableitab
with or withoutREF TO
or while specifying a reference variabledref
of this kind directly.
-
The row type of a mesh node must be structured and cannot contain any internal tables or reference variables. Elementary data types and
substructures are permitted as components. Substructures must meet the same prerequisite.
A regular structure type can be enhanced by defining one or more
mesh associations
association
for
every mesh node. These associations join two mesh nodes using a condition. The relationships between the tabular nodes of a mesh type defined using mesh associations are evaluated in the special
expressions and statements used to process
meshes in mesh paths.
Notes
-
Meshes must be fully compatible for assignments, comparisons,
and parameter passing. Meshes are compatible when their structures are compatible, the node names match,
and the mesh associations match with respect to name,
ON
conditions, and the table key used. -
Using the structure component selector (
-
), mesh nodes can be addressed and used like the components of the corresponding structure. If field symbols or reference variables point to mesh nodes, they are also handled like regular structure components. In particular, the statementMOVE-CORRESPONDING
can also be used between incompatible meshes and between meshes and structures. - A mesh type is always fully defined. Generic mesh types are not possible.
- It is a particularly good idea to use reference types as components when meshes are injected into existing programs with suitable internal tables.
-
The statements for defining a mesh type are usually summarized in a chained statement.
Example
Declares a mesh type with internal tables for the flight data model.
TYPES:
t_scarr TYPE HASHED TABLE OF scarr
WITH UNIQUE KEY carrid,
t_spfli TYPE HASHED TABLE OF spfli
WITH UNIQUE KEY carrid connid,
t_sflight TYPE HASHED TABLE OF sflight
WITH UNIQUE KEY carrid connid fldate,
t_sairport TYPE HASHED TABLE OF sairport
WITH UNIQUE KEY id,
BEGIN OF MESH t_flights,
scarr TYPE t_scarr
ASSOCIATION _spfli TO spfli
ON carrid = carrid,
spfli TYPE t_spfli
ASSOCIATION _sflight TO sflight
ON carrid = carrid AND
connid = connid
ASSOCIATION _sairport TO sairport
ON id = airpfrom,
sflight TYPE t_sflight,
sairport TYPE t_sairport,
END OF MESH t_flights.