SAP Function UNIT_GET - Determines Key of a Unit for Prespecified Translation Factors

Parameter Reference Type Length Default Optional Text
ADD_CONST T006-ADDKO P 5 0 X Additive constant
DECIMALS T006-ANDEC s 2 88 X Number of decimal places for rounding
DENOMINATOR T006-NENNR I 4 Denominator
DIMENSION T006-DIMID C 6 Dimension key
EXPONENT T006-EXP10 s 2 0 X Exponent
NUMERATOR T006-ZAEHL I 4 Numerator

Parameter Reference Type Length Text
UNIT T006-MSEHI C 3 Unit of measurement

Exception Text
UNIT_NOT_FOUND Unit of Measurement with Desired Factor Not Maintained


Functionality
This function module finds the measurement unit with the dimensionDIMENSION, the conversion factors ADD_CONST, NUMERATOR, DENOMINATOR andEXPONENT, and the number of decimal places for rounding DECIMALS.
If the parameter DECIMALS is not passed, a unit with the specifiedfactor and dimension is found.
Example
DATA: UNIT LIKE T006-MSEHI,
DIM LIKE T006-DIMID.
...
CALL FUNCTION 'UNIT_GET'
EXPORTING
ADD_CONST = 0
DECIMALS = 99
DENOMINATOR = 1
DIMENSION = DIM
EXPONENT = 0
NUMERATOR = 3600
IMPORTING
UNIT = UNIT
EXCEPTIONS
UNIT_NOT_FOUND = 01.
Notes
  • If there are several units for a dimension with the same conversion
  • factor, the result is ambiguous.
    • If the parameter DECIMALS is not passed, the function module tries to
    • read the unit with the 'Number of decimals = 99' (no rounding). If noneis found, the first matching table entry is taken.
      INCLUDE 'FU_INF_BUF' OBJECT DOKU ID TX
      Search for the unit which has the specified conversion factorand für which the number of decimal places for rounding equalsDECIMALS.
      If DECIMALS has the value 88 (default), the number of decimal placesis ignored.
      INCLUDE 'FU_SCVU_DIM_INFO' OBJECT DOKU ID TX LANGUAGE D
      INCLUDE 'FU_DIM_INF' OBJECT DOKU ID TX LANGUAGE D