2009 Sep 14 8:31 AM
hi,
i am getting an error in below select query .
when using the addition for all entries in itab,the fields objkt and gt_fin-matnr must have the same type and length.
why please tell me??everything is perfect matching here ..
SELECT aennr
objkt
cclck
FROM aeoi
INTO TABLE gt_aeoi1
FOR ALL ENTRIES IN gt_fin
WHERE objkt = gt_fin-matnr.
2009 Sep 14 8:37 AM
Hello,
This is how FOR ALL ENTRIES behaves.
If you check field OBJKT is 40 character long but MATNR is 18 character only.
You have to try a workaround for this.
BR,
Suhas
2009 Sep 14 8:38 AM
Hi,
Use "corresponding fields of"
SELECT aennr
objkt
cclck
FROM aeoi
INTO corresponding fields of TABLE gt_aeoi1
FOR ALL ENTRIES IN gt_fin
WHERE objkt = gt_fin-matnr.
Regards,
Vijay
2009 Sep 14 8:39 AM
Hi,
What you can do is go to the type declaration for the intenal table gt_fin and change the matnr length to same as that of objkt.
Regards
Ansari
2009 Sep 14 8:42 AM
2009 Sep 14 8:44 AM
Hi,
You will have a type declaration for the intenal table . there you would have given matnr type matnr.
instead of that give matnr type AEOBJEKT. Since AEOBJEKT is of char40 which is greater than matnr(char18) it will not be a problem.
Regards
Ansari
2009 Sep 14 9:02 AM
>
> hi,
>
> how to material length 18 to 40 ??
>
> please help me..
Make the field matnr of internal table gt_fin as 40 characters. Thats the easiest way
Cheers,
Suhas
2009 Sep 14 8:47 AM
hi,
remember while using for all entries , in the logical expression the two field length should be same .
Edited by: Sachhidananda Tripathy on Sep 14, 2009 9:47 AM
2009 Sep 14 8:51 AM
hi,
u r absolutely right.
but if i do like ur suggestion , the it again gives probleam because in my program some another select statement is used the matnr length(18) ..so again the probleam will come.
thanks for ur reply..if any othen alternative help me.
2009 Sep 14 8:54 AM
Hi,
This is a common scenario. Usually if you are not able adjust it by changing the data type then you will have to create a new internal table with the desired length for the field and then using loop you have to move the values to this new internal table. This new table can be used for for all entries. But this will require additional loop.
One doubt: You told u hve another select statemnt where u use matnr. Is that also a for all entries.
Regards
Ansar