Manoj Patidar
Manoj Patidar

Reputation: 53

Internal error occurred during runtime generation of Program Dump ID: BCD_OVERFLOW

Internal error occurred during runtime generation of Program (Dump ID: BCD_OVERFLOW)

No error during check but activation gives this error.

Upvotes: 0

Views: 1936

Answers (2)

Sandra Rossi
Sandra Rossi

Reputation: 13639

This issue occurs in any ABAP code if you try to assign a value to a numeric attribute or variable, which is "out of range" (so leads to an overflow). See here all the possible value range for numeric types:

Type        Value Range
----------  ------------------------------------------------------------------------------
b           0 to 255
s           -32,768 to +32,767
i           -2,147,483,648 to +2,147,483,647
int8        -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807
p           The valid length for packed numbers is between 1 and 16 bytes. Two places are 
            packed into one byte, where the last byte contains only one place and the sign,
            which is the number of places or places calculated from 2 * len1. After the 
            decimal separator, up to 14 decimal places are allowed ( the number of decimal 
            places should not exceed the number of places). Depending on the field length 
            len and the number of decimal places dec, the value range is: (-10^(2len-1) 
            +1) / (10^(+dec)) to (+10^(2len-1) -1) /(10^(+dec)) in increments of 10^(-dec).
            Any intermediate values are rounded decimally. Invalid content produces undefined 
            behavior.
decfloat16  Decimal floating point numbers of this type are represented internally with 16 
            places in accordance with the IEEE-754-2008 standard. Valid values are numbers 
            between 1E385(1E-16 - 1) and -1E-383 for the negative range, 0 and +1E-383 to 
            1E385(1 - 1E-16) for the positive range. Values between the ranges form the 
            subnormal range and are rounded. Outside of the subnormal range, each 16-digit 
            decimal number can be represented exactly with a decimal floating point number 
            of this type.
decfloat34  Decimal floating point numbers of this type are represented internally with 34 
            places in accordance with the IEEE-754-2008 standard. Valid values are numbers 
            between 1E6145(1E-34 - 1) and -1E-6143 for the negative range, 0 to +1E-6143 
            and 1E6145(1 - 1E-34) for the positive range. Values between the ranges form 
            the subnormal range and are rounded. Outside of the subnormal range, each 
            34-digit decimal number can be represented exactly using a decimal floating 
            point number.
f           Binary floating point numbers are represented internally according to the 
            IEEE-754 standard (double precision). In ABAP, 17 places are represented (one 
            integer digit and 16 decimal places). Valid values are numbers between 
            -1.7976931348623157E+308 and -2.2250738585072014E-308 for the negative range 
            and between +2.2250738585072014E-308 and +1.7976931348623157E+308 for the
            positive range, plus 0. Both validity intervals are extended to the value zero 
            by subnormal numbers according to IEEE-754. Not every sixteen-digit number can
            be represented exactly by a binary floating point number.

Minimal reproducible example:

REPORT ztest.
DATA num TYPE int1.
num = 1000.          " <=== run time error

The solution is to use a larger data type like int2 (up to 32767) or I (integer on 4 bytes):

REPORT ztest.
DATA num TYPE int2. " <=== larger type
num = 1000.         " <=== no more error

NB: decfloat34 is the larger possible numeric data type, it can handle virtually any value.

Upvotes: 2

Manoj Patidar
Manoj Patidar

Reputation: 53

This issue can occur in methods, Function modules, or in Report also. The main reason behind this issue is the runtime configuration of attributes present in code. For example, DATA: num type int1 value 256.

This statement is syntactically fine but the value that is being assigned to variable num is more than the range of type INT1. So it will dump while activation only.

Solution: DATA: num type int1 value {<=255}

Similarly, this error can occur in any case where the compile-time and runtime configuration conflict.

Upvotes: 0

Related Questions