11-13-2007 10:21 PM
Hi All
I want to validate a field with digits only ( 0 to 9) . If it contains other than 0 to 9 digits like special characters then it should fail.
for e.g. : 384746 should be true
384-746 should be false.
If I use CA operand then it throws true even for 384-746 value
Can anybody let us know how to achieve it ? is there any FM available .
I got it with some extra logic to find it out whether it is a numeric or not BUT I need a direct method , one step validation
Responses are highly appreciated .
Satya
11-13-2007 10:33 PM
11-13-2007 10:33 PM
11-14-2007 12:01 AM
Hi
Thanks for ur response
If f1 = 65883 then it is fine
if f1 = 659-675 then it should fail
The above condition should execute .there are some cases where special characters are possible.
11-14-2007 12:09 AM
Hi,
The code provided by Rob will work in the cases you provided. What is the issue then.
Regards,
Atish
11-14-2007 1:04 AM
11-13-2007 10:34 PM
Try like this:
[code]REPORT ZTEST_NP.
parameters: l_text(10) type c.
data: l_num(12) type c value '-+=@#$%^&*()'.
if l_text ca l_num.
write: 'false'.
else.
write: 'true'.
endif.[/code]
Regards,
Naimesh Patel
11-13-2007 10:34 PM
Hi Satya,
try like this
if field CO '0123456789'.
then process...
else.
exit.
endif.
Reward points if it helps,
Satish
05-11-2010 7:31 AM