[go: up one dir, main page]

0% found this document useful (0 votes)
63 views2 pages

TYPES - BEGIN OF Struct - Type: Syntax

This document describes the syntax and use of structured types in ABAP. Structured types are defined using TYPES statements with BEGIN OF and END OF to delineate the structure. Components of the structured type can include other structures, creating nested structures. A structured type must have at least one component and components cannot reference the structure itself. The components are accessed using the structure name and component selector.

Uploaded by

ClasesXXX
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views2 pages

TYPES - BEGIN OF Struct - Type: Syntax

This document describes the syntax and use of structured types in ABAP. Structured types are defined using TYPES statements with BEGIN OF and END OF to delineate the structure. Components of the structured type can include other structures, creating nested structures. A structured type must have at least one component and components cannot reference the structure itself. The components are accessed using the structure name and component selector.

Uploaded by

ClasesXXX
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

TYPES - BEGIN OF struct_type

Quick Reference

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.

The following can be included between these TYPES statements:

• Any TYPES statements, in particular further closed structure definitions.

• The definition of static boxes using BOXED.

• The statements INCLUDE TYPE and INCLUDE STRUCTURE for including components from
other structures.

No structured types can be created that do not have at least one component.

The TYPES statements within the statements BEGIN OF and END OF define the components of the
structured type struc_type. If a component is a structured type or if a new structured type is defined
within a structure usingBEGIN OF and END OF, substructures are created. A structure with substructures
is known as a nested structure.

A component of struc_type cannot be declared with reference to struc_type itself . If the


name struc_type is specified after TYPE in the declaration of a component, a search is performed for
the next type with this name in a higher visibility section, and used if found. If a more global type with this
name does not exist, a syntax error occurs.

If a component is created as a table type, this type cannot be generic.

The statement INCLUDE defines components of the structured type struc_type by using the
components of a differently structured type or an existing structure at the same level.

The components of a structured type are divided using the name struc_type and the name of the
component, and addressed using the structure component selector (-).

Notes

• The value operator VALUE can be used to construct the content of structures.
• A structure type is always fully specified. There is no generic structure type.

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.

You might also like