‎2008 Jul 10 8:04 AM
Hi Friends,
Select * from ekko into table i_ekko up to 100 rows.
loop at i_ekko into w_ekko.
write : w_ekko.
endloop.
when i write the above code i am getting an error "cannot be converted in to charater type".
but i want to display the all the coloums and rows from the DB table in the report.
regards
kumar m
‎2008 Jul 10 8:12 AM
hi,
you need to specify the fields in the write statement as your work area which contains a single row of your internal table , can not be converted into a single character string.
so u have to specify lilke this inside a loop statement:
write 😕 w_ekko-fld1 , w_ekko-fld2 , .......
‎2008 Jul 10 8:06 AM
Either you have to specify each and every column like w_ekko-field1, w_ekko-field2
or you have to dynamically assign field-symbols to do the job if number of fields are very high
‎2008 Jul 10 8:08 AM
my issue was.
List all the rows from the table LAGP(Storage Bins) in a report
‎2008 Jul 10 8:07 AM
hi,
w_ekko is workarea so u cannot get data into that,u have to define all the fileds in order to get them in output.
‎2008 Jul 10 8:07 AM
hi,
loop at i_ekko into w_ekkoHere w_ekko is considered as the field string which cannot be written with name with reference of the field name.
You shold try this
loop at i_ekko into w_ekko.
write : w_ekko-filed1.
endloop.
This will work.
Regards
Sumit Agarwal
‎2008 Jul 10 8:08 AM
Hi Mukesh,
Here you are writing the field string at once. It considers the field string as a completer character type. But it contains fields other than character type. So, they cannot be converted into character type.
Instead you try to write each field individually as
wa_ekko-field1 etc.
Regards,
Chandra Sekhar
Edited by: Chandrasekhar Gandla on Jul 10, 2008 9:08 AM
‎2008 Jul 10 8:10 AM
Hi,
Use
Loop at itab into wa .
write: wa-field.
Endloop.
Regards,
Sujit
Edited by: Sujit Pal on Jul 10, 2008 9:10 AM
‎2008 Jul 10 8:10 AM
Hi
W_EKKO is only a work area which is like the line type of your internal table so you haveto explicitly write all teh column names
like
write :
/ W-EKKO-<name of the column>.
Regards
Pavan
‎2008 Jul 10 8:12 AM
HI mukesh,
When you loop at a internal table without a header line,that time while retrieving/printing the data , you should deal at field level & not work area level.
So instaed of writing the complete work area,try to write field one by one.
eg,
write : workarea-field 1,
workarea-field 2,
The code which you have writeen would work for table with header line..
Good luck
Bhumika
‎2008 Jul 10 8:12 AM
hi,
you need to specify the fields in the write statement as your work area which contains a single row of your internal table , can not be converted into a single character string.
so u have to specify lilke this inside a loop statement:
write 😕 w_ekko-fld1 , w_ekko-fld2 , .......
‎2008 Jul 10 8:13 AM
But LAGP contains 50 fields,,
ok if Any table contain 250 fields
i should write
wa-<tab>-field1 ....... to wa_<tab>-field250. ?
‎2008 Jul 10 8:18 AM
Hi,
yes on that time declare the field symbol like <fs> type any.
aassign internal table to this field symbol.
finally.
write:/ <fs>.
regards.
sriram.
‎2008 Jul 10 8:21 AM
Hi,
in yoour code try like this,
FIELD-SYMBOLS: <FS>.
Select * from ekko into table i_ekko up to 100 rows.
loop at i_ekko into w_ekko.
assign lw_ekko to <FS>.
write : <FS>.
endloop.
regards.
sriram.
‎2008 Jul 10 8:22 AM
I think structure of i_ekko and wai_ekko not same as ekko DB table. You have define them.
Syed Tayab shah
‎2008 Jul 10 8:25 AM
Hi,
U cannot call the Itab directil into the write statement. Instead u have to specify whatever fields you want in the output that u have to give.
For eg.
loop at itab into w_itab.
write:/ w_itab-field1,
w_itab-field2,
w_itab-field3,
w_itab-field4.
endloop.
Hope this helps you.
Reward points if helpfull.
Thanks & Regards,
Y.R.Prem Kumar.
‎2008 Jul 10 8:26 AM
Hi Mukesh,
Actually you can do like this because each record is taken into the work area w_ekko . But probably you have some fields which cannot be converted into character types. and this character type can be of type C , N , D or T. And I also think that you might have observed some special characters also which appear. So it is always advisable to write the fields individually.
Regards,
Swapna.
‎2008 Jul 10 9:22 AM
Try this it may work.
data : iekko like ekko occurs 0.
data : wekko like ekko.
field-symbols : <fs> type any.
select * from ekko into table iekko up to 100 rows.
loop at iekko into wekko.
do 100 times.
assign component sy-index of structure wekko to <fs>.
if sy-subrc = 0.
write : <fs>.
else.
exit.
endif.
unassign <fs>.
enddo.
write : /.
endloop.