Transfer - set Financial Dimension -> From Dimension

Hi,

I’m trying to add lines from code to a transfer [inventJournalTrans] _journalTrans. I can’t figure out how do I add Financial Dimension through code.

I need to set one financial dimension (site) based on ‘_fromInventDimId’ site value.

_journalTrans.clear();

_journalTrans.initValue();

_journalTrans.JournalId = _journalTableData.journalTable().JournalId;

_journalTrans.ItemId = _itemId;

_journalTrans.InventDimId = _fromInventDimId;

_journalTrans.ToInventDimId = _toInventDimId;

_journalTrans.Qty = _qty;

_journalTrans.JournalType = InventJournalType::Transfer;

_journalTrans.TransDate = _date;

_journalTrans.create();

Any suggestions?

See how the default dimension is set here,

http://axaptacorner.blogspot.in/2012/09/how-to-create-general-journal-in-ax.html

Thanks for your effort, Apparently, solution was very simple, maybe I didn’t describe my problem so well.

InventSite inventSite;

InventDim siteInventDim;

siteInventDim = InventDim::find(_fromInventDimId);

select DefaultDimension from InventSite where InventSiteId == siteInventDim.InventSiteId;

_journalTrans.clear();

_journalTrans.initValue();

_journalTrans.JournalId = _journalTableData.journalTable().JournalId;

_journalTrans.ItemId = _itemId;

_journalTrans.InventDimId = _fromInventDimId;

_journalTrans.ToInventDimId = _toInventDimId;

_journalTrans.Qty = _qty;

_journalTrans.JournalType = InventJournalType::Transfer;

_journalTrans.TransDate = _date;

_journalTrans.DefaultDimension = inventSite.DefaultDimension;

_journalTrans.create();

Thanks again.