Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Declarations →  Declaration Statements →  Data Types and Data Objects →  Declaring Data Types →  TYPES 

TYPES - BEGIN OF MESH mesh_type

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


TYPES BEGIN OF MESH mesh_type. 
  ...
  TYPES node { TYPE {[REF TO] table_type}|ref_type }
           | { LIKE {[REF TO] itab      }|dref     }
                [association1],
                [association2],
                ...

  ...
TYPES END OF MESH mesh_type.

Effect

Defines a mesh type for a mesh. A mesh type is a special structure type. The components of the structure type are referred to as mesh nodes and are subject to the following restrictions:

  • The type of a mesh node must be a non-generic table type or a reference type with the static type of a non-generic internal table. The node type can be defined as follows:
  • With the addition TYPE while specifying a table type table_type with or without REF TO or while specifying a reference type ref_type of this kind directly.
  • With the addition LIKE while specifying an internal table itab with or without REF TO or while specifying a reference variable dref of this kind directly.
  • The row type of a mesh node must be structured and cannot contain any internal tables or reference variables. Elementary data types and substructures are permitted as components. Substructures must fulfill the same prerequisite.

A normal structure type can be enhanced by defining one or more associations association for every mesh node. These associations link two mesh nodes using a condition. The relationships between the tabular nodes of a mesh type defined using associations are evaluated in the special expressions and statements used to process meshes in mesh paths.


Notes

  • Meshes must be fully compatible for assignments, comparisons, and pass-by parameter. Meshes are compatible when their structures are compatible, the node names match, and the associations match with respect to name ON conditions and the table key used.
  • Using the structure component selector (-), mesh nodes can be addressed and used like the components of the corresponding structure If field symbols or reference variables point to mesh nodes, they are also handled like regular structure components. In particular, the statement MOVE-CORRESPONDING can also be used between incompatible meshes and between meshes and structures.
  • A mesh type is always fully defined. Generic mesh types are not possible.
  • It is a particularly good idea to use reference types as components when meshes are injected into existing programs with suitable internal tables.

Example

Declares a mesh type with internal tables for the flight data model.

TYPES:
  BEGIN OF MESH t_flights,
    scarr TYPE t_scarr
      ASSOCIATION to_spfli TO spfli
               ON carrid = carrid USING KEY carrid,
    spfli TYPE t_spfli
      ASSOCIATION to_sflight TO sflight
               ON carrid = carrid AND
                  connid = connid USING KEY carrid_connid
      ASSOCIATION to_sairport TO sairport
               ON id = airpfrom,
    sflight TYPE t_sflight,
    sairport TYPE t_sairport,
  END OF MESH t_flights.

Continue

TYPES - association