‎2007 Apr 16 8:44 AM
Hello Guys..
I am using a character fields in which users enter some numeric value's. The variable I am using to assign the value is off type numeic.
my Problem will be explain here more clearly.
Data : castsd type i,
ATWRT type ausp-ATWRT,
My problem is that since atwart is c type variable. so when users input some wrong value like
castsd = atwart. if users input wrongly atwart as <b>825'</b>
then program is giving dump.
I want to know is there any functional module and any other way through which i check the value if there is any string is there in value then I have to show value as zero.
i have try with CHECK_AND_CONVERT_NUMERICS. but not getting required output.
Please guide me.
Thanks
Swati...
‎2007 Apr 16 8:48 AM
try fm NUMERIC_CHECK for checking numeric value
or
data : text(40) type c value '1233',
len type i,
pos type i.
len = strlen( text ).
do len times.
if text+pos(1) ca '0123456789'.
else.
message<not numeric>
endif.
pos = pos + 1.
enddo.
regards
shiba dutta
Message was edited by:
SHIBA DUTTA
‎2007 Apr 16 8:47 AM
Hi swati,
1. U can use this FM NUMERIC_CHECK
(but this FM is ecc 5.0 onwards only)
regards,
amitm m.
‎2007 Apr 16 8:48 AM
try fm NUMERIC_CHECK for checking numeric value
or
data : text(40) type c value '1233',
len type i,
pos type i.
len = strlen( text ).
do len times.
if text+pos(1) ca '0123456789'.
else.
message<not numeric>
endif.
pos = pos + 1.
enddo.
regards
shiba dutta
Message was edited by:
SHIBA DUTTA
‎2007 Apr 16 9:23 AM
Hai Swati Namdev,
You can validate the value eventhogh you are declared it as char Type like below:
Let the char type variable is w_value.
if w_value co '0123456789'.
do what ever you want.
else.
MESSAGE ' w_val Contains non numeric values',TYPE 'E'.
endif.
Reward points if it helps you.
Regds,
Rama.Pammi