axapta - How can I code in X++ to copy a Fiscal Year to all companies from a base company thats been set up? -
we running dynamics ax2012 r2 cu7 , coded:,
"copy fiscal year companies base company that's been set up",
feature our source system dynamics ax 2009. structures in dynamics ax 2012 r2, cu7 different don't know how go achieving same functionality through x++ coding.
original code:
void clicked() { moduleperiodstat ledger, bank, cust, asset, invent, prod, proj, purch, sales, tax, vend ; periodend period; ledgerperiod ledgerperiod2; companyinfo companyinfo; dialog dlg; ; super(); dlg = new dialog("confirm: "); dlg.addtext("you create these periods in companies "+date2str(period,321,2,2,2,2,4)); dlg.run(); if ((dlg.closedok())) { ttsbegin; while select crosscompany companyinfo { if (companyinfo.dataareaid != 'ct11' && companyinfo.dataareaid != 'ct13' && companyinfo.dataareaid != 'md11' && companyinfo.dataareaid != 'mf11') changecompany(companyinfo.dataareaid) { ledgerperiod2 = null; while select forupdate ledgerperiod // (ledgerperiod.periodend == period) { ledger = ledgerperiod.statusledger; bank = ledgerperiod.statusbank; cust = ledgerperiod.statuscust; asset = ledgerperiod.statusfixedasset; invent = ledgerperiod.statusinvent; prod = ledgerperiod.statusprod; proj = ledgerperiod.statusproj; purch = ledgerperiod.statuspurch; sales = ledgerperiod.statussalesorder; tax = ledgerperiod.statustax; vend = ledgerperiod.statusvend; period = ledgerperiod.periodend; ledgerperiod2.periodstart = ledgerperiod.periodstart; ledgerperiod2.periodcode = ledgerperiod.periodcode; ledgerperiod2.periodend = period; ledgerperiod2.periodstatus = ledgerperiod.periodstatus; ledgerperiod2.commentaries = ledgerperiod.commentaries; ledgerperiod2.statusledger = ledger; ledgerperiod2.statusbank = bank; ledgerperiod2.statuscust = cust; ledgerperiod2.statusfixedasset = asset; ledgerperiod2.statusinvent = invent; ledgerperiod2.statusprod = prod; ledgerperiod2.statusproj = proj; ledgerperiod2.statuspurch = purch; ledgerperiod2.statussalesorder = sales; ledgerperiod2.statustax = tax; ledgerperiod2.statusvend = vend; try { ledgerperiod2.insert(); } catch (exception::duplicatekeyexception) { period = period; print('problem encountered company: '+companyinfo.dataareaid); } } } } ttscommit; box::info('periods created successfully'); } }
you not need such functionality in ax 2012.
from white paper (page 735) linked fh-inway:
in microsoft dynamics ax 2009, ledgerperiod table , form used create , maintain fiscal periods company.
reason deprecation: global organizations operate different legal entities in different geographical areas. however, share lot of data, such charts of accounts, currencies, exchange rates, , calendars. defining reference , master data once , sharing across legal entities reduces cost of maintaining such data across organization. however, ledger periods, , associated assetcalendar tables, did not provide sufficient support scenario , have been replaced more robust shared fiscal calendars.
replaced feature: feature no longer available , has been replaced shared fiscal calendars.
setup shared fiscal calendar in general ledger\setup\fiscal calendar.
then select fiscal calendar in genreral ledger\setup\ledger.
update 2:
the closing of ledger periods done in ledger calendar. open/closed status of period stored in table ledgerfiscalcalendarperiod
. although global, linked ledger
table of there 1 per company.
thus have no need any customization regarding ledger periods.
Comments
Post a Comment