INCLUDE TYPE when defining new types with TYPES statement

Tags: ABAP

When you need to include simply fields

TYPES:
  BEGIN OF ty_cua_update,
    uname  TYPE xubname,
    modify_type TYPE c LENGTH 1,
    update_op    TYPE c LENGTH 1,
    modify_failed TYPE boole_d,
    modify_messages TYPE bapirettab,
    distribution_failed TYPE boole_d,
    distribution_messages TYPE bapirettab,
END OF ty_cua_update.

When you need to include complete structures together with other fields

TYPES:
  BEGIN OF ty_cua_update,
    uname  TYPE xubname,
    modify_type TYPE c LENGTH 1,
    update_op    TYPE c LENGTH 1,
    modify_failed TYPE boole_d,
    modify_messages TYPE bapirettab,
    distribution_failed TYPE boole_d,
    distribution_messages TYPE bapirettab.
        INCLUDE TYPE bapilogond.
TYPES : END OF ty_cua_update.

When you need to include complete structures together with other fields in the middle

TYPES:
  BEGIN OF ty_cua_update,
    uname  TYPE xubname,
    modify_type TYPE c LENGTH 1,
    update_op    TYPE c LENGTH 1,
    modify_failed TYPE boole_d,
    modify_messages TYPE bapirettab,
    distribution_failed TYPE boole_d,
    distribution_messages TYPE bapirettab.
        INCLUDE TYPE bapilogond.
TYPES: psw  TYPE bapipwd.
TYPES : END OF ty_cua_update.