09-25-2008 7:57 AM
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
09-25-2008 8:54 AM
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
09-25-2008 8:00 AM
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.
09-25-2008 8:00 AM
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.
09-25-2008 8:07 AM
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
09-25-2008 8:12 AM
Hi
U can give wa_itab type ztabletype.
for itab give itab type ztabletype occurs 0.
Regards,
Vishwa.
09-25-2008 8:21 AM
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...
09-25-2008 9:24 AM
09-25-2008 8:02 AM
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.
09-25-2008 8:14 AM
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
09-25-2008 8:54 AM
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