Ax 2012 code,Get Inventory On hand qty for item of inventory dimension


   InventDimOnHand     _inventOnhand;  
   InventDimOnHandIterator _InventDimOnHandIterator;  
   InventDimOnHandMember  _InventDimOnHandMember ;  
   ItemId         itemId;  
   InventDim        _inventDim;  
   InventDimParm      _inventDimParm, inventDimParmOnHandLevel;  
    InventDim        inventDim;  
    InventDimOnHandLevel  _InventDimOnHandLevel;  
   ;  
   itemId = '76576';  
   _inventDim.InventLocationId = '1113';  
   _inventDim = InventDim::findOrCreate(_inventDim);  
    _inventDimParm.InventLocationIdFlag = true;  
   _InventDimOnHandLevel = InventDimOnHandLevel::DimParm;  
    inventDimParmOnHandLevel.ItemIdFlag = true;  
   inventDimParmOnHandLevel.InventLocationIdFlag = true;  
   inventDimParmOnHandLevel.WMSLocationIdFlag = true;  
   inventDimParmOnHandLevel.InventBatchIdFlag = true;  
    _inventOnhand = InventDimOnHand::newAvailPhysical(itemId, _inventDim, _inventDimParm, _InventDimOnHandLevel, inventDimParmOnHandLevel);  
    _InventDimOnHandIterator = _inventOnhand.onHandIterator();  
   while (_InventDimOnHandIterator.more())  
   {  
     _InventDimOnHandMember  = _InventDimOnHandIterator.value();  
     inventDim = InventDim::find(_InventDimOnHandMember .parmInventDimId());  
     info(con2str([_InventDimOnHandMember .parmItemId(), inventDim.inventLocationId, inventDim.wMSLocationId, inventDim.inventBatchId, _InventDimOnHandMember .parmInventQty()]));  
     _InventDimOnHandIterator.next();  
   }