‎2008 Feb 11 8:50 PM
Hi,
I have a field lw_bfquant , once the user enters a value for quantity on the screen, I want to check that this field is not zero, not negative and doesnot have decimals .what code should I write for this?
<REMOVED BY MODERATOR>
Thanks.
Deepti.
Edited by: Alvaro Tejada Galindo on Feb 11, 2008 4:50 PM
‎2008 Feb 11 8:58 PM
At selection-screen.
if lw_bfquant ca '-' or lw_bfquant ca '.' or lw_bfquant not intial.
error...
endif.
‎2008 Feb 11 9:03 PM
I also want to check that lw_bfquant is a neumeric field, how do i do that ?
‎2008 Feb 11 9:16 PM
‎2008 Feb 11 9:20 PM
lw_bfquant is a quantity field referring to data element ERFMG.
User enters a value on screen and now I want to check that it is a numeric field and doesn't have any characters or alphanumerics in that.
‎2008 Feb 11 9:28 PM
if lw_bfquant ca '0123456789'.
success.
else.
error message.
endif.
‎2008 Feb 11 9:31 PM
Try this:
REPORT ztest LINE-SIZE 80 MESSAGE-ID 00.
PARAMETERS bfquant TYPE erfmg.
DATA: rem(5) TYPE p DECIMALS 3.
* No need to check for negative - not allowed in ERFMG
IF NOT bfquant > 0.
MESSAGE e001 WITH 'Quantity must be greater than 0'.
ENDIF.
rem = bfquant MOD '1'.
IF rem <> 0.
MESSAGE e001 WITH 'No decimals allowed'.
ENDIF.I think all the other solutions only work for character fields. You can only enter numerics into quantity fields, so you don't have to check that..
Rob
Edited by: Rob Burbank on Feb 11, 2008 4:33 PM
‎2008 Feb 11 10:15 PM
I see you have marked this question as "solved" but have not assigned any points or even a "Thanks". Did you solve it on your own? Did none of the suggestions help?
Rob