Application Development 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: 

Quantity, Currency and Numeric Fields format Check

Former Member
0 Kudos

Hi,

I have designed a Screen where I do have fields of Quantity, Currency and Numeric type.

User can pass '/' to these fields in the screen. But as these are Quantity, Currency and Numeric type, when '/' is passed it gives error message.

Now I have changed these fields to the CHAR type.

But the general Validations that occurs in these Fields should be done like if we enter alphabets (a,b,c etc) error message should be displayed.

Can anyone let me know how to check this?

Do we have any function module?

Regards,

Shravan G

2 REPLIES 2

SuhaSaha
Advisor
Advisor
0 Kudos
PARAMETERS: p_num TYPE char10.

AT SELECTION-SCREEN.

IF p_num CN '0123456789,.'.
  MESSAGE 'Field is numeric. Please correct your input' TYPE 'E'.
ENDIF.

Edited by: Suhas Saha on Jun 10, 2010 11:17 AM

gerd_rother
Active Participant
0 Kudos

Hi,

You can achieve it like this:


parameters: input type char10.
data: quantity(8) type p.   " here you put your actual numeric field

at selection-screen on input.

if input = '/'.
*   do something in case of slash - probably nothing for this is just the input check
else.
        try.
                quantity = input.
        catch cx_sy_conversion_error.
                 message 'Enter numeric value or slash'(001) type 'E'.
        endtry.
endif.

Regards, Gerd Rother