Application Development and Automation 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: 
Read only

Syntax error: generic typing?

former_member185943
Participant
0 Likes
2,771

Hello!

I'm on WAS 620, ABAP patch 41.

I tried to create a deep table type as follows:

TYPES: BEGIN OF s_fname_pair,
           fname_itab TYPE fieldname,
           fname_ddic TYPE fieldname,
         END OF s_fname_pair,
         ty_t_fname_mapping
                TYPE STANDARD TABLE OF s_fname_pair,
         ty_tt_fname_mappings
                TYPE STANDARD TABLE OF ty_t_fname_mapping.

However, I get a syntax error saying that "TY_T_FNAME_MAPPING" is a generic type.

Why is it generic? It seems to me that it's a fully typed table. When I declare the same types as dictionary types, everything works fine.

What is wrong here?

Thanks!

Regards,

Igor

1 ACCEPTED SOLUTION
Read only

Vinod_Chandran
Active Contributor
2,285

Hi Igor,

Your code will work but you need to add 'WITH DEFAULT KEY'.

TYPES: BEGIN OF s_fname_pair,

fname_itab TYPE fieldname,

fname_ddic TYPE fieldname,

END OF s_fname_pair,

ty_t_fname_mapping

TYPE STANDARD TABLE OF s_fname_pair WITH DEFAULT KEY,

ty_tt_fname_mappings

TYPE STANDARD TABLE OF ty_t_fname_mapping.

After this you have to use the DATA statement to define the internal table.

Cheers

Vinod

Message was edited by: Vinod C

3 REPLIES 3
Read only

Former Member
0 Likes
2,285

if u need to define an internal table, u need to do it using the DATA statement and not TYPES statement.

TYPES: BEGIN OF s_fname_pair,

fname_itab TYPE fieldname,

fname_ddic TYPE fieldname,

END OF s_fname_pair.

TYPES : BEGIN OF ty_t_fname_mapping,

d1 TYPE s_fname_pair,

END OF ty_t_fname_mapping.

DATA :

ty_tt_fname_mappings

TYPE STANDARD TABLE OF ty_t_fname_mapping.

rgds,

PJ

Read only

Vinod_Chandran
Active Contributor
2,286

Hi Igor,

Your code will work but you need to add 'WITH DEFAULT KEY'.

TYPES: BEGIN OF s_fname_pair,

fname_itab TYPE fieldname,

fname_ddic TYPE fieldname,

END OF s_fname_pair,

ty_t_fname_mapping

TYPE STANDARD TABLE OF s_fname_pair WITH DEFAULT KEY,

ty_tt_fname_mappings

TYPE STANDARD TABLE OF ty_t_fname_mapping.

After this you have to use the DATA statement to define the internal table.

Cheers

Vinod

Message was edited by: Vinod C

Read only

0 Likes
2,285

It works - thanks, Vinod!

Kind regards,

Igor

P.S. You'll get your points as soon as those option buttons decide to show at my screen.

Message was edited by: Igor Barbaric