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 of character type field

Former Member
0 Kudos

hello expert,

i want to compare a character type field without using operator like ge, ne etc.

plz help me if you know.

thanks in advance

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

There are special comparisons that you can apply to strings with types C, D, N, and T :

CO Contains Only

CN Contains Not only

CA Contains Any

NA contains Not Any

CS Contains String

NS contains No String

CP Contains Pattern

NP contains No Pattern.

thanx.

Edited by: Dhanashri Pawar on Sep 17, 2008 12:11 PM

7 REPLIES 7

Former Member
0 Kudos

Hi,

There are special comparisons that you can apply to strings with types C, D, N, and T :

CO Contains Only

CN Contains Not only

CA Contains Any

NA contains Not Any

CS Contains String

NS contains No String

CP Contains Pattern

NP contains No Pattern.

thanx.

Edited by: Dhanashri Pawar on Sep 17, 2008 12:11 PM

Former Member
0 Kudos

hi pawar.

i want to compare character type field like low ge high. it works but in codeinspector is not allowed that it shows error......

Edited by: abhishek vishnoi on Sep 17, 2008 12:14 PM

Former Member
0 Kudos

unanswered

Mohamed_Mukhtar
Active Contributor
0 Kudos

Hi,

Go through this link

[comparision|http://help.sap.com/saphelp_nw04/Helpdata/EN/fc/eb3516358411d1829f0000e829fbfe/content.htm]

Regards,

0 Kudos

helllo expert,

i want to compare 23 & 24 which is character type....

how i comapare that...........if i use ge ne etc it works but code inspector shows as an error

Former Member
0 Kudos

Hi,

If it is character type. it will compare like this

For operands with a character-type data type (c, d, n, t, string) the contents are compared from left to right. Based on the order in the code page used, the first different character from the left decides which operand is larger.

let try this example you will get wrong output

data : lv_field1 type char2 value '2',

lv_field2 type char2 value '12'.

if lv_field1 GT lv_field2.

write : / 'test'.

endif.

So assing the values to some integer varaibles and compare then it will work fine.

Hope it will helps

Former Member
0 Kudos

answered