Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing Internal Data →  Meshes →  Meshes - Using Mesh Paths →  INSERT mesh_path 

Table Builds Using Mesh Paths

This example demonstrates how a table is built using a mesh path.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    DATA(out) = cl_demo_output=>new(
      )->begin_section( 'node1'
      )->write( mesh-node1 ).

    out->next_section(
      'Building node2 from node1\_node2' ).
    DO lines( mesh-node1 ) TIMES.
      INSERT VALUE line2( col2 = 20 + sy-index ) INTO TABLE
        mesh-node1\_node2[ mesh-node1[ sy-index ] ].
    ENDDO.
    out->write( mesh-node2 ).

    out->display( ).

Description

The empty mesh node mesh-node2 is built from the filled node mesh-node1 using the statement INSERT. To do this, all rows from mesh-node1 are used as the source of the initial mesh association _node2 of the mesh path in a DO loop and a row is inserted in mesh-node2 for each row from mesh-node1. The value of the column col1 is taken from mesh-node1 and a new value for the column col2 is created.