Skip to Content

Avoid convt_no_number

Hello,

I want to avoid a short dump of type convt_no_number.

I've found that solution:

  DATA: gv_to_convert TYPE string VALUE 'abc',
        gv_int        TYPE p LENGTH 6 DECIMALS 3.

  TRY.
      gv_int = gv_to_convert.
    CATCH cx_sy_conversion_no_number.
      WRITE 'not a number'.
  ENDTRY.

Is there another cleaner solution? I'm searching e. g. a method like is_numeric().

Of course I can encapsulate the coding above in a own method ...

But is there any SAP method or function module for that check?

I searched in cl_abap* classes, but I didn't found anything.

Regards

Franz

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on May 11, 2015 at 12:59 PM

    Hi Franz,

    Use the CO operator, ex:

    IF variable CO '0123456789'.

    WRITE: 'Is a number!'.

    ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 11, 2015 at 05:35 PM

    Hi Franz,

    You can use the function module 'CATS_NUMERIC_INPUT_CHECK'

    Regards,

    Yücel Vangölü

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 12, 2015 at 06:49 AM

    Use FM "NUMERIC_CHECK".

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.