Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

converting the units of a weight field

Hi,

I want to convert weight field's units into KG. i want to add the all weights but i want to convert it into KG before. as it may contain the units other than KG. plz tell me its veryvery urgent.

i think u understood..

weight( (VBRP-BRGEW)

units (VBRP-GEWEI)

Kumar

Tags:
Former Member
replied

Hi,

The following is from documentation.Have a look at it.Give unit_out = 'KG'.

Kindly reward points by clikcing the star on the left of reply,if it helps.

Functionality

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.

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question