When we want to include a type in an ABAP TYPES statement we can use the following notation:
TYPES: BEGIN OF lty_combined_type,
date_el TYPE zda_data_element.
INCLUDE TYPE zst_structure.
TYPES: END OF gty_wd_personnel.
One limitation of this seems to be that we can't include a type as the first set of fields of our type. Field order can be very relevant when generating ALVs with minimal coding (i.e. no custom field catalog).
Is there an alternative notation to include another type as the first fieldset in?
The code in the question (found on SCN) is actually a shortened form of the syntax that's listed in the documentation for TYPES under the header Structured Types:
TYPES BEGIN OF struc_type.
...
TYPES comp ... .
TYPES comp TYPE struc_type BOXED.
INCLUDE {TYPE|STRUCTURE} ... .
...
TYPES END OF struc_type.
As such, the example in the question above would simply be:
TYPES BEGIN OF lty_combined_type.
INCLUDE TYPE zst_structure.
TYPES date_el TYPE zda_data_element.
TYPES END OF lty_combined_type.
Note that the grouped notation TYPES: name1 TYPE typ1, name2 TYPE type2. can also be used, for instance:
TYPES BEGIN OF gty_displaydata_order.
INCLUDE TYPE gty_displaydata.
TYPES: order TYPE aufnr,
order_type TYPE aufart.
TYPES END OF gty_displaydata_order.
Note: the ABAP documentation I reference differs between versions. The expanded notation I've described can be seen in the 702 reference while a simpler and presumably older version of the documentation is shown for 700.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With