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

Problem in comparing two character fields

Former Member
0 Likes
898

Hi Everybody,

I have to compare two fields. Like CDPOS-NEW and CDPOS-OLD. These are character fields. I am getting error in Extended ProgramCheck as following

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

(Message can be hidden using: "#EC PORTABLE).

But Actually those 2 field values(CDPOS-NEW and CDPOS-OLD.) in CDPOS table ,are date fields .What I should I do to compare these two fields which are in character format.

Thanks,

Suresh.

3 REPLIES 3
Read only

Former Member
0 Likes
583

hi

DATA : a TYPE char10 VALUE 'DBCD',

b TYPE char10 VALUE '4234',

c TYPE char10 VALUE '3456',

d TYPE char10 VALUE 'ADA',

e TYPE char10 VALUE '234567'.

IF b GT c. "this case checks for numeric values

WRITE 😕 'B is bigger'.

ELSE.

WRITE 😕 'C is bigger'.

ENDIF.

IF a GT d. "this case checks for alphbetical order

WRITE 😕 'A is bigger'.

ELSE.

WRITE 😕 'D is bigger'.

ENDIF.

IF strlen( a ) GT strlen( d ). "this case checks for no of chars

WRITE 😕 'A is bigger'.

ELSE.

WRITE 😕 'D is bigger'.

ENDIF.

IF a GT c. "this case first alph then numerics

WRITE 😕 'A is bigger'.

ELSE.

WRITE 😕 'D is bigger'.

ENDIF.

regards

karthik

Read only

Former Member
0 Likes
583

If I got you right, it might work if you move the data to help-fields typed as date and compare these fields instead of the character fields.

Read only

Former Member
0 Likes
583

Hi

Use the function module to compare two date values rather then comparing them directly

Regards,

Prashant