Skip to content

CONVT_NO_NUMBER

Unable to interpret "X" as a number.

A classic ABAP runtime error: you tried to move a string into a numeric field, but the string contains characters that aren't digits.

Symptom

ST22 shows:

Runtime Errors         CONVT_NO_NUMBER
Exception              CX_SY_CONVERSION_NO_NUMBER
Short text             Unable to interpret "ABC" as a number.

The dump points to a line that assigns or computes with a string value.

Cause

ABAP implicitly converts character types to numeric types when you assign one to the other. If the source string contains anything other than digits (and an optional leading sign or decimal separator), the runtime gives up and throws this dump.

Common triggers:

  • Reading a field from a flat file (CSV, Excel) where one row has a header value or stray text in a numeric column.
  • User input from a screen field where the dictionary type is CHAR but the variable receiving it is INT4, P, F, etc.
  • String concatenation that accidentally pulls in spaces or letters before a numeric conversion.
  • Decimal/thousand separators that don't match the user's locale (1,234.56 vs 1.234,56).

Reproduce

DATA lv_amount TYPE p DECIMALS 2.
DATA lv_input  TYPE string VALUE 'ABC'.

lv_amount = lv_input.   " <-- dumps here

Fix

Validate the string before assigning it. Two clean approaches:

DATA lv_amount TYPE p DECIMALS 2.
DATA lv_input  TYPE string VALUE '123.45'.

IF lv_input CO '0123456789.-'.
  lv_amount = lv_input.
ELSE.
  " handle invalid input
ENDIF.
DATA lv_amount TYPE p DECIMALS 2.
DATA lv_input  TYPE string VALUE 'ABC'.

TRY.
    lv_amount = lv_input.
  CATCH cx_sy_conversion_no_number INTO DATA(lx_conv).
    MESSAGE lx_conv->get_text( ) TYPE 'I'.
ENDTRY.

For locale-sensitive numbers (commas, dots), use CONVERT_STRING_TO_AMOUNT or normalise the separator yourself:

REPLACE ALL OCCURRENCES OF ',' IN lv_input WITH '.'.

Prevention

  • When reading external data (file, BAPI, web service), never trust the input — validate every numeric column.
  • Skip header rows explicitly when parsing CSV/Excel uploads.
  • For user input, define screen fields with the correct dictionary type so the framework converts and validates for you.
  • Wrap risky conversions in TRY ... CATCH cx_sy_conversion_no_number and log the offending row so the user knows which record failed.

See also

Comments