ABAP Keyword Documentation → ABAP − Reference → Processing Internal Data → Meshes → Meshes - Mesh Paths → Meshes - mesh_path
Meshes - _assoc[ ... ]
Other versions:
7.31 | 7.40 | 7.54
Syntax Forms
... _assoc[+|][ ... ]
| _assoc~node[+|][ ... ]
| \^_assoc~node[+|*][ ... ] ...
Variants
1. ... _assoc
2. ... _assoc~node
3. ... \^_assoc~node
Extras
Effect
Specifies a mesh association in a mesh path. If specified,
a mesh association is introduced using a backslash character, \
, and is always
directly to the right of a starting node of the mesh path. A mesh association leads from its starting
node to a follow-on node in the same mesh. A mesh association is either an initial mesh association _associ[ ... ]
, for which the starting node of the
root node specified explicitly is at the start of a mesh path, or a path extension _assoc1[ ...
], _assoc2[ ... ]
, ..., for which the starting node is the follow-on node of a preceding mesh association.
The syntax variants defined whether the association is a forward association or an inverse mesh association. The addition in square brackets [
] defines the table row of the starting node from which the mesh association originates at runtime. The optional additions +
or *
can be used to make reflexive mesh associations
(self associations) transitive.
Note
In the definition of a mesh association, its nodes are known as source nodes and target nodes. In evaluations of mesh associations, however, they are known as starting nodes and follow-on nodes. In a forward association, the starting node is always a source node and the follow-on node is always a target node. In inverse mesh associations, the reverse applies.
Variant 1
... _assoc
Variant 2
... _assoc~node
Effect
Specifies a forward association In a forward association, the starting node is a source node and the
follow-on node is a target node of a mesh association
_assoc of the mesh. Both variants have the same semantics. _assoc
is used to specify the name of a mesh association defined for the starting node in the
mesh type. The follow-on node is the target node of this
mesh association and can be specified as node
after ~
in alternative 2.
Note
The follow-on node node
can be specified explicitly for logging purposes
(on the consumer side). If the recommended naming convention with the prefix to_
in front of the name of the target node is used for
mesh associations, however, it is redundant.
Variant 3
... \^_assoc~node
Effect
Specifies an inverse mesh association. In an inverse mesh association, the starting node is a target
node and the follow-on node is a source node of an association
_assoc
of the mesh. _assoc
is used to specify the name of a mesh association that has the starting node as a target node in the
mesh type. The source node of the mesh association in
question must be specified explicitly as the follow-on node using node
after ~
.
Notes
- The follow-on node
node
must be specified since the starting node can be the target node of various mesh associations of a mesh type with the same name.
- An inverse mesh association can also be specified for a reflexive mesh association (self association) with the same source node and target node.
Example
Forward associations and an inverse mesh association as initial mesh associations of mesh paths.
BEGIN OF MESH mesh,
node1 TYPE REF TO itab1 ASSOCIATION _node2 TO node2 ON ...
node2 TYPE REF TO itab2,
END OF MESH mesh.
DATA(mesh) = VALUE mesh( ... ).
"Forward associations
... mesh-node1\_node2[ ... ] ...
... mesh-node1\_node2~node2[ ... ] ...
"Inverse association
... mesh-node2\^_node2~node1[ ... ] ...
Addition 1
... [ ... ]
Effect
The square brackets are part of the syntax. The square brackets define the table row of the starting node from which the mesh association originates at runtime. This information is determined by whether the association is an initial mesh association or a path extension and where the mesh path is used:
[ source [cond] ]
source
as a source in an initial mesh association \_associ[ ... ]
.
[ [cond] ]
\_assoc2[ ... ]
. The source is the result of the preceding mesh association.
Depending on where the association is used, further conditions
cond
can be specified. If no further conditions are specified, the square
brackets of an initial mesh association contain only source
and the square brackets of a path extension are empty.
Executable Example
Addition 2
... +|*
Effect
An optional +
or *
can be specified after the
name of the mesh association to make it transitive. To be used transitively, the mesh association
_assoc
must be reflexive and have the same source node and target node
(self association).
If the last mesh association in the mesh path is used transitively, it can only be used for single rows
with LOOP
and
FOR
or DELETE
and MODIFY
If an mesh association is used transitively, it is evaluated more than once when the mesh path is used. First, the regular result of the mesh association is determined. Starting with this result, the mesh association is evaluated recursively until no new rows are found in the follow-on node. Here, the result of each evaluation is the starting point of the next recursion. The results set of the transitive mesh association is the union set of the individual recursions
The variants +
and *
differ as follows:
- If
+
is specified, the results set is only determined by the results of the mesh associations.
- If
*
is specified, the source of the mesh association is included in the results set. If the mesh association is the initial association, the row is determined from the specified sourcesource
using the primary table key and it cannot be empty. If no rows are found, the results set is empty.
Each row of the follow-on node occurs only once in the results set, even if it was found more than once when the mesh path was evaluated.
Notes
- Transitive mesh associations are useful for evaluating hierarchical structures within a mesh node.
- For a results set created with
+
, a row of an initial mesh association described usingsource
does not need to exist in the internal table to ensure that this set is not empty. If*
is used, however, this row must exist.
Executable Example
Reflexive Mesh Associations in Mesh Paths