‎2009 Feb 25 8:32 AM
Hi,
Could any post solution for given below requirement.
I have to design validation logic for a selection-screen where I need to input only Numeric values for a field so that it should give an error message if I enter Non-Numeric values.
Thanks,
G sandeep.
‎2009 Feb 25 8:36 AM
declare the parameters as type N
parameters : p_numc(10) type N.
Here U can only enter numeric's .. u cannot enter non-numeric values
‎2009 Feb 25 8:36 AM
declare the parameters as type N
parameters : p_numc(10) type N.
Here U can only enter numeric's .. u cannot enter non-numeric values
‎2009 Feb 25 8:37 AM
Hi,
Please Test the following Sample Code.
PARAMETERS: pstring TYPE string.
AT SELECTION-SCREEN.
IF pstring CA '1234567890'.
MESSAGE 'You enter Nomaric' TYPE 'I'.
ENDIF.Test following Too for Non Nomaric
PARAMETERS: pstring TYPE string.
AT SELECTION-SCREEN.
IF pstring CN '1234567890'.
MESSAGE 'You enter NON Nomaric' TYPE 'I'.
ENDIF.Hope will solve out your problem,
Kind Regards,
Faisal
‎2009 Feb 25 8:39 AM
HI,
You can declare the field as Numeric..
Parameter : p_field(10) type N.
OR
Parameter : p_field(10) type C.
AT Selection-screen on p_field.
If NOT p_field CO '1234567890'.
" Error Message.
ENDIF.
‎2009 Feb 25 8:42 AM
Hi Sandeep,
You can achieve that by either:
1. create a select-option which refer to integer data type. By default SAP will do automatic checking of the input against the data type, or
2. Create your own validation using event AT SELECTION SCREEN ON <select-option>.
LOOP at <select-option>.
IF NOT <select-option>-low CO '1234567890'.
throw the message
ENDIF.
IF NOT <select-option>-high CO '1234567890'.
throw the message
ENDIF.
ENDLOOP.
Regards,
Lim...
‎2009 Feb 25 8:50 AM
Hi,
Define the parameter type as 'N', So when you are entering non numaric value in that selection screen it doesnt allow you
Regards
Ramakrishna Pathi
‎2009 Feb 25 8:58 AM
PARAMETER p_numc TYPE string.
AT SELECTION-SCREEN.
DATA: lw_out TYPE string,
lw_htype TYPE dd01v-datatype.
CALL FUNCTION 'NUMERIC_CHECK'
EXPORTING
string_in = p_numc
IMPORTING
string_out = lw_out
htype = lw_htype.
CHECK lw_htype <> 'NUMC'.
ERROR MESSAGE
‎2009 Feb 25 9:26 AM
hi,
Declare the parameter as N i.e numeric.
This will not allow ant non- numeric values.
Thanks
Suraj
‎2009 Feb 25 9:35 AM
Hi,
U can use the FM 'NUMERIC_CHECK'.
The import parameter is STRING_IN. If u are entering numeric values, like 0 to 9..it will display the output parameter STRING_OUT as inputed number padded with zeros and HTYPE as NUMC, which means the value entered is numeric.
If u enter any non numeric value, this will output the HTYPE value as CHAR.
Keerthi.