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

query

Former Member
0 Likes
838

i wrote the code like that

tables:mara, marc.

data: begin of it,

mandt like mara-mandt,

matnr like marc-matnr,

pstat like marc-pstat,

end of it.

select * into it from mara where mara-matnr = marc-matnr.

loop at it.

write: / it-mandt,it-matnr.

end of it.

why it is giving the error like???

The type of database table and work area(or internal table)"IT

are not unicode convertible

8 REPLIES 8
Read only

Former Member
0 Likes
810

I think u r writing program in a non unicode system but there in the attributes of the program the unicode flag has been activated just remove the tick mark of the program then u may not get the error what u r getting right now... hope i am clear to u ...

Read only

Former Member
0 Likes
810

hi Priya,

You declared IT has workarea and while selecting you are selecting the multiple rows into it .

How can it possible this.

Here i am sending the change code

REPORT ZSDN .

tables:mara, marc.

Parameters : p_matnr type matnr .

data: begin of it occurs 0,

mandt like mara-mandt,

matnr like marc-matnr,

pstat like marc-pstat,

end of it.

select mandt matnr pstat from mara into table it where matnr = p_matnr.

loop at it.

write: / it-mandt,it-matnr.

endloop.

this helps you, reward points

Read only

kinnera_christinatenali
Product and Topic Expert
Product and Topic Expert
0 Likes
810

Hi Priya,

Let us know wat exactly you wud like to do , because your select statement is saying select * but your internal table has only three fields.

Your 'IT' is not an internal table , its just a structure. Have a look at the below code

tables:mara, marc.

data : p_matnr type mara-matnr.

data: begin of it,

mandt like mara-mandt,

matnr like marc-matnr,

pstat like marc-pstat,

end of it.

select mandt matnr pstat into it from mara where matnr = p_matnr.

endselect.

this will work. but it will fetch a single record.

Read only

Former Member
0 Likes
810

Hi,

The main problem in your code is that you didnt mention the keyword "TABLE" in the select query .Because of that you are getting the error UNICODE not convertible.

But modifications are to be done to your code inorder to get the program work.

use table it in select query .

You can follow the code of our friends posted above.

Reward points if helpful.

Thanks and Regards.

Read only

Former Member
0 Likes
810

In your IT, you have declared only three fields but in MARA thre is more than 150 records and in your select quey you are selecting all the fields(*) so it is showing the unicode convertible error.

Also You have declared IT as a work area so it holds only one record at a time and you are selecting many records.

Can you try like this,

DATA: BEGIN OF it OCCURS 0,
 mandt LIKE mara-mandt,
 matnr LIKE marc-matnr,
 pstat LIKE marc-pstat,
 END OF it.
 SELECT * INTO CORRESPONDING FIELDS OF TABLE it FROM mara WHERE mara-matnr = marc-matnr.

 LOOP AT it.
   WRITE: / it-mandt,it-matnr.
 ENDLOOP.

Here 'CORRESPONDING FIELDS OF TABLE ' statements moves only the fields corresponding to the it

Edited by: Rengith Skariah on Apr 21, 2008 8:31 AM

Read only

Former Member
0 Likes
810

HI Priya,

kindly check your internal table declaraion..occurs specification is missing..

regards

Read only

Former Member
0 Likes
810

Plz modify ur Select query like..

select * from mara into corresponding fields of table it where mara-matnr = marc-matnr.

Read only

Former Member
0 Likes
810

Hi,

tables:mara, marc.

data : begin of it occurs 0,

mandt like mara-mandt,

matnr like marc-matnr,

pstat like marc-pstat,

end of it.

select * from mara into corresponding fields of table it where matnr = marc-matnr.

loop at it.

write: / it-mandt,it-matnr , it-pstat.

endloop.

Try like this.

Onemore is whenever you are getting data from two or more table it should be better use.

1.For all entries

or

2.Joins

For all entries give the better performance than joins.

Reward if it useful...

Thanks in Advance