ABAP Keyword Documentation → ABAP - Reference → Processing Internal Data → Meshes → Meshes - Mesh Paths
Meshes - mesh_path
Other versions:
7.31 | 7.40 | 7.54
Syntax
... {mesh-|<mesh>-|mesh_ref->}rnode
\associ[ ... ]
\assoc1[ ... ]\assoc2[ ... ] ...
Extras
1. ... {mesh-|<mesh>-|mesh_ref->}rnode
2. ... \associ[ source [cond] ]
3. ... \assoc1[ [cond] ]\assoc2[ [cond] ] ...
Effect
Specifies a mesh path in statements and expressions used to process meshes. A mesh path is always constructed as follows:
- A root node
rnode
- An initial association
\associ
between a root node to a follow-on node
- Optional further associations
\assoc1
,\assoc2
, ... whose source nodes can be the follow-on nodes of preceding associations.
When a mesh path is specified, it is not significant whether the address nodes of the mesh are internal tables or references to internal tables. When a mesh path is evaluated, references to internal tables are dereferenced automatically. A mesh path describes a set of rows in its final path node as its result.
Note
A mesh path cannot exit a mesh. Each follow-on node is part of the same mesh as the root node. Meshes can, however, be nested by specified a mesh path expression as the source of the initial association.
Addition 1
... {mesh-|<mesh>-|mesh_ref->}rnode
Effect
Root node rnode
of a mesh path. rnode
is a nodes of a
mesh type that must be the start or target node of an
association of the mesh type. The same options are available when specifying the mesh as when addressing regular structure components:
mesh-rnode
mesh
is a mesh, that is a data object of the
mesh type in question. The root node is addressed using the structure component selector (-
).
<mesh>-rnode
<mesh>
is a field symbol typed with the mesh type and to which a mesh is assigned. The root node is addressed using the structure component selector (-
).
mesh_ref->rnode
mesh_ref
is a reference variable whose static type is the mesh type and which points to a mesh. The root node is addressed using the object component selector (->
).
Example
Defines a mesh type mesh
with internal tables and a mesh type refmesh
with references to internal tables as components. A data object mesh
has
the type mesh
and a data object meshref
points
to a data object of type refmesh
. The root node of the first mesh path is
mesh-node1
. The structure component selector is used here. The root node
of the second mesh path is node1
in the anonymous data object of type
refmesh. The object component selector is used here. The references within the mesh are dereferenced implicitly.
BEGIN OF MESH mesh,
node1 TYPE itab1 ASSOCIATION to_node2 TO node2 ON ...
node2 TYPE itab2,
END OF MESH mesh,
BEGIN OF MESH refmesh,
node1 TYPE REF TO itab1 ASSOCIATION to_node2 TO node2 ON ...
node2 TYPE REF TO itab2,
END OF MESH refmesh.
DATA(mesh) = VALUE mesh( ).
DATA(meshref) = NEW refmesh( VALUE refmesh( ) ).
... mesh-node1\to_node2[ ... ] ...
... meshref->node1\to_node2[ ... ] ...
Addition 2
... \associ[ source [cond] ]
Effect
Initial association of a mesh path. Each mesh path has an initial association specified after its root node. All associations \assoc[ ...
] can be specified for \associ[ ... ]
that match the root node, namely:
- Forward associations with an association of the mesh type that has the root node as the start node.
- Inverse associations with an association of the mesh type that has the root node as the target node.
The syntax used to specify the row of the source node in the square brackets of the association \assoc[ ... ]
is
[ source [cond] ]
A structure source
of the row type of the root node must be specified as the source of the association. This is a
general expression
position. When the mesh path is evaluated, the content of source
is used
as the starting point of the association. Here, the ON
condition is used to produce a description of a set of rows of the follow-on node as a
result from the
association and any additional conditions cond
.
Note
A structure specified as source
does not need to occur as a row in the root node. It is a good idea to use a
table expression that read a row from the root node. A
mesh path expression can, however, also be specified to nest meshes.
Example
Forward associations and an inverse association as initial associations of mesh paths. Table expressions that read a row from the root node are used as sources of the associations.
BEGIN OF MESH mesh,
node1 TYPE itab1 ASSOCIATION to_node2 TO node2 ON ...
node2 TYPE itab2,
END OF MESH mesh.
DATA(mesh) = VALUE mesh( ... ).
... mesh-node1\to_node2[ mesh-node1[ ... ] ] .
... mesh-node1\to_node2~node2[ mesh-node1[ ... ] ] .
... mesh-node2\^to_node2~node1[ mesh-node2[ ... ] ].
Addition 3
... \assoc1[ [cond] ]\assoc2[ [cond] ] ...
Effect
Path extension of a mesh path. Any number of further associations can be chained after the initial association.
All associations \assoc
can be specified for \assoc1
, \assoc2
, ... that match the source node in question, namely:
- Forward associations with an association of the mesh type that has the source node as the start node.
- Inverse associations with an association of the mesh type that has the source node as the target node.
The syntax used to specify the row of the source node in the square brackets of the association \assoc[ ... ]
is
[ [cond] ]
When the mesh path is evaluated, the result of the preceding association (the description of a set of
rows in the source node) is used as the starting point of the association. Here, the
ON
condition of the association in question and any additional conditions
cond
are used to produce a description of a set of rows of the follow-on node as a
result. If no further conditions are specified, the square brackets are empty.
Example
Path extension of the initial association. The follow-on node of the initial association is node2
and this node is the source node of the path extension. The result of the full mesh path is a description
of row in node3
. The result of the initial association, whose starting point is defined by a table expression, is the implicit source of the path extension.
BEGIN OF MESH mesh,
node1 TYPE itab1 ASSOCIATION to_node2 TO node2 ON ...
node2 TYPE itab2 ASSOCIATION to_node3 TO node3 ON ...
node3 TYPE itab3,
END OF MESH mesh.
DATA(mesh) = VALUE mesh( ).
... mesh-node1\to_node2[ mesh-node1[ ... ] ]\to_node3[ ] ...