Problem example:
- Item Base unit of measure is feet,
- Item Sales unit of measure is inch = 1/12 of feet (Quantity per unit of measure is 0.08333)
- If we sell 240 inches of item - then in Item Ledger will be posted 19.9992 feets (= 240*0.08333)
core problem is that BC rounds QtyPerUnit to 0.00001 when entering value to field, but NOT rounding values returned from function GetQtyPerUnitOfMeasure(Item,UnitOfMeasureCode) in codeunit 5402 when it is written to "Sales Line" Qty per Unit Of measure)
My solving suggestion:
- Add boolean field named "Inverse calculation" to table "Item Unit of Measure"
- Modify EXIT phase of function GetQtyPerUnitOfMeasure(Item,UnitOfMeasureCode) in codeunit 5402 to this (code is written in C/AL):
IF ItemUnitOfMeasure.'Inverse calculation" THEN
EXIT(1/ItemUnitOfMeasure."Qty. per Unit of Measure")
ELSE
EXIT(ItemUnitOfMeasure."Qty. per Unit of Measure"); //Standard behaviour
In that case sold 240 inches will be posted as 20 feets in Item Ledger
Comments
Both ideas mentioned above are absolutely relevant!That should have been implented years ago!!One alternative is to extend hjá decimal-places from current 5 till 9.Which after several simulations seems to be usable.But now coding in AL it no longer is a possibility.Any solution mentioned here is relevant. A combined solution would make it perfect,All solutions can be accomplished with a very relative small effort and at a low workload in surrounding changes.So - ladies and gentlemen a Microsoft - please put this into your schedule :)
Category: Inventory
Another solution for that problem may be have two fields in Table "Item Units of Measure" in place of "quantity per unit of measure":1) Qty in Unit of Measure2) Qty in Base Unit of Measure (Initial Value of this field = 1)Then function GetQtyPerUnitOfMeasure(Item,UnitOfMeasureCode) in codeunit 5402 must return"Qty in Unit of Measure'/"Qty in Base Unit of Measure"Similar way is realised in "Currency Exchange Rate" table: 1) "Exchange rate Amount"2) "Relational Exch. Rate Amount"
Category: Inventory