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

select query error

Former Member
0 Likes
1,096

Hi,

present i am working in upgrade project from ecc5.0 to ecc6.0

i am facing below error

When you use the addition "FOR ALL ENTRIES IN itab", the fields

"PRODH1" and "I_CUST-PRODH1+0(2)" must have the same type and the same

length.

its showing in below select query

SELECT KUNNR

PRODH1

DATBI

DATAB

FROM A570

INTO TABLE I_A570

FOR ALL ENTRIES IN I_CUST

WHERE KAPPL = C_KAPPL AND

KSCHL = C_KSCHL AND

KUNNR = I_CUST-KUNNR AND

PRODH1 = I_CUST-PRODH1+0(2).

the length of of PRODH1 legth 2 and char type .

in the i_cust-prodh1 is PRODH1(18) TYPE C,

in the old version its working fine in new version its getting error .

plz give me suggestion ...

Madhu

9 REPLIES 9
Read only

Former Member
0 Likes
1,037

Hi ,

declare prodh1 of i_cust with lenght 2

i_cust-prodh1 is PRODH1(2) TYPE C,

Regards

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,037

You can move I_CUST-PRODH1+0(2) to a range of type A570-PRODH1

and then use prodh1 in ra_prodh

Read only

0 Likes
1,037

If you do so, you will "lose" the "binary condition".

In my opinion, the solution would be add a field to the FAE table, update that field in a LOOP, and change the WHERE condition to use that new field replacing the substring condition.

DATA: definition_of_I_CUST,
        PRODH2(2) TYPE c,
      endofdefinition_of_I_CUST.

* after fill I_CUST
LOOP AT I_CUST INTO w_cust.
  w_cust-PRODH2 = w_cust-PRODH1(2).
  MODIFY I_CUST FROM w_cust INDEX sy-tabix.
ENDLOOP.

SELECT KUNNR PRODH1 DATBI DATAB
  FROM A570
  INTO TABLE I_A570
  FOR ALL ENTRIES IN I_CUST
  WHERE KAPPL = C_KAPPL AND
        KSCHL = C_KSCHL AND
        KUNNR = I_CUST-KUNNR AND
        PRODH1 = I_CUST-PRODH2.

Read only

0 Likes
1,037

Hi ksd,

can you explain clearly......

i tried to some of above answers ,it shows in some other place ..

like i decleared like data:prodh1(2) type c in i_cust-prodh1 internal table ...

plz give me solution

Madhu

Read only

0 Likes
1,037

Try it the hard way: declare the added field in I_CUST

TYPE A570-PRODH1

Or go to SE11, check table/view A570 and declare your added field using the same data element than PRODH1.

I cannot give you the proper data element as A570 doesn't have that field in my system (version mismatch? missing include?)

Read only

Former Member
0 Likes
1,037

Consider only first two characters of PRODH while filling internal table I_CUST

And keep data type of PRODH equal to C length 2 in both declarations.

Read only

0 Likes
1,037

You don't know if he needs the information of the whole field in I_CUST too. Adding a new field means no data loss.

Read only

Former Member
0 Likes
1,037

Thanku for all ,problem solved.

Regards,

Madhu

Read only

0 Likes
1,037

>Total Questions: 8 (8 unresolved)

If your question is answered, then please mark it as solved.

Rob