Skip to content

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

Changing Single Rows in Mesh Paths

This example demonstrates how single rows are changed in mesh paths.

Other versions: 7.31 | 7.40 | 7.54

Source Code

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

    out->next_section( 'Modify One Line Using ON' ).
    MODIFY TABLE mesh-node1\_node2_1[ mesh-node1[ 1 ] ]
      FROM VALUE line2( col2 = 111 col3 = 222 )
                 TRANSPORTING col2 col3.
    out->write( mesh-node2 ).

    out->next_section( 'Modify One Line Using ON and FROM wa' ).
    MODIFY TABLE mesh-node1\_node2_2[ mesh-node1[ 2 ] ]
      FROM VALUE line2( col2 = 22 col3 = 333 )
                 USING KEY mkey TRANSPORTING col3.
    out->write( mesh-node2 ).

    out->display( ).

Description

Starting from the filled mesh nodes mesh-node1 and mesh-node2, single rows from mesh-node2 are changed:

  • Statement MODIFY TABLE for changing a row using the ON condition.
MODIFY TABLE mesh-node1\_node2_1[ mesh-node1[ 1 ] ]
  FROM VALUE line2( col2 = 111 col3 = 222 )
       TRANSPORTING col2 col3.
The ON condition of the mesh association _node2_1 covers the primary table key of the node node2 and is used to identify the row that needs to be modified.
  • Statement MODIFY TABLE for changing a row using the ON condition and with a key field from the work area.
MODIFY TABLE mesh-node1\_node2_2[ mesh-node1[ 2 ] ]
  FROM VALUE line2( col2 = 22 col3 = 333 )
       USING KEY mkey TRANSPORTING col3.
The ON condition of the mesh association _node2_2 does not cover the table key mkey and the missing information is taken from column col2 of the work area after FROM.