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

Material Unit Conversion

Former Member
0 Likes
10,559

Hi,

I have Gross Wt nad New wt

Whatever may be its unit, I want it to be converted into KG

There is a function module for it

But its not working for me

I dont know what excatly to pass

MATERIAL_UNIT_CONVERSION

Sunil

2 REPLIES 2
Read only

Former Member
0 Likes
3,025

Hi

Use the fun module

UNIT_CONVERSION_SIMPLE or

MD_CONVERT_MATERIAL_UNIT

see the sample code:

CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'

EXPORTING

INPUT = p_act_in

UNIT_IN = p_uom_in

UNIT_OUT = w_unit_out

IMPORTING

OUTPUT = w_act_out

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.

reward if useful

regards,

Anji

Read only

Former Member
0 Likes
3,025

hi sunil

Please try this FM.

MD_CONVERT_MATERIAL_UNIT

MATERIAL_UNIT_CONVERSION

MC_UNIT_CONVERSION

UNIT_CONVERSION_SIMPLE

using MATERIAL_UNIT_CONVERSION is as shown

report zrich_0002.

data: input type p decimals 3 value '10.000'.

data: begin of xtmp,

menge type mseg-menge,

meins type mseg-meins,

end of xtmp.

data: imara like mara.

  • Get base UOM

select single * from mara into imara

where matnr = '000000000040006541'.

  • The uoms must be of the internal format, check against T006a

  • do conversion

call function 'MATERIAL_UNIT_CONVERSION'

exporting

input = input

matnr = imara-matnr

meins = 'GLL' " Must be internal

meinh = 'OZA' " Must be internal

importing

meins = xtmp-meins

output = xtmp-menge

exceptions

conversion_not_found = 01

input_invalid = 02

material_not_found = 03

meinh_not_found = 04

meins_missing = 05

no_meinh = 06

output_invalid = 07

overflow = 08.

check sy-subrc = 0.

regards

navjot

reward if helpfull