Ansicht
Dokumentation

CONVERSION_FACTOR_GET - Measurement unit conversion: Get measurement unit conversion factor

CONVERSION_FACTOR_GET - Measurement unit conversion: Get measurement unit conversion factor

PERFORM Short Reference   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.
SAP E-Book
Functionality

This function module determines the factors for the conversion of a measurement unit into another using the measurement unit table. Only measurement units in the same dimension can be converted. Units without a dimension can not be converted using the measurement unit table.

This module also provides the number of decimal places to which the values in the unit UNIT_OUT are to be rounded. This also applies to units without a dimension, if UNIT_IN = SPACE.

The module also provides the dimension of the unit UNIT_OUT.

The following formula applies to the conversion:

(UNIT_OUT unit value) = (UNIT_IN unit value) * numerator/denominator + additive constant.

Example

DATA: UNIT_1 LIKE T006-MSEHI,
      UNIT_2 LIKE T006-MSEHI,
      VAR1   TYPE F,
      VAR2   TYPE F,
      VAR3   TYPE F,
      VAR4   LIKE T006-ANDEC,
      DIMID  LIKE T006-DIMID.
...
CALL FUNCTION 'CONVERSION_FACTOR_GET'
     EXPORTING
         UNIT_IN      = UNIT_1
         UNIT_OUT     = UNIT_2
         NO_TYP_CHECK = ' '
     IMPORTING
         ADD_CONST   = VAR1
         DENOMINATOR = VAR2
         NUMERATOR   = VAR3
         DECIMALS    = VAR4
         DIMENSION   = DIMID
     EXCEPTIONS
         CONVERSION_NOT_FOUND    = 01
         OVERFLOW                = 02
         TYPE_INVALID            = 03
         UNITS_MISSING           = 04
         UNIT_IN_NOT_FOUND       = 05
         UNIT_OUT_NOT_FOUND      = 06.

Notes
  • The types of the fields additive constant, numerator and denomir are checked. If these parameters are not specified, the type check must be deactivated with NO_TYP_CHECK = 'X'.
  • Ensure that the fields for the conversion factors are large enough. It is generally not sufficient to use the factor field sizes in the conversion factor tables. A combination of several factors can make the results larger.
It is advisable to use floating point numbers (type F).
  • The use of packed fields is much more expensive than floating point numbers (type F), which should therefore be used whenever possible.
  • All function modules in this group are selectively buffered by default. This internal table buffering can be disactivated with the function module BUFFER_CONTROL or switched to 'complete buffering'.




Parameters

ADD_CONST
DECIMALS
DENOMINATOR
DIMENSION
NO_TYPE_CHECK
NUMERATOR
UNIT_IN
UNIT_OUT

Exceptions

CONVERSION_NOT_FOUND
OVERFLOW
TYPE_INVALID
UNITS_MISSING
UNIT_IN_NOT_FOUND
UNIT_OUT_NOT_FOUND

Function Group

SCV0

TXBHW - Original Tax Base Amount in Local Currency   rdisp/max_wprun_time - Maximum work process run time  
This documentation is copyright by SAP AG.

Length: 5169 Date: 20240523 Time: 114044     sap01-206 ( 51 ms )