Application Development and Automation 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: 
Read only

QUANTITY field Validation

Former Member
0 Likes
1,725

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

7 REPLIES 7
Read only

former_member156446
Active Contributor
0 Likes
1,128

At selection-screen.

if lw_bfquant ca '-' or lw_bfquant ca '.' or lw_bfquant not intial.

error...

endif.

Read only

Former Member
0 Likes
1,128

I also want to check that lw_bfquant is a neumeric field, how do i do that ?

Read only

Former Member
0 Likes
1,128

Is this a CHARacter or QUANtity field (which one)?

Rob

Read only

0 Likes
1,128

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.

Read only

0 Likes
1,128

if lw_bfquant ca '0123456789'.

success.

else.

error message.

endif.

Read only

0 Likes
1,128

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

Read only

Former Member
0 Likes
1,128

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