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: 

check var

Former Member
0 Kudos
97

is there a way to know if a var contain char or digits ?

1 ACCEPTED SOLUTION

Former Member
0 Kudos
65

Hi,

try : C14W_CHAR_NUMBER_CONVERSION

6 REPLIES 6

rejish_balakrishnan
Contributor
0 Kudos
65

HI,

U can use CO(contains only operator to analysis it_

If var CO '1234567890'.

flag = digits.

endif.

and.

if var CO sy-abcde "abcdefg......z"

flag = char.

endif.

amit_khare
Active Contributor
0 Kudos
65

For digits you can check -

if var co '1234567890'.

for character you may check

if var CO sy-abcde.

Former Member
0 Kudos
66

Hi,

try : C14W_CHAR_NUMBER_CONVERSION

Former Member
0 Kudos
65
Data: w_no(10) type n
parameters: w_char(20) type .


W_no = w_char.

If w_no is initial.
Write : / W_char, 'Contains Characters'.
Else.
Write : / W_char, 'Contains Numbers'.
Endif.

Or.

Check for w_char CO '1234567890' and w_char co SY-ABCDE.

Regards,

Gurpreet

Former Member
0 Kudos
65

hi,

also u can use

FM :

NUMERIC_CHECK

or you can use tghis logic

If string CO '0123456789' .

message only numbers.

endif.

if string CA sy-abcde.

message only letters.

endif.

Also refer the following thread:

thanks

Former Member
0 Kudos
65

Hi ,

You can check like:

-> create one range for checking digits:

r_digit type i.

r_digit-low = 0.

r_digit-high = 9.

r_digit-sign = BT.

append r_digit.

->Then write:

var1( variable name) CA(Contains any) sy-abcde or r_digit.

Hope it helps

Regrds

Mansi