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: 

Diffrent length when Comparing

Former Member
0 Kudos

Hi All,

I am using below field in intrenal table . when I am writing for all entries in it_tab1 which contains the 'matnr' field .

OBJKT LIKE AEOI-OBJKT.

SELECT AENNR

AETYP

OBJKT

REVLV

FROM AEOI

INTO TABLE IT_AEOI

FOR ALL ENTRIES IN it_tab1

WHERE AENNR EQ it_tab1-AENNR

AND AETYP EQ '41'

AND OBJKT EQ it_tab1-matnr.

IF SY-SUBRC = 0.

SORT IT_AEOI BY AENNR OBJKT.

ENDIF.

But The problem is OBJKT length is 40 char , but comparing MATNR is 18 chars. it is giving like error.

When using the addition "FOR ALL ENTRIES IN itab", the fields "OBJKT"

and "it_tab-MATNR" must have the same type and length.

But I should comparing with matnr only.

How do i coorect this.

regards,

Ajay

1 ACCEPTED SOLUTION

former_member181962
Active Contributor
0 Kudos

Hi Ajay,

You should have a extra field in your it_tab1 as type OBJKT and fill that value with same value as in matnr.

loop at it_tab1.

move it_tab1-matnr to itab-OBJKT.

modify it_tab1 index sy-tabix.

clear it_tab1.

endloop.

SELECT AENNR

AETYP

OBJKT

REVLV

FROM AEOI

INTO TABLE IT_AEOI

FOR ALL ENTRIES IN it_tab1

WHERE AENNR EQ it_tab1-AENNR

AND AETYP EQ '41'

AND OBJKT EQ it_tab1-OBJKT.

IF SY-SUBRC = 0.

SORT IT_AEOI BY AENNR OBJKT.

ENDIF.

2 REPLIES 2

former_member181962
Active Contributor
0 Kudos

Hi Ajay,

You should have a extra field in your it_tab1 as type OBJKT and fill that value with same value as in matnr.

loop at it_tab1.

move it_tab1-matnr to itab-OBJKT.

modify it_tab1 index sy-tabix.

clear it_tab1.

endloop.

SELECT AENNR

AETYP

OBJKT

REVLV

FROM AEOI

INTO TABLE IT_AEOI

FOR ALL ENTRIES IN it_tab1

WHERE AENNR EQ it_tab1-AENNR

AND AETYP EQ '41'

AND OBJKT EQ it_tab1-OBJKT.

IF SY-SUBRC = 0.

SORT IT_AEOI BY AENNR OBJKT.

ENDIF.

0 Kudos

Solved .

Thanks ravi

regards,

Ajay