2007 Sep 19 2:03 PM
Hi all,
can you please provide me the name of the function module to validate input value.
I have a case where i have to validate decimal values. sometimes users may enter wrong decimal values by mistake instead of "0.23" "0..23' and it gives CONVT_NO_NUMBER runtime error so have to come up with some solutions to validate user input.
Please provide me Function module if anybody knows.
Thanks,
2007 Sep 19 2:07 PM
Try this one
data: lv_htype TYPE dd01v-datatype.
CALL FUNCTION 'NUMERIC_CHECK'
EXPORTING
string_in = my_number
IMPORTING
htype = lv_htype.
IF lv_htype NE 'NUMC'.
Raise an error here...
ENDIF.
2007 Sep 19 2:13 PM
Hi,
Thanks for the reply but how about decimal values. i have to check on decimal values like if user inputs 0..23 instead of 0.23 it should not raise an system error. with 0.23 also it gives as CHAR.
Thanks,
2007 Sep 19 2:37 PM
Hi,
While declaring the numeric fields use the below code, this validation will be taken care by SAP itself ;
parameter : dmbtr like bsis-dmbtr.
Thanks,
Sriram Ponna.
2007 Sep 19 2:21 PM
The standard format checks are taken care by the SAP system itself one need not to validate them.
Ex:
parameters:
p_pack type p decimals 3.
Now, if u try to execute the program with incorrect data ( Ex :0..234 or 0.2345 ) the system itself throws an error message
2015 Aug 27 5:09 AM
Use FM CATS_NUMERIC_INPUT_CHECK
If you maintaining different floating point, assign INTERNAL as 'X'.
2016 Jul 13 6:59 AM
I had the same requirement and this worked for me... Thanks!
2015 Aug 27 5:31 AM
Hi,
Use try and catch for handling the exceptions and show exception message to user.
exception class : - CX_SY_CONVERSION_NO_NUMBER
2015 Aug 27 6:10 AM
Hi,
Use Split statement on decimal '.' .
if value are going into three variables then it's wrong input.
Example.
V1 = '0.23'
Split V1 into V2 V3 V4 .
if V4 IS INITIAL .
"CORRECT ".
ELSE.
"WRONG "
ENDIF.
Check for V1 = '0..24'
value will come in V4 variable .
Regards,
Salil