Application Development 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: 

Conversion error

Former Member
0 Kudos

Hi,

i have a code lik this

ztabletype is a table structure.

tables : ztable.

data: itab type ztabletype,

wa_itab like line of itab.

select * from ztable into itab where 'condition'.

LOOP AT itab INTO wa_itab.

....

...

ENDLOOP.

I am getting the error "ITAB can not be converted to WA_ITAB".

How to correct this problem?

Rgards,

Mythili

1 ACCEPTED SOLUTION

Former Member
0 Kudos

tables : ztable.

data: itab type ztable,
         wa_itab like line of itab.

select * from ztable into table itab where 'condition'.

LOOP AT itab INTO wa_itab.

....
...

ENDLOOP.

or

data: itab type standard table of  ztable,
         wa_itab like lie of itab.

select * from ztable into table itab where 'condition'.

LOOP AT itab INTO wa_itab.

....
...

ENDLOOP.

the above code will work.

put the break point at loop at itab and check whther the data is coming or not to itab.

revert back for further issues

Edited by: vishwa sri hari on Sep 25, 2008 9:54 AM

9 REPLIES 9

Former Member
0 Kudos

Hi,

try this-

tables : ztable.

data: itab type ztabletype,

wa_itab like line of itab.

select * from ztable into table itab where 'condition'.

LOOP AT itab INTO wa_itab.

....

...

ENDLOOP.

Former Member
0 Kudos

Change the declaration of wa_itab from like line of itab to itab. Here itab is declared as a table structure and wa_itab as "line of itab"..so there is difference... it wont take it.

Regards,

VIshwa.

0 Kudos

Hi,

I have missed to type table in this.I have given that.

If i change the

wa_itab like lin of itab

to

wa_itab type itab

,its showing itab is unknown.

I have used like line of similarly before.that time I did not use select query like this.

Regards,

Mythili

0 Kudos

Hi

U can give wa_itab type ztabletype.

for itab give itab type ztabletype occurs 0.

Regards,

Vishwa.

0 Kudos

Hi viswa,

If I change that to type means getting the error" ITAB can not be converted to

WA_ITAB" at the line LOOP AT...

0 Kudos

Please close the post, if the question is answered.

Former Member
0 Kudos

Hi,

May be your version is 4.6 or 4.7E. In this version generally we are facing this type of problems.

Try like this:

tables : ztable.

data: itab like ztabletype occurs 0,

wa_itab like itab.

select * from ztable into itab where 'condition'.

LOOP AT itab INTO wa_itab.

....

...

ENDLOOP.

Hope this will help you. Revert back if you face any problems..

Regards,

Kumar.

0 Kudos

Hi Lakshman,

Thanks!

My version is 4.6.

I have changed as u said.

But it is saying "ztabletype should be a flat structure."

But its a table structure.

I have many fields in the transparent table.So i dont want to create flat structrure.I

want to use the table structure alone.

Regards,

Mythili

Former Member
0 Kudos

tables : ztable.

data: itab type ztable,
         wa_itab like line of itab.

select * from ztable into table itab where 'condition'.

LOOP AT itab INTO wa_itab.

....
...

ENDLOOP.

or

data: itab type standard table of  ztable,
         wa_itab like lie of itab.

select * from ztable into table itab where 'condition'.

LOOP AT itab INTO wa_itab.

....
...

ENDLOOP.

the above code will work.

put the break point at loop at itab and check whther the data is coming or not to itab.

revert back for further issues

Edited by: vishwa sri hari on Sep 25, 2008 9:54 AM