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: 

Comparision Problem

Former Member
0 Kudos

Hi

all

i m comparing these two fields

w_lifnr_aval GT c_9000000000.

where

w_lifnr_aval

LIKE lfa1-lifnr, "account no of vendor

c_9000000000(12)

TYPE c VALUE '9000000000',"high range

i m getting following warning--

Greater than/less than comparisons with character type operands may not be portable

i have also changed type of C_900000000000 to LIKE lfa1-lifnr

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Greater than/less than comparisons with character type operands may not be portable

answer is in warning message..

how can u comapare char value just think can u say kishan(char) is greter than saurabh(char).and ur lifnr is char type.

this is mathmatical operation u can use it for only number type(I,N,D,T) comparison.

4 REPLIES 4

dani_mn
Active Contributor
0 Kudos

Hi,

You are comparing charactar values for greater and less. which is logically a wrong thing.

Try to use numeric field type instead.

If you are comparing for GE or LE.

Regards,

Wasim Ahmed

Former Member
0 Kudos

Greater than/less than comparisons with character type operands may not be portable

answer is in warning message..

how can u comapare char value just think can u say kishan(char) is greter than saurabh(char).and ur lifnr is char type.

this is mathmatical operation u can use it for only number type(I,N,D,T) comparison.

0 Kudos

i have converted both fields into type I

now it is not showing warning but c_9000000000

is too long so

Warning..

VALUE specified too long for field C_9000000000

Length of field : 1

Length of VALUE spec. : 10

VALUE : '9000000000'

0 Kudos

data: d1(10) type n.

data: d2(10) type n.

d1 = 9000000000 .

d2 = 9000000001.

if d2 > d1.

write : d2.

endif.

<b>and y ur program not work...</b>

Type I values are integers in the range +/- 2 billion, or, exactly, from -2147483648 to 2147483647. Intermediate results in type I expressions are stored in type I auxiliary fields. Otherwise, type I arithmetic is similar to performing calculations with type P fields without decimal places; division (using the operator /) rounds numbers rather than truncating them. Overflow results in a runtime error.

Type I is typically used for counters, quantities, indexes and offsets such as time periods.