09-11-2008 5:53 AM
Hi All,
I have the code like below in 4.6c version.
data: itab like mara occurs 0 with header line.
select * from mara into table itab.
loop at itab.
write:/ itab.
endloop.
This code is working in 4.6c version.
But if i try the same code in ECC 6.0 version iam getting the error as
"ITAB cannot be converted to charector-type field".
How to overcome this in ECC6.0 without declaring each field.
(ex:I mean itab-matnr)
Thanks in Advance.
09-11-2008 6:00 AM
this is not an error.
it's just a warning message just activate and ignore this message and run your program.
don't bother much.
09-11-2008 6:02 AM
Hi,
The error is in this part of code.
loop at itab.
write:/ itab.
endloop.
we can not do it like that we need to display all the fields individually.
try it like that, Hope it will work.
Regards
Rajesh Kumar
09-11-2008 6:02 AM
Hi Eeshwar,
IN ECC 6.0 version, writing the internal table as a whole is not UNICODE compatible. So what you need to do is, you need to write individual fields for your output.
As follows:
LOOP AT ITAB INTO WA_ITAB.
WRITE:/ WA-ITAB-field1,
WA-ITAB-field2.
ENDLOOP.
This would help you solve that error/ warning.
Best Regards,
Ram.
09-11-2008 6:05 AM
Hi eeshwar Baddam,
DATA: itab LIKE yyhcobd OCCURS 0 WITH HEADER LINE.
SELECT * FROM yyhcobd INTO TABLE itab.
LOOP AT itab.
WRITE:/ itab.
ENDLOOP.
This code is working fine in ECC 6.0.
Best regards,
raam
09-11-2008 6:16 AM
Hi Raam,
I dont want to write the individual fields, Becuase the table has more than 100 fields.
Also the code is not working in ECC6.0 but you are saying it is working fine?
please clarify...............
09-11-2008 6:23 AM
Hi Eeshwar Baddam,
DATA: itab LIKE yyhcobd OCCURS 0 WITH HEADER LINE.
SELECT * FROM yyhcobd INTO TABLE itab.
LOOP AT itab.
WRITE:/ itab.
ENDLOOP.
yyhcobd ---> this table does not contain the Quantity and currency Fields .
That is the reason it is working fine.
If the table contains the Currency or quantity fields then you need to give the fields also.
Best regards,
raam
09-11-2008 6:06 AM
hi eshwar.
try this way
data: itab type table of mara.
data:wa_itab type mara.
select * from mara into table itab.
loop at itab into wa_itab.
write:/ wa_itab-matnr.
endloop.
Thanks,
Mahesh.
09-11-2008 6:07 AM
if your internal table contains any qty , decimals, currency fields then it is not possible to use directly using write itab, and it gives error. you need to specify the fields what ever you want to display.
loop at itab.
write:/ itab. "it works only for char/string etc but fails for QTY,currency etc.
endloop.
09-11-2008 6:08 AM
hi,
IN ECC 6.0, just writing "loop at itab" wont work as its not compatible with the standards.
First declare the workarea for the table, read all records in to the workarea and then indivisually write all the records.
Loop at itab into wa_itab.
write : wa_itab-f1.
endloop.
Regards,
preet
09-11-2008 6:08 AM
Hi,
Use the below method for creating internal table and work area in the ECC 6.0.
types: begin of y_struc,
field1 type dbtable-field1,
field2 type dbtable-field2,
end of y_struc.
data: itab type standard table of y_struc,
wa type y_struc.
loop at itab into wa.
write: wa-field1, wa-field2.
clear wa.
endloop.
09-11-2008 6:11 AM
Hi,
write this way.
loop at itab.
write:/ itab-matnr, itab-makt......
endloop.
Or best is to use workarea .
loop at itab into wa_itab
write:/ wa_itab-matn, wa_itab-makt...
endloop.
if your internal table contains any quantity , decimals or currency fields then it is not possible to use write itab, and it gives error so you need to specify the fields that are to be displayed.
thanx.
09-11-2008 6:28 AM
data: itab like mara occurs 0 with header line.
jus t change this as.
data: itab like table of mara occurs 0 with header line.
09-11-2008 6:31 AM
HI,
I think in mara table i have faced the same problem. the only solution is the fields that are requied should be declared one by one , not by refferrring it to whole table.
09-11-2008 6:31 AM
I do not want to use individual fields to display.
In there any other option to do without using individual fields in ECC 6.0
Thanks
09-11-2008 6:33 AM
hi...
u can use an option in pattern where u need to only select the fields that u want, if u r interested i will help you with navigation.