Function to Convert Quantities from one UOM to other

sunnyksunnyk Member Posts: 280
Hi,
Is there any standard Function available to convert Quantities of an Item from 1one UOM to Other UOM. for e.g. let's say for an Item X, we have 4 UOMs as EACH, PACK, BOX, PALETTE where EACH is Base UOM. 1 PACK = 2 EACH, 1 BOX = 2 PACKS = 4 EACH, & 1 PALETTE = 4 BOXES = 8 PACKS = 16 EACH.

what we want to do is to convert a given UOM to other by simply passing, (from UOM, to UOM).

Answers

  • Peter+is1Peter+is1 Member Posts: 174
    Hi,

    I don't know of any such standard function in NAV.

    Good luck.
    \\
    The truth exists in seven versions.
  • KishormKishorm Member Posts: 921
    No there isn’t a standard function to do this but you can write your own and it’s pretty straight forward. First you need to calculate the base qty by multiplying by the qty per unit of measure for the first UOM, then you divide by the qty per unit of measure of the second UOM.
  • RasmusAaenRasmusAaen Member Posts: 2
    Procedure ConvertQuantity( FromUoM: Code[20]; ToUoM: Code[20]; Qty: Decimal): Decimal
    Var
      UoMMgt: Codeunit "Unit of Measure Management";
      QtyPerUoMFrom: Decimal;
      QtyPerUoMTo: Decimal;
    
    Begin;
      QtyPerUoMFrom := UoMMgt.GetQtyPerUnitOfMeasure(Item, FromUoM);
      QtyPerUoMTo := UoMMgt.GetQtyPerUnitOfMeasure(Item, FromUoM);
    
      Exit(QtyPerUoMFrom / QtyPerUoMTo * Qty);
    
    End;
    
Sign In or Register to comment.