简体   繁体   中英

How to declare table type inside structure?

In order to achieve my smartform, I'm supposed to declare a table within a structure. I tried this but it's not working:

TYPES: t_qase2 TYPE TABLE OF qase.

TYPES: 
BEGIN OF ty_itab.
  pruefer type qase-pruefer.
  zeiterstl type qase-zeiterstl.
*  ......(other fields)
  ty_qase2 type t_qase2.
  INCLUDE STRUCTURE s_f800komp.
TYPES END OF ty_itab.

To declare a table in a structure you simply give a table type with non-unique key to one of the fields:

TYPES: myTableType TYPE TABLE OF string WITH NON-UNIQUE DEFAULT KEY.

TYPES: BEGIN OF ty_itab,
    pruefer    type qase-pruefer,
    zeiterstl  type qase-zeiterstl,
    myTable    type myTableType, "Table is here
    ty_qase2   type t_qase2.
    INCLUDE STRUCTURE s_f800komp.
TYPES:  END OF ty_itab.

Also notice that you end every line with a dot. In this case you have to use ,

Besides the variant proposed by previous answerer, there is variant of table declaration inside structure in an explicit way:

TYPES: BEGIN OF ty_itab,
  pruefer    TYPE qase-pruefer,
  zeiterstl  TYPE qase-zeiterstl,
  myTable    TYPE TABLE OF string WITH NON-UNIQUE DEFAULT KEY,
  ty_qase2   TYPE t_qase2.
  INCLUDE STRUCTURE s_f800komp.
TYPES:  END OF ty_itab.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM