Application Development 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: 

getting error in select statement

Former Member
0 Kudos
197

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.

9 REPLIES 9

SuhaSaha
Advisor
Advisor
0 Kudos
130

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

Former Member
0 Kudos
130

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

Former Member
0 Kudos
130

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

0 Kudos
130

hi,

how to material length 18 to 40 ??

please help me..

0 Kudos
130

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

0 Kudos
130

>

> 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

Former Member
0 Kudos
130

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

0 Kudos
130

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.

0 Kudos
130

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