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

Internal table declaration

Former Member
0 Likes
1,083

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?

9 REPLIES 9
Read only

Former Member
0 Likes
1,023

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

Read only

Former Member
0 Likes
1,023

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

Read only

Former Member
0 Likes
1,023

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.

Read only

uppu_narayan
Active Participant
0 Likes
1,023

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

Read only

alessandroieva
Active Participant
0 Likes
1,023

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.

Read only

former_member189845
Active Participant
0 Likes
1,023

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

Read only

Former Member
0 Likes
1,023

Hi,

If you declare w_tab type t_t_tab, it will act as an Internal Table.

Thanks & Regards,

Prasanna.

Read only

Clemenss
Active Contributor
0 Likes
1,023

Simplify you life!

types          : t_pernr  type table of  p2001-pernr.

Read only

chinni_adapa
Participant
0 Likes
1,023

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