‎2006 Feb 21 5:54 PM
Hi there,
How can I declare an internal table into another internal table type?
I'm trying this, but it's not working:
Textos
begin of ty_linhas ,
linha(255) ,
end of ty_linhas ,
begin of ty_textos ,
rsnum TYPE resb-rsnum ,
rspos TYPE resb-rspos ,
linhas type ty_linhas ,
end of ty_textos .
thanks,
Alexandre Nogueira
‎2006 Feb 21 6:04 PM
Are you trying to do this
TYPES: BEGIN OF ty_linhas,
linha(255).
TYPES: END OF ty_linhas.
DATA: BEGIN OF ty_textos,
rsnum TYPE resb-rsnum,
rspos TYPE resb-rspos,
linhas TYPE ty_linhas.
DATA: END OF ty_textos.or this?
TYPES: BEGIN OF ty_linhas,
linha(255).
TYPES: END OF ty_linhas.
DATA: BEGIN OF ty_textos,
rsnum TYPE resb-rsnum,
rspos TYPE resb-rspos,
linhas TYPE TABLE OF ty_linhas.
DATA: END OF ty_textos.Both are ok.
Srinivas
‎2006 Feb 21 5:57 PM
Hi
Textos
TYPES: begin of ty_linhas ,
linha(255) ,
end of ty_linhas ,
GT_LINHA TYPE STANDARD TABLE OF TY_LINHAS
begin of ty_textos ,
rsnum TYPE resb-rsnum ,
rspos TYPE resb-rspos ,
linhas type GT_linhas ,
end of ty_textos .
Now the field LINHAS of type TY_TEXTOS is a table with the same structure of TY_LINHAS
Max
‎2006 Feb 21 6:00 PM
‎2006 Feb 21 6:01 PM
‎2006 Feb 21 6:03 PM
my code is this, the same the first message that I wrote
Textos
begin of ty_linhas ,
linha(255) ,
end of ty_linhas ,
begin of ty_textos ,
rsnum TYPE resb-rsnum ,
rspos TYPE resb-rspos ,
linhas type ty_linhas ,
end of ty_textos .
The error ir here
the error is: You cannot use generic type definitions within structures.
‎2006 Feb 21 6:03 PM
Hi ,
Try this.
Textos
begin of ty_linhas ,
linha(255) ,
end of ty_linhas ,
types : begin of ty_textos ,
rsnum TYPE resb-rsnum ,
rspos TYPE resb-rspos .
include type ty_linhas.
Types: end of ty_textos .
‎2006 Feb 21 6:04 PM
Are you trying to do this
TYPES: BEGIN OF ty_linhas,
linha(255).
TYPES: END OF ty_linhas.
DATA: BEGIN OF ty_textos,
rsnum TYPE resb-rsnum,
rspos TYPE resb-rspos,
linhas TYPE ty_linhas.
DATA: END OF ty_textos.or this?
TYPES: BEGIN OF ty_linhas,
linha(255).
TYPES: END OF ty_linhas.
DATA: BEGIN OF ty_textos,
rsnum TYPE resb-rsnum,
rspos TYPE resb-rspos,
linhas TYPE TABLE OF ty_linhas.
DATA: END OF ty_textos.Both are ok.
Srinivas
‎2006 Feb 21 6:08 PM
Ok Sri, It really works, but this way, it's no longer a TYPE, it have become an object "ty_textos"
‎2006 Feb 21 6:11 PM
u can also use like this
DATA : BEGIN OF TY_TEXTOS,
RSNUM TYPE RESB-RSNUM ,
RSPOS TYPE RESB-RSPOS ,
<b>BEGIN OF TY_LINHAS ,
LINHA(255) ,
END OF TY_LINHAS,</b>
END OF TY_TEXTOS .
‎2006 Feb 21 6:14 PM
Check this out
types: begin of t_tab4,
setid type t800s-setnr,
arbpl type crhd-arbpl,
charg type mseg-charg,
end of t_Tab4.
types: begin of t_tab3,
setid type t800s-setnr,
arbpl type crhd-arbpl,
charg type mseg-charg,
t_tab2 type t_tab4,
end of t_Tab3.
data: l_Tab3 type t_Tab3.
‎2006 Feb 21 6:15 PM
You define local types in your program to whatever complexity you want. You can have a simple type like
TYPE matnr(18). You can have a complex type like
TYPES: BEGIN OF ty_linhas,
linha(255) OCCURS 10.
TYPES: END OF ty_linhas.
DATA: BEGIN OF ty_textos,
rsnum TYPE resb-rsnum,
rspos TYPE resb-rspos,
linhas TYPE TABLE OF ty_linhas.
DATA: END OF ty_textos.
Here your type itself is a internal table and the structure that you later created is creating a complex field called 'linhas' which is an internal table of internal tables.
Type by itself cannot become an object holding data, unless it is used in the declaration of a data variable define using DATA statement.
I hope it is clear.
Srinivas
‎2006 Feb 21 6:18 PM
Yeap, it's clear, thanks all for the answers!!!
Alexandre Nogueira
‎2006 Feb 21 6:05 PM