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: 

data types

Former Member
0 Kudos

If data types of 2 fields are different how to compare???????????

Please let me know the solution and do needful

SELECT exnum

exdat

remtime

lifnr

rdoc

budat

FROM j_1iexchdr INTO CORRESPONDING FIELDS OF TABLE it_j_1iexchdr

FOR ALL ENTRIES IN it_mseg

WHERE rdoc = it_mseg-mblnr

AND ryear = it_mseg-mjahr.

Displayed message while developing a report

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

and "IT_MSEG-MJAHR" must have the same type and the same length.

4 REPLIES 4

Former Member
0 Kudos

Hi,

U can assign the value of 'IT_MSEG-MJAHR' to a Temporary Variable of type rdoc.

Like,

<b>data : temp like j_1iexchdr-rdoc.</b>

.....

.....

<b>temp = IT_MSEG-MJAHR.</b>

SELECT exnum

exdat

remtime

lifnr

rdoc

budat

FROM j_1iexchdr INTO CORRESPONDING FIELDS OF TABLE it_j_1iexchdr

FOR ALL ENTRIES IN it_mseg

WHERE <b>rdoc = temp</b>

AND ryear = it_mseg-mjahr.

Regards,

Padmam.

Former Member
0 Kudos

data: begin of ty_db.

v_mjahr(length) type c. " type c

end of

SELECT exnum

exdat

remtime

lifnr

rdoc

budat

FROM j_1iexchdr INTO CORRESPONDING FIELDS OF TABLE it_j_1iexchdr

FOR ALL ENTRIES IN it_mseg

WHERE rdoc = it_mseg-mblnr

AND ryear = it_mseg-mjahr

Former Member
0 Kudos

Hi,

Usually this error will occur when we are using the FOR ALL ENTRIES option.

For this you can declare a temporary variable in your first internal table as the type of RYEAR.loop at that table and move the value to that temporary variable.

Now you can use that variable in the where condition.

reward will be helpful.

rgds

harris

mohammed_moqeeth
Active Participant
0 Kudos

Dear Ray,

data element of j_1iexchdr -ryear is J_1IRYEAR1 --> <b>CHAR (data type) 4(data length)</b>

datalement of mseg-mjahr is MJAHR --> <b>NUMC (data type) 4 (data length)</b>

You have to define internal table it_j_1iexchdr with MJAHR as below:

<b>data: begin of it_j_1iexchdr occurs 0,

.......

mjahr(4) type c,

.......

end of it_j_1iexchdr.</b>

<b>Reward Points for useful answers....

Regards,

Moqeeth.</b>