abap

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.

Solution

  • 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 ,