SAP MESH INSERT



Get Example source ABAP code based on a different SAP table
  


ID INSERT-ITAB
• INSERT mesh_path ABAP Statement
• TABLE INSERT mesh_path

INSERT mesh_path

ABAP_SYNTAX
INSERT line_spec INTO TABLE mesh_path result.

What does it do?
Inserts lines in the last path node of a mesh path mesh_path. As in inserts into a directly specified table using INTO TABLE, the position of the lines to be inserted is determined using the primary table key. The behavior for duplicate lines encountered with respect to unique table keys is also the same. When specifying the inserted lines using line_spec, the same applies when inserting lines into directly specified internal tables and they must be compatible with the line type of the last path node.
A set of lines with the line type of the last path node is instantiated internally from the specification in line_spec and the result of the mesh path. This set is inserted into the last path node in accordance with the rules of INSERT:
For each line in line_spec or for each line in a table to be inserted, the same number of lines is created as described by the result. If the mesh path contains only the initial mesh associations, one line is created. In the case of path extensions, multiple lines can be created.
In the new lines, the columns in the ON condition of the last mesh association of the mesh path are filled as follows:
If the mesh path contains only an initial mesh association, each of these columns is filled with the current comparison value from source.
If the mesh path contains path extensions, each of these columns is filled with the value described by the result of the preceding mesh association. The remaining components have the value of the lines specified in line_spec.
The following applies when specifying the mesh associations:
If the mesh path contains only an initial mesh association, the square brackets cannot contain an additional condition.
If the mesh path contains path extensions, all mesh associations can contain additional conditions using the additions USING KEY and WHERE log_exp. The square brackets [ ] for the mesh association of the last path extension must be empty.
The number of lines to be inserted is the number of lines specified in lin_spec multiplied by the number of lines described in result. If, due to an additional WHERE condition, the result set is empty, no lines are inserted.
result can be used to specify the output behavior when exactly one line is inserted, as in INSERT. Since more than one line can be inserted when path extensions are used, the addition result can only be specified in the following cases:
If the variant LINES OF is not used in line_spec.
The mesh path contains only the initial mesh association.
The return code sy-subrc is set in the same way as in the corresponding statement INSERT.



Latest notes:

When INITIAL LINE is used to specify an initial line in line_spec, only those components remain initial that are not specified in the ON condition.
The square brackets of the mesh association of the last path extension are empty, since it needs only to indicate the mesh node in which the lines are inserted.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLES_ABEXA
Insertions in Mesh Paths
Table Builds Using Mesh Paths
ABAP_EXAMPLE_END