Skip to main content

Code to Convert Inventory to sales unit value for Item in Axapta

This is a sample Code to Convert Inventory to sales unit value for Item in Axapta . You can try this code in job to check the value. Item code you can use from your system data. I hope you will get idea and enjoy daxing.

 InventTableModule InventTableModule;  
   int64 InvUnit, SalesUnit, EcoresproductRecid;  
   UnitOfMeasureConversion UnitOfMeasureConversion;  
   real d;  
   select InventTableModule where InventTableModule.ItemId == '60068C'  
                 && InventTableModule.ModuleType == ModuleInventPurchSales::Invent;  
   InvUnit = UnitOfMeasure::findBySymbol(InventTableModule.UnitId).RecId;  
   SalesUnit = UnitOfMeasure::findBySymbol('BOX4').RecId;  
   EcoresproductRecid = EcoResProduct::findByDisplayProductNumber('60068C').RecId;  
   
   d = UnitOfMeasureConverter::convert(8.0,InvUnit,SalesUnit,NoYes::No,Ecoresproductrecid);  
   info(strFmt("%1",d));  

Comments