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

Regarding internal tables

spandana_babu
Participant
0 Likes
993

hi

experts

types : BEGIN OF WA_KNA1,

CNO(10) TYPE C,

COUNTRY TYPE LAND1_GP,

NAME LIKE KNA1-NAME1,

END OF WA_KNA1.

data : wa_kna2 type wa_kna1.

1.DATA IT_KNA1 like TABLE OF WA_KNA2.

2. data it_kna2 type table of wa_kna1.

in 2nd statement i replace wa_kna1 with wa_kna2.

it shows error that wa_kna2 unknown...

can any body explain..

*********************************************************************************

data : BEGIN OF WA_KNA1,

CNO(10) TYPE C,

NAME LIKE KNA1-NAME1,

END OF WA_KNA1.

1. DATA IT_KNA1 like TABLE OF wa_kna1.

2. data it_kna1 type table of wa_kna1.

2nd stametn is shows error.

please explain....

Regards..

Spandana

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
968

Hi

The problem is, if u declare WA_KNA1 in TYPES...the stmt

data it_kna2 type table of wa_kna1 ..will go and check WA_KNA1 in TYPES declaration. In general if u define TYPE TABLE OF in data declaration,, ABAP will go and check in TYPES declaration.....

But if u define LIKE TABLE OF it will go and check in DATA declaration whether refering table exists or not...

Rewards if usefulll !!!!

Regards,

ABAPer 007

10 REPLIES 10
Read only

Former Member
0 Likes
968

hi,

do this way ..

data : wa_kna2 like wa_kna1.

data it_kna1 type standard table of wa_kna1.

regards,

Santosh

Read only

0 Likes
968

hi

santosh

i am getting same error..

Spanadana

Read only

Former Member
0 Likes
968

hi,,

data it_kna2 like wa_kna2.

wa_kna2 is not defined in types...so u should use like and not type.

regards,

madhumitha

Read only

0 Likes
968

Hello Madhumitha,

I feel sorry for you. Spandana hasn't provided you with a single point even you answered his/her question correctly (though there was a little typing mistake: "like table" instead of "like"). Spandana gave all 10 points to ABAPer 007. That's not fair.

Regards,

Heinz

Read only

Former Member
0 Likes
969

Hi

The problem is, if u declare WA_KNA1 in TYPES...the stmt

data it_kna2 type table of wa_kna1 ..will go and check WA_KNA1 in TYPES declaration. In general if u define TYPE TABLE OF in data declaration,, ABAP will go and check in TYPES declaration.....

But if u define LIKE TABLE OF it will go and check in DATA declaration whether refering table exists or not...

Rewards if usefulll !!!!

Regards,

ABAPer 007

Read only

0 Likes
968

hi

i am using line type & row type..

i created line type as zline, table type as ztab with line type of zline in se11.

when i declare like this

1. data :w_it type ztab

it gives the body of ztab..

where

while we r declaring in standard table like mara..

2. data : w_it type mara.

it gives the work area of mara.

types : BEGIN OF WA_KNA1," occurs 0,

CNO(10) TYPE C,

COUNTRY TYPE LAND1_GP,

NAME LIKE KNA1-NAME1,

END OF WA_KNA1.

3 .data : w_it type wa_kna1. " it also gives the work area

please expalin wt diff b/w 1,2, 3

Regards..

Spanadana

Read only

0 Likes
968

Hi,

1. wa_it has the structure as ztab has,

2. wa_it has the structure of mara and

3. wa_it has the structure of wa_kna1, i.e. it consists of the fields cno, country and name.

None of the three data declarations is an internal table!

Have success,

Heinz

Read only

0 Likes
968

hi

henz

thanks to reply

but in 1. statemnet

i t shows the body of the ztab( table type)

not strucutre..

while othere shows structure..

can u explain..

Regards

Spandana

Read only

0 Likes
968

Hi Spandana,

Statement 1 shows you the body in case when your ztab is declares as TYPE TABLE.

Hope it helps,

Heinz

Read only

0 Likes
968

hi

heinz

thank u very much

i understand completely....

thank u

Spanadana