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实际上是用来定义结构。
本文详细介绍了ABAP中使用TYPES语句定义结构类型的方法,包括结构的开始与结束语法、结构内组件的定义,以及如何通过子结构访问特定字段。通过实例展示了街道类型和地址类型的创建过程。
&spm=1001.2101.3001.5002&articleId=108019041&d=1&t=3&u=0e001834f0a041048f20f38eacb96ea1)
1760

被折叠的 条评论
为什么被折叠?



