Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing Internal Data →  Meshes →  Meshes - Mesh Paths →  Meshes - Mesh Path Result →  Meshes - Example of Results of Mesh Paths 

Inverse Associations in Mesh Paths

This example demonstrates the results of inverse associations in mesh paths.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    DATA(idx) = 1.
    cl_demo_input=>request( CHANGING field = idx ).

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

    IF line_exists( mesh-node3[ idx ] ).

      out->next_section( 'node3\^to_node3~node2'
        )->write( VALUE t_itab2(
           FOR <node2> IN
             mesh-node3\^to_node3~node2[ mesh-node3[ idx ] ]
             ( <node2> ) ) ).

      out->next_section( 'node3\^to_node3~node2\^to_node2~node1'
        )->write( VALUE t_itab1(
           FOR <node1> IN
             mesh-node3\^to_node3~node2[ mesh-node3[ idx ]
                                      ]\^to_node2~node1[ ]
             ( <node1> ) ) ).
    ELSE.
      out->write( `Enter a valid index for node3 ...` ).
    ENDIF.

    out->display( ).

Description

Table comprehensions are used to construct and return internal tables that are described using inverse associations in the mesh nodesmesh-node2 and mesh-node1.