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

Internal Table Error

Former Member
0 Likes
1,490

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.

15 REPLIES 15
Read only

Former Member
0 Likes
1,451

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.

Read only

Former Member
0 Likes
1,451

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

Read only

Former Member
0 Likes
1,451

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.

Read only

Former Member
0 Likes
1,451

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

Read only

0 Likes
1,451

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...............

Read only

0 Likes
1,451

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

Read only

Former Member
0 Likes
1,451

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.

Read only

Former Member
0 Likes
1,451

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.

Read only

Former Member
0 Likes
1,451

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

Read only

Former Member
0 Likes
1,451

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.

Read only

Former Member
0 Likes
1,451

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.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,451

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.

Read only

Former Member
0 Likes
1,451

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.

Read only

Former Member
0 Likes
1,451

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

Read only

Former Member
0 Likes
1,451

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.