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

TABLE into a TYPE

Former Member
0 Likes
533

hi guys,

I would like to create a type including an internal table whithin.

The type declaration might be something like :

BEGIN OF ty_trad,

key TYPE textpool-key,

line TYPE TABLE OF i,

lg TYPE i,

val_fr TYPE string,

val_cs TYPE string,

END OF ty_trad.

This syntax causes a compilation error. I know this is possible in other languages and i would be surprised it is not in ABAP... Is it ?

Thanks a lot !

--Yohann

1 ACCEPTED SOLUTION
Read only

matt
Active Contributor
0 Likes
503

You just have to use the full syntax for describing the table:

TYPES: BEGIN OF ty_trad,
  key TYPE textpool-key,
  line TYPE STANDARD TABLE OF i WITH NON-UNIQUE KEY table_line,
  lg TYPE i,
  val_fr TYPE string,
  val_cs TYPE string,
END OF ty_trad.

matt

4 REPLIES 4
Read only

Former Member
0 Likes
503

Hello,

Yes, it's possible to do this in ABAP, too.

Try this:


TY_LINE TYPE TABLE OF I,

BEGIN OF ty_trad,
key TYPE textpool-key,
line TYPE TY_LINE
lg TYPE i,
val_fr TYPE string,
val_cs TYPE string,
END OF ty_trad.

Regards,

Read only

0 Likes
503

Hi,

the syntax you gave me generate the following compilation error :

"TY_LINE" is a generic type. A type reference is possible only for field symbols and formal parameters . . . . . . . . . ."

Regards,

--Yohann

Edited by: Yohann Camp on May 13, 2008 4:12 PM

Read only

matt
Active Contributor
0 Likes
504

You just have to use the full syntax for describing the table:

TYPES: BEGIN OF ty_trad,
  key TYPE textpool-key,
  line TYPE STANDARD TABLE OF i WITH NON-UNIQUE KEY table_line,
  lg TYPE i,
  val_fr TYPE string,
  val_cs TYPE string,
END OF ty_trad.

matt

Read only

Former Member
0 Likes
503

Hi Yohann,

try this....

DATA:TY_LINE TYPE TABLE OF I.

TYPES:BEGIN OF ty_trad,

key TYPE textpool-key,

line LIKE TY_LINE,

lg TYPE i,

val_fr TYPE string,

val_cs TYPE string,

END OF ty_trad.

Reward if useful.

Thanks & Regards,

Khan.