‎2008 Apr 18 11:15 AM
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
‎2008 Apr 18 11:21 AM
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 ...
‎2008 Apr 18 11:30 AM
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
‎2008 Apr 18 11:37 AM
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.
‎2008 Apr 18 6:02 PM
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.
‎2008 Apr 21 7:30 AM
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
‎2008 Apr 21 8:46 AM
HI Priya,
kindly check your internal table declaraion..occurs specification is missing..
regards
‎2008 Apr 21 9:08 AM
Plz modify ur Select query like..
select * from mara into corresponding fields of table it where mara-matnr = marc-matnr.
‎2008 Apr 21 11:58 AM
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