Insert "Infinity" value in DF16_DEC column

Viewed 50

I have a table that has column of type DF16_DEC. Since this type is represented by decfloat16 in ABAP and the documentation of this type says that "Infinity" can be a value of this column.

In ABAP invalid decimal floating point numbers are the special values "Infinity", "Inf", "NaN" and "sNaN", which represent infinity or invalid numbers and are designated in standard IEEE-754-2008.

So my question is how can I insert Infinity value in DF16_DEC column either via ABAP or via SE16?

1 Answers

ABAP does not support infinity or NaN values for decfloats (or for regular TYPE f floating point variables, for that matter). Any attempt to generate such a value through mathematical operations will result in a runtime error.

So if you want to put a value in your table which represents "no limit" or "higher than anything you will ever encounter", then the next best option would be to use the highest possible legal values. Which you can find in the constants cl_abap_math=>max_decfloat16 and cl_abap_math=>max_decfloat34 respectively.

Related