Measures in SAP can be painful to understand, this blogpost dives into the area exposing the logic behind the measures and elaborating how to change from one measure to another. Be warned that there is nothing prohibiting you from converting from meters into kelvin, only your understanding of the usage context will ensure a valid transformation
An example of conversion to a SI unit
1. Simplified formula:
Measurement unit = (N/D) x SI unit
2. Complete formula:
A * measurement unit = (A * N/D * 10**E + K) * SI unit
A = number of measurement units
N = numerator
D = denominator
E = exponent (only required in the case of very large or very small numbers)
K = additive constant (only required for temperature conversions)
Examples
1. Dimension length
Measurement unit mm (millimeter)
SI unit m (meter)
1 mm = (1/1000) * meter
2. Dimension temperature
Measurement unit °F (Fahrenheit)
SI unit K (Kelvin)
32 °F = (32 * 5/9 * 10**0 + 255,37) * K = 273,15 K = 0 °C
Assuming we implemented “Unit of Measure” and “Unit Dimension” as describe in the diagrams attaches to this document then we can transform 1000mg to kg as easy as this
SELECT 1000 AS NETweight,
‘MG’
AS MSEHI
INTO #t
SELECT #t.NETweight*1.0/SIConversionDenominator*SIConversionNumerator, ud.SIUnit
FROM #t
INNER
JOIN UnitOfMeasure uom ON uom.MSEHI=#t.msehi
INNER
JOIN UnitDimension ud ON ud.MSEHI = uom.MSEHI
And should we want to transform from one measure over a SI to another measure, then we can do like this as explained in this example where I convert the 1000mg to Tonn
SELECT #t.NETweight*1.0/uom.SIConversionDenominator*uom.SIConversionNumerator, ud.SIUnit
, #t.NETweight*1.0/uom.SIConversionDenominator*uom.SIConversionNumerator
* uom2.SIConversionDenominator/uom2.SIConversionNumerator
,uom2.InternalUnit
FROM #t
INNER
JOIN UnitOfMeasure uom ON uom.MSEHI=#t.msehi
INNER
JOIN UnitDimension ud ON ud.MSEHI = uom.MSEHI
INNER
JOIN UnitOfMeasure uom2 ON uom2.MSEHI=‘TO’