Create a Unit Conversion Column in a Graphical View

You can convert unit values into another unity using a calculated column containing the CONVERT_UNIT function. For example, you may want to convert inches to centimetres or pounds to kilograms.

Context

To do unit conversion, the following tables must be available in your space:
  • T006

  • T006D

These tables should be imported from an SAP system via flows or as remote tables (see Acquiring Data).

For more information and examples, see the blog SAP Datasphere Unit ConversionInformation published on SAP site (published in August 2023).

Procedure

  1. In a Calculated Columns node, click (Add New Calculated Column) to create a new column.
  2. Enter a Business Name and a Technical Name for the column, and specify an appropriate numerical Data Type.
  3. Enter the CONVERT_UNIT function into the expression field:
    CONVERT_UNIT("QUANTITY"=>"<Quantity>", 
        "SOURCE_UNIT" =>'<Source_Unit>', 
        "SCHEMA" => '<Space>', 
        "TARGET_UNIT" => '<Target_Unit>', 
        "ERROR_HANDLING"=>'<Error_Handling>', 
        "CLIENT" => '<Client>')
    For detailed information, see CONVERT_UNIT Function (Miscellaneous) in the SAP HANA documentation.
    Complete the values as follows:

    Parameter

    Description

    Quantity

    Enter the column to convert.

    Source Unit

    Enter one of the following:

    • The technical name of the column containing the source unit.

    • The value of the code for the source unit, as given in the Unit of Measurement column (MSEHI) in table T006. For example:

      • IN - Inches

      • CM - Centimetres

      • LB - Pounds

      • KG - Kilograms

    Schema

    Enter the technical name of your space.

    Target Unit

    Enter one of the following:

    • The technical name of the column containing the target unit.

    • The value of the code for the target unit.

    Error Handling

    Enter one of the following:

    • fail on error [default] - Return an error.

    • set to null - Set the target value to NULL.

    • keep unconverted - Set the target value to the unconverted source value.

    Client

    Enter the value of your SAP client.

    If you are unsure of the value to set, review the Client column (MANDT) in table T006.

  4. Click (Preview Data) to open the Data Preview panel and review the data output by the column.