TYPES BEGIN OF struc_type.
...
{TYPES dtype ...} | {INCLUDE {TYPE|STRUCTURE} ...}.
...
TYPES END OF struc_type.
A structured type struc_type is started by a TYPES statement with the addition BEGIN OF and must be ended with a TYPES statement with the addition END OF.
Between these two TYPES statements, there can be any number of TYPES statements, in particular additional closed structure definitions, and the statements INCLUDE TYPE and INCLUDE STRUCTURE. A structured type cannot be created without at least one component.
The TYPES statements within the statements with BEGIN OF and END OF define components of the structured type struc_type. If a component is a structured type or a new structured type is defined within a structure using BEGIN OF and END OF, this results in substructures. A structure with substructures is known as a nested structure.
The statement INCLUDE defines components of the structured type struc_type by copying the components of another structured type or an existing structure on the same level.
The components of a structured type are addressed using the name struc_type and the name of the component, separated by the structure component selector
(-).
In this example, two structured types street_type and address_type are defined. address_type contains structured types as components. The definition of zipcode_type shows 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.