Created
March 11, 2015 13:44
-
-
Save matejskubic/8a20bfb2c052f01c7b13 to your computer and use it in GitHub Desktop.
AX 2012 - DeleteFiscalCalendarYear
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void DeleteFiscalCalendarYear(Args _args) | |
{ | |
FiscalCalendarYear fiscalCalendarYear; | |
FiscalCalendarPeriod fiscalCalendarPeriod; | |
LedgerFiscalCalendarPeriod ledgerFiscalCalendarPeriod; | |
LedgerPeriodModuleAccessControl ledgerPeriodModuleAccessControl; | |
FiscalYearName yearToDelete = '2011'; | |
ttsBegin; | |
delete_from ledgerPeriodModuleAccessControl | |
exists join ledgerFiscalCalendarPeriod | |
where ledgerFiscalCalendarPeriod.RecId == ledgerPeriodModuleAccessControl.LedgerFiscalCalendarPeriod | |
exists join fiscalCalendarPeriod | |
where fiscalCalendarPeriod.RecId == ledgerFiscalCalendarPeriod.FiscalCalendarPeriod | |
exists join fiscalCalendarYear | |
where fiscalCalendarYear.RecId == fiscalCalendarPeriod.FiscalCalendarYear | |
&& fiscalCalendarYear.Name == yearToDelete | |
; | |
delete_from ledgerFiscalCalendarPeriod | |
exists join fiscalCalendarPeriod | |
where fiscalCalendarPeriod.RecId == ledgerFiscalCalendarPeriod.FiscalCalendarPeriod | |
exists join fiscalCalendarYear | |
where fiscalCalendarYear.RecId == fiscalCalendarPeriod.FiscalCalendarYear | |
&& fiscalCalendarYear.Name == yearToDelete | |
; | |
delete_from fiscalCalendarPeriod | |
exists join fiscalCalendarYear | |
where fiscalCalendarYear.RecId == fiscalCalendarPeriod.FiscalCalendarYear | |
&& fiscalCalendarYear.Name == yearToDelete | |
; | |
delete_from fiscalCalendarYear | |
where fiscalCalendarYear.Name == yearToDelete | |
; | |
ttsCommit; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment