QUANTITY field is very similar to CURRENCY. The difference here is that you don’t keep currency key here, but unit of measure, for example M for meters or KG for kilograms. Again to show you the difference in output I’ve modified a bit the table entries, this time field DISTANCE from SPFLI table, where I’ve included decimal places for first row.
Figure 22 Changed entries of SPFLI table in SE16
Now to see the differences, please run program ZDEMO_AIN_CL10 using following units: PMR, DEG, M & empty.
Figure 22 displays the values with three decimal places as PMR is setup to be displayed exactly like this.
Figure 23 ZDEMO_AIN_CL10 Results using PMR unit
Figure 23 shows the results when I used DEG unit which shows. In default this unit is set to have one decimal place. As you can see there everywhere where DISTANCE field has less or the same number of decimal places then it’s always shown with one decimal place (even, if after comma there is an 0). In case the quantity value contains more decimal places, like on the first row, then the value is displayed fully as written into internal table.
Figure 24 ZDEMO_AIN_CL10 Results using DEG unit
The same situation you can see if you use meters. No decimal places are visible in the rows for which the value doesn’t have any decimals, but if it’s the case then the full value is displayed.
Figure 25 ZDEMO_AIN_CL10 Results using M unit
At last I have run ZDEMO_AIN_CL10 without using any unit. As expected the internal value is displayed exactly like stored in internal table, so with four decimal places.
Figure 26 ZDEMO_AIN_CL10 Results without filling unit