Syntax
TYPES BEGIN OF struc_type.
…
TYPES comp …
TYPES comp TYPE struc_type BOXED.
INCLUDE TYPE|STRUCTURE …
…
TYPES END OF struc_type.
Effect
Defines a structured type struc_type. This is introduced using a TYPES statement with the addition BEGIN OF and must finish with a TYPES statement with the addition END OF.
Example
This example defines two structured types, street_type and address_type. address_type contains structured types as components. The definition of zipcode_type shows the access to substructures.
TYPES: BEGIN OF street_type,
name TYPE c LENGTH 40,
no TYPE c LENGTH 4,
END OF street_type.
TYPES: BEGIN OF address_type,
name TYPE c LENGTH 30,
street TYPE street_type,
BEGIN OF city,
zipcode TYPE n LENGTH 5,
name TYPE c LENGTH 40,
END OF city,
END OF address_type.
TYPES zipcode_type TYPE address_type-city-zipcode.
types实际上是用来定义结构。