2007 Aug 30 3:52 AM
Hi Gurus,
Using keyword "TYPES", I want to define a structure in which there is a field must be table type. It seems not allowed. For example:
TYPES tt_items TYPE TABLE OF sflight.
TYPES: BEGIN OF str,
field1 TYPE i,
field_tabl TYPE tt_items.
TYPES: END OF str.
Then I got a syntax error:
"TT_ITEMS" is a generic type. Use of this type is only possible for typing field symbols and formal parameters. -
What should I do if I want to have a table type field in it?
Thanks a lot.
Hi Gurus,
Using keyword "TYPES", I want to define a structure in which there is a field must be table type. It seems not allowed. For example:
TYPES tt_items TYPE TABLE OF sflight.
TYPES: BEGIN OF str,
field1 TYPE i,
field_tabl TYPE tt_items.
TYPES: END OF str.
Then I got a syntax error:
"TT_ITEMS" is a generic type. Use of this type is only possible for typing field symbols and formal parameters. -
What should I do if I want to have a table type field in it?
Thanks a lot.
2007 Aug 30 4:01 AM
2007 Aug 30 4:42 AM
Hi Heilman, thanks. But I have to put my types in a class, and "OCCURS" is not allowed in OO context.
2020 Nov 03 5:00 AM
2020 Nov 03 5:00 AM
Hi Heilman, thanks. But I have to put my types in a class, and "OCCURS" is not allowed in OO context.
2007 Aug 30 4:08 AM
Do something like this...
TYPES : BEGIN OF ty_ekko.
INCLUDE TYPE ekko.
TYPES : chk(1) TYPE c.
TYPES : END OF ty_ekko.
DATA : it_ekko TYPE STANDARD TABLE OF ty_ekko,
is_ekko TYPE ty_ekko.Regards
Gopi
2007 Aug 30 4:43 AM
Hi Gopi, I don't understand. How did you define type "ekko"? Thanks.
2007 Aug 30 4:46 AM
include type EKKO includes the whole strucutre of EKKO.
if you see the structure in debug mode, it_ekko contains the fields of EKKO as well as the field CHK of type C.
In your case you can do this
TYPES: BEGIN OF str.
INCLUDE TYPE sflight. " includes whole structure of SFLIGHT
TYPES : field1 TYPE i. " include the field1 of type I
TYPES: END OF str.
DATA : it_str TYPE TABLE OF str, " internal table
is_str TYPE str. " work area
Regards
Gopi
2007 Aug 30 8:08 AM
Hii..
You can do this very much..
Change the code like this:
TYPES tt_items TYPE TABLE OF sflight.
TYPES: BEGIN OF str,
field1 TYPE i,
field_tabl TYPE LINE OF tt_items. "Component with a structurebased on table type
TYPES: END OF str.
<b>reward if Helpful</b>
2022 Jul 16 12:30 PM
TYPES:
BEGIN OF ty_equipments .
TYPES:
type TYPE string
.
TYPES: END OF ty_equipments .
TYPES:
tt_equipments TYPE STANDARD TABLE OF ty_equipments WITH DEFAULT KEY.
TYPES:
BEGIN OF data1 .
TYPES:
id TYPE string,
status TYPE string,
reject_reason TYPE string,
mileage TYPE string,
suggested_mode TYPE string,
equipments TYPE tt_equipments
.
TYPES: END OF data1 .
2022 Jul 16 12:30 PM
You have to use with DEFAULT Key when you declare a type of internal table.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |