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 

Forward Associations in Mesh Paths

This example demonstrates the results of forward 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-node1[ idx ] ).
      out->next_section( 'node1\_node2'
        )->write( VALUE t_itab2(
           FOR <node2> IN
             mesh-node1\_node2[ mesh-node1[ idx ] ]
             ( <node2> ) ) ).

      out->next_section( 'node1\_node2\_node3'
        )->write( VALUE t_itab3(
           FOR <node3> IN
             mesh-node1\_node2[ mesh-node1[ idx ] ]\_node3[ ]
             ( <node3> ) ) ).
    ELSE.
      out->write( `Enter a valid index for node1 ...` ).
    ENDIF.

    out->display( ).

Description

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