SAP MESH PATH ASSOC



Get Example source ABAP code based on a different SAP table
  


• /bs ABAP_MESH_PATH
• [ ] ABAP_MESH_PATH
• ^ ABAP_MESH_PATH
• ~ ABAP_MESH_PATH
• + ABAP_MESH_PATH
• * ABAP_MESH_PATH

ABAP_MESH - _assoc[ ... ]

ABAP_SYNTAX
... _assoc$[+$|*$][ ... ]
$| _assoc~node$[+$|*$][ ... ]
$| ^_assoc~node$[+$|*$][ ... ] ...

ABAP_VARIANTS:
1 ... _assoc
2 ... _assoc~node
3 ... ^_assoc~node

ABAP Addition
1 ... [ ... ]
2 ... +$|*

What does it do?
Specifies a mesh association in a mesh path. A mesh association specification is introduced using a backslash character, , and is always located directly to the right of an entry node of the mesh path. A mesh association leads from its entry node to a follow-on node in the same mesh. A mesh association is either an initial mesh association _associ[ ... ] , for which the entry node of the root node specified explicitly is at the start of a mesh path, or a path extension _assoc1[ ... ], _assoc2[ ... ], ..., for which the entry node is the follow-on node of a preceding mesh association.
The syntax variants define whether the association is a forward association or an inverse mesh association. The addition in square brackets [ ] determines the table line of the entry node from which the mesh association originates at runtime. The optional additions + or * can be used to make reflexive mesh associations ( self-associations) transitive.



Latest notes:

In the definition of a mesh association, its nodes are known as start nodes and target nodes. In evaluations of mesh associations, however, they are known as entry nodes and follow-on nodes. In a forward association, the entry node is always a start node and the follow-on node is always a target node. In inverse mesh associations, the reverse applies.
NON_V5_HINTS
ABAP_HINT_END

ABAP_VARIANT_1 ... _assoc

ABAP_VARIANT_2 ... _assoc~node

What does it do?
Specifies a forward association. In a forward association, the entry node is a start 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 entry 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.



Latest notes:

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.
NON_V5_HINTS
ABAP_HINT_END

ABAP_VARIANT_3 ... ^_assoc~node

What does it do?
Specifies an inverse mesh association. In an inverse mesh association, the entry node is a target node and the follow-on node is a start node of an association _assoc of the mesh. _assoc is used to specify the name of a mesh association that has the entry node as a target node in the mesh type. The start node of the required mesh association must be specified explicitly as the follow-on node using node after ~.



Latest notes:

The follow-on node node must be specified since the entry node can be the target node of different mesh associations of an identically named mesh type.
An inverse mesh association can also be specified for a reflexive mesh association (self association) with the same start node and target node.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
Forward associations and an inverse mesh association as initial mesh associations of mesh paths. TYPES:
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[ ... ] ...
ABAP_EXAMPLE_END

ABAP Addition

What does it do?
The square brackets are part of the syntax. The square brackets define the table line of the entry node from which the mesh association originates at runtime. This specification in square brackets depends on whether the association is an initial mesh association or a path extension and where the mesh path is used:
[ source $[cond$] ] Specifies a structure source as a source in an initial mesh association _associ[ ... ].
[ $[cond$] ] Implicitly specifies the source in a path extension _assoc1[ ... ], _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.

ABAP_EXAMPLE_ABEXA
Mesh Path Expressions
ABAP_EXAMPLE_END

ABAP Addition

What does it do?
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 start 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 lines 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 lines are found in the follow-on node. Here, the result of each evaluation is the starting point of the next recursion. The result set of the transitive mesh association is the union set of the individual recursions
The variants + and * differ as follows:
If + is specified, the result set is only determined by the results of the mesh associations.
If * is specified, the source of the mesh association is included in the result set. If the association is the initial mesh association, the line is determined from the specified source source using the primary table key and it cannot be empty. If no line is found, the result set is empty.
Each line of the follow-on node occurs only once in the result set, even if it was found more than once when the mesh path was evaluated.



Latest notes:

Transitive mesh associations are useful for evaluating hierarchical structures within a mesh node.
For a result set created with +, a line of an initial mesh association described using source does not need to exist in the internal table to ensure that this set is not empty. If * is used, however, this line must exist.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_ABEXA
Reflexive Mesh Associations in Mesh Paths
ABAP_EXAMPLE_END