0

I'm currently trying to find a Standard-FM or Class or inbuilt-Function, that can perform a "simple" numeric check. Currently i just do IF val CO '0123456789.,+-'. But thats not really nice.

For example 12,45.64,47-18 would pass this check, while it's clearly not a number. It should return "not a number" in this case. Also what about some other formats, like 123.345,786e13. That is a valid number and should convert.

Same with different formats (. for grouping or , for example, should depent on the environment or User i think). Is there a good way for checking this? It feels to be such a basic task, but i just cant find anything, not even with googling.

5
  • Regex could help you, but you have to specify exactly what you need. I.e. thousand separator dot? decimal coma? etc. Commented Jun 25 at 6:11
  • @JózsefSzikszai Best case would be if that information is extracted from the user profile, but dot as thousand separator and comma as decimal would fit 99 % of our use cases Commented Jun 25 at 10:16
  • 1
    Where does this number come from, what rule do you want concerning the language environment? There could be some specific rules if your number is a currency amount, or if you want to check maximum values, maximum number of digits in the fraction, minus before or after, exponent, etc. For "Dynpro" input (SAP GUI screens), there's the official (released) function module RS_CONV_EX_2_IN. Commented Jun 26 at 17:17
  • I just wanna check if a specific input is numeric. It can come from a csv/excel-Upload, a Database, User-Input in Parameters or somewhere else. Commented Jun 27 at 12:30
  • Why not simply assign the value to a variable of type decfloat34? If the input is not a number, the exception CONVT_NO_NUMBER will be raised Commented Aug 5 at 17:09

1 Answer 1

0

try to assign char-like value to numeric (e.g. decfloat16) and catch exception

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.