onHandQty and dimension

Hello;

i want to know if there is a possibility to add diemsions(department,CostCentre,Purpose)in this method: onHandQty??

thank you in advance.

Everything is possible, but how should it work? It’s doesn’t sound like a well-thought-out idea… unless you tell us more.

Definitely if you want to add additional storage dimensions, it will be much more work than adjusting onHandQty().

Hello;

thank you Martin Drab for you help,I am so sorry,i didn’t explain it very well and im a beginner in axapta.

So, there is a class that export Data from dynamics ax to excel document,in this class i find the method OnhandQty() the code is:

void onHandQty(InventSum _inventSum, InventDim _inventDim)
{
InventTable inventTable = _inventSum.inventTable();
InventDimGroupId inventDimGroupId = inventTable.DimGroupId;
fieldId x,y;

InventDim tmpInventDim;
InventDimParm tmpInventDimParm;

InventQty onHandQty;

str line;

InventTableModule inventTableModule = inventTable.inventTableModuleInvent();

;

if (!_inventSum.InventDimId)
{
_inventSum.InventDimId = InventDim::findOrCreate(_inventDim).inventDimId;
}

onHandQty = InventSumDatePhysicalDim::onHandQty(countDate, _inventSum.ItemId, _inventDim, inventDimParm);

if (OnHandQty)
{
line = _inventSum.ItemId + ‘;’;
line += _inventSum.itemName() + ‘;’;
if (inventDimParm.ConfigIdFlag)
line += _inventDim.ConfigId + ‘;’;
if (inventDimParm.InventSizeIdFlag)
line += _inventDim.InventSizeId + ‘;’;
if (inventDimParm.InventColorIdFlag)
line += _inventDim.InventColorId + ‘;’;
line += _inventDim.InventSiteId + ‘;’;
line += _inventDim.InventLocationId + ‘;’;
line += InventLocation::find(_inventDim.InventLocationId).Name + ‘;’;
line += tmpInventDim.wMSLocationId + ‘;’;
if (inventDimParm.InventBatchIdFlag)
line += _inventDim.InventBatchId + ‘;’;
if (inventDimParm.WMSPalletIdFlag)
line += _inventDim.WMSPalletId + ‘;’;
if (inventDimParm.InventSerialIdFlag)
line += _inventDim.InventSerialId + ‘;’;
line += num2str(onHandQty, 0, 2, 0, 0) + ‘;’;
line += num2str(inventTableModule.Price(), 0, 4, 0, 0) + ‘;’;
line += num2str(inventTableModule.priceUnit(), 0, 0, 0, 0) + ‘;’;
line += num2str((inventTableModule.Price() / inventTableModule.PriceUnit()) * onHandQty, 0, 2, 0, 0);

csvIO.write(line);
}
}

the exported document in excel contain these columns:

  • Item number
  • Item name
  • site
  • warehouse
  • name
  • location
  • physical stock
  • price
  • price unit
  • cost amout

My problem is to add storage dimensions( department,CostCentre,Purpose) related to item number, in the exported excel document,i tried hard to add the code: line = inventTable.Dimension + ‘;’; in the method onHandQty but in vain.

I hope that i explain this well and please help me to resolve this problem.

thank you in advance.

pleease can someone help me.

You have to access ledger dimension fields one by one. For example:

inventTable.Dimension(Dimensions::code2ArrayIdx(SysDimension::Center));