TYPES - BEGIN OF struct_type (结构申明)

本文详细介绍了ABAP中使用TYPES语句定义结构类型的方法,包括结构的开始与结束语法、结构内组件的定义,以及如何通过子结构访问特定字段。通过实例展示了街道类型和地址类型的创建过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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实际上是用来定义结构。

源文档

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值