2013 Apr 18 2:57 PM
Hi all,
I have an example from some code, that placed a question mark inside my head So i have a simple example here:
types : begin of t_table ,
pernr type p2001-pernr ,
end of t_table
Now we declare a itab like this:
t_t_tab type standard table of t_table
and a workarea
w_tab type t_table
However, what does this do:
w_tab type t_t_tab
Can you please explain?
2013 Apr 18 3:43 PM
Hi Egeman,
if you declare : w_tab type t_t_tab will throw you a syntax error.
but if you declare it like w_tab like t_t_tab then it will create an internal table of the same type as t_t_tab.
Regards,
Santanu Mohapatra
2013 Apr 18 4:01 PM
Hi Egeman ,
If you declare like 'data : w_tab type t_t_tab' , It will get create the without header line Internal table with name w_tab .
Thanks ,
Mallikarjun
2013 Apr 18 4:20 PM
If you declare t_t_tab as
TYPES : t_t_tab type standard table of t_table
then data : w_tab type t_t_tab, then w_tab becomes a standard internal table with the structure same as t_table.
Or else as Santanu has correctly mentioned.
2013 Apr 18 4:20 PM
Hi Egemen,
it will refer to an existing data object for the type which you have created before.........and its not type it is like. you got to know the difference between type and like. so hoping it is clear goodbye........
thanks and regards,
narayan
2013 Apr 18 4:28 PM
IF YOU DECLARE T_T_TAB TYPE STANDARD TABLE OF T_TABLE
T_T_TAB IS A TYPE TABLE.
THEN,
DATA:
WA_TAB TYPE T_T_TAB.
WA_TAB IS A INTERNAL TABLE WITH STRUCTURE T_TABLE.
2013 Apr 18 7:13 PM
Hi,
Please be note that Work area should always have a same structure . So what ever the structure that you have created t_table. Work area should be of that structure only w_tab type t_table.
And you have defined an internal t_t_tab and for that line
w_tab type t_t_tab. The system itself will tell that t_t_tab is unknown but there is similar name t_table.Its an error.
So that work area should have same structure.
For this line : w_tab like t_t_tab if you specify like this then ur w_tab have as same structure of that table and also act as an internal table too.
Thanks,
Siva
2013 Apr 24 2:27 PM
Hi,
If you declare w_tab type t_t_tab, it will act as an Internal Table.
Thanks & Regards,
Prasanna.
2013 Apr 24 3:40 PM
Simplify you life!
types : t_pernr type table of p2001-pernr.
2013 Apr 25 6:53 AM
Hi Egeman,
data w_tab type t_table ( w_tab behaves like work area)
data w_tab type t_t_tab (which gives syntax error)
data w_tab like t_t_tab (here w_tab is a internal table )
data w_tab like line of t_t_tab ( here w_tab is a work area)
Regards,
Chinni