如何解决运行时生成程序转储ID:BCD_OVERFLOW时发生内部错误
解决方法
如果您尝试为数字属性或变量分配值,则该问题会出现在任何ABAP代码中,该值“超出范围”(因此导致溢出)。此处查看所有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,647
int8 -9,223,372,036,854,775,808 to +9,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.
最小的可复制示例:
REPORT ztest.
DATA num TYPE int1.
num = 1000. " <=== run time error
解决方案是使用更大的数据类型,例如int2
(最多32767)或I
(4字节整数):
REPORT ztest.
DATA num TYPE int2. " <=== larger type
num = 1000. " <=== no more error
注意:decfloat34
是可能的较大数字数据类型,它实际上可以处理任何值。
方法,功能模块或报告中也可能出现此问题。 此问题背后的主要原因是代码中存在的属性的运行时配置。 例如, 数据:num类型int1值256。
该语句在语法上很好,但是分配给变量num的值大于类型INT1的范围。因此它将仅在激活时转储。
解决方案: 数据:num类型int1值{
类似地,在编译时和运行时配置冲突的任何情况下都可能发生此错误。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。