Copyright 2022 - BV TallVision IT

An internal table is very handy, but you may want a table with tables or "table-in-table". Which is no big deal at all. How are they defined, what to do about the message: "YOUR_TYPE" is a generic type. Use of this type is only possible for typing field symbols and formal parameters.". Some examples:

The first thing to realize when you are working with tables in tables (a table which potentially has tables on each row) is the simple fact that the idea of table headers should be let go. Option WITH HEADER LINEis not a valid option here. Don't stick to the habbit of using that. Tables are tables and work areas for these tables are variables (makes coding much more readable too). Here's an example of a table with a table inside:

types: ty_source_tt type STANDARD TABLE OF 
         tdline WITH DEFAULT KEY,
       begin of ty_component,
         name type string,
         from type STMNT_FROM,
         to type STMNT_TO,
         pre_comments type ty_source_tt,
         content type ty_source_tt,
       end of ty_component, 
       ty_component_tt type STANDARD TABLE OF 
         ty_component WITH DEFAULT KEY.

DATA: gt_my_components type ty_component_tt. 

The object described here is an internal table about the components in a report, e.g. form routines or modules. Each routine has a number of ABAP source code lines and they can also have comment lines (usually just abof the FORM statement.

Notice the option WITH DEFAULT KEY. When it is omitted, the system assumes a generic key which is only possible for field symbols and formal parameters. So it would not allow you to generate the coding without this.