abap中结构体嵌套结构体。

1: 结构体中嵌套结构体。

*&---------------------------------------------------------------------*
*& Report ZHANSEN32
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZHANSEN32.
TYPES: lv_spfli_type TYPE SPFLI,
  lv_surname() TYPE c,
  BEGIN OF lv_address,
    lv_name TYPE lv_surname,
    lv_street() TYPE c,
    lv_city TYPE lv_spfli_type-cityfrom,
  END OF lv_address.
DATA lv_my_add TYPE lv_address.

TYPES: BEGIN OF address2,
  lv_name2() TYPE c,            "c的长度默认为1, 当赋值长度大于1时,应该给其指定给定的长度。
  include TYPE lv_address ,       "结构体中嵌套其它结构体类型。
END OF address2.

data lv_myaddress TYPE address2.

lv_myaddress-include-lv_name = 'name'.
lv_myaddress-lv_name2 = 'name2'.

WRITE: / lv_myaddress-include-lv_name,lv_myaddress-lv_name2.
上一篇:Java集合常见面试题集锦


下一篇:go变量、类的概念以及类的使用方式,嵌套结构体