Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to define a generic structured type (deep structure) w/o LIKE

Former Member
0 Kudos

Hi,

I have been trying to define a generic structured type that would include a component (field) of type "table type".

Look at my type [ty_compatibilite]. It is the structured type that needs to have a component called "mobile" which needs to be an internal table. I have tried to create a genereic table type called tt_mobile (based on ty_mobile) but that did not work. I have not been able to avoid using the LIKE command to make it work.

Any suggestions on how I could define my component "mobile" without using a "LIKE"... ?

Here is my code:

TYPES: BEGIN OF ty_mobile,
          ref_mob_sfr    TYPE zmobil,
          ref_mrq_sfr    TYPE zmarq,
          type_compat    TYPE zsea_comp_type,
       END OF ty_mobile.

TYPES: tt_mobile TYPE STANDARD TABLE OF ty_mobile.

DATA: lit_mobiles TYPE STANDARD TABLE OF ty_mobile.

TYPES : BEGIN OF ty_compatibilite,
          cod_ean        TYPE ean11,
          lib_art        TYPE maktx,
          compat_all_mrq TYPE zsea_comp_gen,
*          mobile        TYPE tt_mobile,
          mobile         LIKE lit_mobiles,
        END OF ty_compatibilite.

TYPES : tt_compatibilite   TYPE STANDARD TABLE OF ty_compatibilite.

1 ACCEPTED SOLUTION

former_member182670
Contributor
0 Kudos

define key or use default one:

TYPES: tt_mobile TYPE STANDARD TABLE OF ty_mobile with DEFAULT KEY.

If you don't specify key the type is treated as generic

2 REPLIES 2

former_member182670
Contributor
0 Kudos

define key or use default one:

TYPES: tt_mobile TYPE STANDARD TABLE OF ty_mobile with DEFAULT KEY.

If you don't specify key the type is treated as generic

0 Kudos

Thank you so much, solved my problem !