首先包含的结构化类型
Structured TYPES with Include first
当我们想在 ABAP TYPES
语句中包含一个类型时,我们可以使用以下表示法:
TYPES: BEGIN OF lty_combined_type,
date_el TYPE zda_data_element.
INCLUDE TYPE zst_structure.
TYPES: END OF gty_wd_personnel.
这方面的一个限制似乎是我们不能将类型作为我们类型的第一组字段。使用最少的编码(即没有自定义字段目录)生成 ALV 时,字段顺序可能非常相关。
是否有替代符号来包含另一种类型作为第一个字段集?
问题中的代码(在 SCN 上找到)实际上是 header [=16= 下 TYPES
文档中列出的语法的缩写形式]:
TYPES BEGIN OF struc_type.
...
TYPES comp ... .
TYPES comp TYPE struc_type BOXED.
INCLUDE {TYPE|STRUCTURE} ... .
...
TYPES END OF struc_type.
因此,上面问题中的例子就是:
TYPES BEGIN OF lty_combined_type.
INCLUDE TYPE zst_structure.
TYPES date_el TYPE zda_data_element.
TYPES END OF lty_combined_type.
注意分组符号TYPES: name1 TYPE typ1, name2 TYPE type2.
也可以使用,例如:
TYPES BEGIN OF gty_displaydata_order.
INCLUDE TYPE gty_displaydata.
TYPES: order TYPE aufnr,
order_type TYPE aufart.
TYPES END OF gty_displaydata_order.
注意:我引用的 ABAP 文档因版本而异。我描述的扩展符号可以在 702 reference while a simpler and presumably older version of the documentation is shown for 700.
中看到
当我们想在 ABAP TYPES
语句中包含一个类型时,我们可以使用以下表示法:
TYPES: BEGIN OF lty_combined_type,
date_el TYPE zda_data_element.
INCLUDE TYPE zst_structure.
TYPES: END OF gty_wd_personnel.
这方面的一个限制似乎是我们不能将类型作为我们类型的第一组字段。使用最少的编码(即没有自定义字段目录)生成 ALV 时,字段顺序可能非常相关。
是否有替代符号来包含另一种类型作为第一个字段集?
问题中的代码(在 SCN 上找到)实际上是 header [=16= 下 TYPES
文档中列出的语法的缩写形式]:
TYPES BEGIN OF struc_type.
...
TYPES comp ... .
TYPES comp TYPE struc_type BOXED.
INCLUDE {TYPE|STRUCTURE} ... .
...
TYPES END OF struc_type.
因此,上面问题中的例子就是:
TYPES BEGIN OF lty_combined_type.
INCLUDE TYPE zst_structure.
TYPES date_el TYPE zda_data_element.
TYPES END OF lty_combined_type.
注意分组符号TYPES: name1 TYPE typ1, name2 TYPE type2.
也可以使用,例如:
TYPES BEGIN OF gty_displaydata_order.
INCLUDE TYPE gty_displaydata.
TYPES: order TYPE aufnr,
order_type TYPE aufart.
TYPES END OF gty_displaydata_order.
注意:我引用的 ABAP 文档因版本而异。我描述的扩展符号可以在 702 reference while a simpler and presumably older version of the documentation is shown for 700.