Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to declare table type inside structure?

Tags:

abap

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.
like image 735
METTAIBI Avatar asked Oct 29 '25 17:10

METTAIBI


2 Answers

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.
like image 21
Suncatcher Avatar answered Oct 31 '25 11:10

Suncatcher