11-16-2007 8:59 AM
hi i have a 6 char field .
in that i have to check each character is a char or numeric .
pls help me
11-16-2007 9:02 AM
Hi
declare 2 variables:
data: char(26) type c value 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
num(9) type value '1234567890',
str(6) type c value 'ABF123'.
now use the string comparison paramters like CS,CO,CN etc and check
if str CS char or Str CO num.
.............
endif.
Regards
Anji
11-16-2007 9:02 AM
11-16-2007 9:02 AM
Hi
declare 2 variables:
data: char(26) type c value 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
num(9) type value '1234567890',
str(6) type c value 'ABF123'.
now use the string comparison paramters like CS,CO,CN etc and check
if str CS char or Str CO num.
.............
endif.
Regards
Anji
11-16-2007 9:04 AM
hi Chaaya,
IF string CO '0123456789'.
==> it is number
ELSE.
==> it is something else (i. e. not only numbers)
ELSE.
if you have to do it character by character, than you can do in a DO-ENDDO.
hope thishelps
ec
11-16-2007 9:04 AM
do.
try
if string(sy-index) IN '0123456789'.
write: / string(sy-index) ' is a number'.
else
write: / string(sy-index) ' is not a number'.
catch CX_root.
exit.
endtry.
enddo.
*reward if solved*
11-16-2007 9:05 AM
data: cnt type i value 0.
do 6 times.
if str+cnt(1) CO '0123456789'.
message i000.
endif.
enddo.
Hope dis helps..
Reward if it does
11-16-2007 9:06 AM
Hi,
Try like this:
data: v_string(15) type c value 'BHASKAR2006'.
data : str(10) type c.
str = v_string+0(5).
write str.
if str CA sy-abcde.
write 'Characters'.
else.
write 'Numerics'.
endif.
Regards,
Bhaskar