Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

need an exmaple for UNIT_CONVERSION

Former Member
0 Likes
750

Hi,

Whats the use of UNIT_CONVERSION can anyone ples send me an example of "UNIT_CONVERSION" function module

Regards

Avi..

Message was edited by:

Avi

Hi,

Whats the use of UNIT_CONVERSION can anyone ples send me an example of "UNIT_CONVERSION" function module

Regards

Avi..

Message was edited by:

Avi

5 REPLIES 5
Read only

Former Member
0 Likes
720
call function 'UNIT_CONVERSION_SIMPLE'
    exporting
      input                      = itab-qty
*   NO_TYPE_CHECK              = 'X'
*   ROUND_SIGN                 = ' '
     unit_in                    = itab-vrkme
     unit_out                   = 'EA'
  importing
*   ADD_CONST                  =
*   DECIMALS                   =
*   DENOMINATOR                =
*   NUMERATOR                  =
     output                     = itab-qty
* EXCEPTIONS
*   CONVERSION_NOT_FOUND       = 1
*   DIVISION_BY_ZERO           = 2
*   INPUT_INVALID              = 3
*   OUTPUT_INVALID             = 4
*   OVERFLOW                   = 5
*   TYPE_INVALID               = 6
*   UNITS_MISSING              = 7
*   UNIT_IN_NOT_FOUND          = 8
*   UNIT_OUT_NOT_FOUND         = 9
*   OTHERS                     = 10
            .
Read only

Former Member
0 Likes
720

Hi Avi

Please reffer standard report RMLIFO22 for UNIT_CONVERSION.

Welcome with reward points.

Regards

Navin

Read only

Former Member
0 Likes
720

This FM converts values from one measurement unit to another and rounds

the result to the number of decimal places maintained in the measurement

unit table, if necessary. The rounding is up ('+'), down ('-'),

commercial ('X') or no rounding (SPACE), depending on the parameter

ROUND_SIGN.

It can also be used for rounding according to the measurement unit table

only. In this case UNIT_IN = UNIT_OUT.

Conversion requires that both units are maintained in the measurement

unit table and have the same dimension and are not both without

dimension.

Rounding is also possible for dimensionless units.

Example

DATA: VALUE_IN TYPE F,

VALUE_OUT TYPE F,

UNIT_IN LIKE T006-MSEHI,

UNIT_OUT LIKE T006-MSEHI.

...

CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'

EXPORTING

INPUT = VALUE_IN

ROUND_SIGN = 'X'

UNIT_IN = UNIT_IN

UNIT_OUT = UNIT_OUT

IMPORTING

OUTPUT = VALUE_OUT

EXCEPTIONS

CONVERSION_NOT_FOUND = 01

DIVISION_BY_ZERO = 02

INPUT_INVALID = 03

OVERFLOW = 04

OUTPUT_INVALID = 05

UNITS_MISSING = 06

UNIT_IN_NOT_FOUND = 07

UNIT_OUT_NOT_FOUND = 08.

Read only

Former Member
0 Likes
720

Hi Avi,

Please refer Vinaykumar's reply in the link,

Best Regards.

    • Reward points if it is useful.

Read only

Former Member