Functionality This function module converts an input value of type F into an outputvalue of type P with any number of decimal places, whereby the quantityis automatically converted into the next appropriate unit in the samedimension and measurement unit family if field overflow or too large arounding error occur. If the rounding error is too big, the conversion uses a smallermeasurement unit (e.g. from km to m). If the input value is too big for the output value (field overflow), theuses a larger measurement unit (e.g. from m to km). If thevalue is too big even for the largest measurement unit, 'X' is set inthe parameter OVERFLOW and the maximum value in the parameter OUTPUT. The accepted rounding error can be specifed in the parameter TOLERANCE.The relative variance is checked against the inverse ofthis parameter. If, e.g. the value of TOLERANCE = 1000 and the rounding error is greater1/1000, the conversion uses a smaller unit. Example: The value 1,004 M is to be put in a field with two decimal places.There is a rounding error of (1,004 - 1) / 1,004, which isapproximately 4/1000. In this case the conversion is to cm and therounding error is eliminated (100,40 cm). If no input value measurement unit is passed, the SI unit is assumed. If no output value measurement unit is passed, the conversion tries toremain in the input value measurement unit. Example The value F_VALUE is to be passed to the field P_VALUE. The roundingerror is to be < 0,1 % (1/1000). data: f_value type f, ind_overflow(1) type c p_value type p decimals 3, tol type i value 1000, unit_in like t006-msehi, unit_out like t006-msehi. ... call function 'UNIT_QUANTITY_SWITCH' exporting imp_unit = unit_in imp_value = f_value tolerance = tol importing exp_value = p_value overflow = ind_overflow changing exp_unit = unit_out exceptions type_not_p = 01 unit_not_found = 02. |