Skip to content

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

Deleting Single Rows in Mesh Paths

This example demonstrates how single rows are deleted 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( 'Delete One Line Using ON' ).
    DELETE TABLE mesh-node1\_node2[ mesh-node1[ 1 ] ].
    out->write( mesh-node2 ).

    out->next_section( 'Delete One Line Using ON and WITH KEY' ).
    DELETE TABLE mesh-node1\_node2[ mesh-node1[ 2 ] ]
      WITH TABLE KEY mkey COMPONENTS col3 = 23.
    out->write( mesh-node2 ).

    out->next_section( 'Delete One Line Using ON and FROM wa' ).
    DELETE TABLE mesh-node1\_node2[ mesh-node1[ 3 ] ]
      FROM VALUE line2( col3 = 33  ) USING KEY mkey.
    out->write( mesh-node2 ).

    out->display( ).

Description

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

  • Statement DELETE TABLE for deleting a row using the ON condition.
DELETE TABLE mesh-node1\_node2[ mesh-node1[ 1 ] ].
The row of node mesh-node2, identified starting with the first row of node mesh-node1 using the initial mesh association \_node2, is deleted. The ON condition covers the primary key used here, which means that no additional key fields need to be specified.
  • Statement DELETE TABLE for deleting a row using the ON condition and with an explicitly specified key field.
DELETE TABLE mesh-node1\_node2[ mesh-node1[ 2 ] ]
  WITH TABLE KEY mkey COMPONENTS col3 = 23.
The row of node mesh-node2, identified starting with the second row of node mesh-node1 using the initial mesh association \_node2, is deleted. The ON condition does not cover the secondary key mkey, which means that the missing key field must be specified using the addition WITH TABLE KEY.
  • Statement DELETE TABLE for deleting a row using the ON condition and with a key field from the work area.
DELETE TABLE mesh-node1\_node2[ mesh-node1[ 3 ] ]
  FROM VALUE line2( col3 = 33  ) USING KEY mkey.
The row of node mesh-node2, identified starting with the third row of node mesh-node1 using the initial mesh association \_node2, is deleted. The ON condition does not cover the secondary key mkey, which means that the missing key field must be specified using the addition FROM wa.