Documentation View

We are hiring and constantly growing! Have a look through our vacancies to find the right role for you!

ABAPTYPES_MESH_ASSOCIATION - TYPES MESH ASSOCIATION

ABAPTYPES_MESH_ASSOCIATION - TYPES MESH ASSOCIATION

ROGBILLS - Synchronize billing plans   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.
SAP E-Book

TYPES, association

Short Reference



... ASSOCIATION _assoc TO node ON tcomp1 = scomp1
                             $[AND tcomp2 = scomp2
                             $[AND ... $]$]
                             $[USING KEY key_name$] ...


Additions

1. ... ON tcomp1 = scomp1 $[AND tcomp2 = scomp2 $[AND ... $]$]

2. ... USING KEY key_name

Effect

Definition of a mesh association named _assoc for a mesh node of a mesh type. The addition ASSOCIATION to TYPES can only be used in the definition of a node of a mesh type between TYPES BEGIN OF MESH and TYPES END OF MESH. The mesh node for which a mesh association is defined is its start node and the mesh node node specified after TO is the target node. Any node in the current mesh can be specified as the target node node, including the start node itself. A mesh association with the same start and target node is a self-association or reflexive association.

The name of a mesh association can be up to 30 characters long and can only consist of the letters A-Z, the digits 0-9, and the underscore "_" character, and cannot start with a digit.

Notes

  • A target node does not have to be defined before the start node to be visible to it. However, the Code Completion function of the editor only works properly if this is the case.
  • The prefix _ is recommended as the naming convention for mesh associations. The name that follows this prefix should contain the target node name in non-reflexive mesh associations. This convention makes it easier to read the mesh path.

Addition 1

... ON tcomp1 = scomp1 $[AND tcomp2 = scomp2 $[AND ... $]$]

Effect

For each mesh association, a condition must be specified after ON that consists of at least one comparison for equality. Further comparisons for equality can be added using AND. The left operand tcomp of each comparison must be a directly specified column of the target node and the right operand scomp must be a directly specified column of the start node that must be compatible with the column of the target node.

A mesh association creates a relationship between the start node and target node where all the rows of the target node that meet the condition are assigned to a line of the start node.

The mesh associations are type-only attributes and also affect the compatibility of mesh types. Mesh associations are evaluated in mesh paths in expressions and in statements for meshes.

Notes

  • In the ON condition, the target node components are on the left and the start node components are on the right, like in other statements and expressions for internal tables, where the columns of the table to be searched are always listed on the left.
  • As a rule of thumb, the target node components that are listed on the left in an ON condition should be key fields of the table key used for the condition, in order to achieve the most efficient access.

Addition 2

... USING KEY key_name

Effect

The addition USING KEY can be used for the ON condition of a mesh association to specify a table key of the target node that is used in expressions and statements to evaluate meshes for accessing the mesh node:

  • The primary key using its predefined name primary_key or an alias. If the primary key is specified, the target node must be a sorted table or a hashed table.

The name of the table key must be specified directly, that is, it cannot be specified dynamically in a data object. If the table key is specified explicitly, the ON condition must be defined to allow optimal key access.

  • If a sorted key or the primary key of a sorted table is specified, the conditions specified after ON must cover a left initial part of the key fields in the target table.
  • If a secondary hash key or a primary key of a hashed table is specified, the conditions specified after ON must cover all key fields in the target table.

Without the addition USING KEY, the primary key is used to access the mesh node and that access is not always optimized.

Note

The table key specified in the definition of the ON condition can be overridden when the mesh association is used in a mesh path by specifying USING KEY in an additional condition. In this case, the ON condition and the additional condition are combined into a condition that must meet the above prerequisites.

Example

Declaration of a mesh type. Some of the keys of the internal tables used are secondary keys that are used with USING in the definitions of the mesh associations.






SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up   General Data in Customer Master  
This documentation is copyright by SAP AG.

Length: 7372 Date: 20230207 Time: 232102     sap01-206 ( 110 ms )