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

Comparision operator

Former Member
0 Likes
677

if move_type_wa-matnr CO '0123456789'.

unpack move_type_wa-matnr to move_type_wa-matnr.

endif.

What is wrong with this code?

Value of matnr is all numbers and it fails the camparision operator. SY-FDPOS is 5 when i debug the program but it skips the unpacking or matter of fact any statement with in the if statement.

Thanks in advance.

Eda

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
645

Try

if move_type_wa-matnr CO '0123456789 '.

unpack move_type_wa-matnr to move_type_wa-matnr.

endif.

*add the space character in '0123456789 ' .

Regards,

ravi

5 REPLIES 5
Read only

Former Member
0 Likes
646

Try

if move_type_wa-matnr CO '0123456789 '.

unpack move_type_wa-matnr to move_type_wa-matnr.

endif.

*add the space character in '0123456789 ' .

Regards,

ravi

Read only

Former Member
0 Likes
645

use <b>condense move_type_wa-matnr</b> before the IF statement

as the length of MATNR is 18 i guess , so there may be spaces , condese and check out

Read only

Former Member
0 Likes
645

Hi,

May be if your field if of type MATNR it contains also space character (" ") before numbers.

So the comparison should be CO ' 0123456789".

Just a guess...

Regards

Sylvain

Read only

Former Member
0 Likes
645

hi KE,

Check whether the move_type_wa-matnr has the same value with which you are comparing and moreover always remember that Contains only (co) [ case sensitive ]

( this any how maynot be the problem ) here .,..

Regards,

Santosh

Read only

Former Member
0 Likes
645

Hi Eda,

I think IF statement with CO is correct but I am expecting the MATNR may contain alphabet character O instead of zero or you placed alphabet character O instead of zero in CO string.

Thanks,

Vinay