ABAP by numbers: Length of decimal type

Inequality between length and maximum digit count of packed decimal type causes great confusion even among seasoned developers. ABAPDOCU explains the relation with a fairly complicated formula:

Depending on the field length len and the number of decimal places dec, the following applies to the value range: (-10^(2len-1) +1) / (10^(+dec)) to (+10^(2len-1) -1) /(10^(+dec)) in increments of 10^(-dec)

Continue reading “ABAP by numbers: Length of decimal type”