SAP TYPES STRUC ABAP Statements

Get Example source ABAP code based on a different SAP table
  



TYPES - BEGIN OF

Short Reference
• BEGIN OF TYPES
• END OF TYPES

ABAP_BASIC_FORM_4 TYPES BEGIN OF struc_type.
...
TYPES comp ...
TYPES comp TYPE struc_type BOXED.
ABAP Code Snippet
...
TYPES END OF struc_type.

What does it do? Definition of 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.
ABAP Code Snippet ABAP Code Snippet 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 using BEGIN 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, the next type of this name is searched for in a higher visibility area, and used if found. If a more global type of this name does not exist, a syntax error occurs.

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

ABAP Code Snippet 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 (-).



Latest notes:The value operator
VALUE can be used to construct the content of structures.



Example ABAP Coding
This example defines two structured types,
street_type and address_type. address_typecontains 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.

Return to menu