web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Closing our Fiscal Period

(0) ShareShare
ReportReport
Posted on by 495

Hello Everyone,

I am trying to close out a fiscal Period in AX 2012 R2 and getting the following message

"You cannot close the fiscal period Period 12 because it is referenced by open transactions. You must post, delete, or change the transaction date of the open transactions before you can close the fiscal period."

I Have already gone ahead and run the famous Job:

static void LKLGrootboekPeriodeAfsluitingWD(Args _args)
{
  AccountingDistribution  accountingDistribution;
  FiscalCalendar          fiscalCalendar;
  FiscalCalendarPeriod    fiscalCalendarPeriod;
  FiscalCalendarPeriod    _currentPeriod;
  Ledger                  ledger;
  counter teller =0;
  counter tellervoor =0;
  counter tellerna=0;
  ;
    while select accountingDistribution
   {
       tellervoor++;
   }
  select * from _currentPeriod where _currentPeriod.RecId==5637148102; //This is the RecId i get for the peroid 12
  if (_currentPeriod)
  {
      ttsBegin;
      while select forUpdate  RecId from accountingDistribution
          where accountingDistribution.AccountingDate >= _currentPeriod.StartDate &&
              accountingDistribution.AccountingDate <= _currentPeriod.EndDate &&
              accountingDistribution.AccountingEvent == 0
          exists join ledger
              where ledger.PrimaryForLegalEntity == accountingDistribution.AccountingLegalEntity
          exists join fiscalCalendar
              where fiscalCalendar.RecId == ledger.FiscalCalendar
          exists join fiscalCalendarPeriod
              where fiscalCalendarPeriod.FiscalCalendar == fiscalCalendar.RecId &&
                  fiscalCalendarPeriod.RecId == _currentPeriod.RecId
      {
          //Enable the row below to automatically delete the record
     AccountingDistribution.doDelete();
          teller++;
      }
   ttscommit;
       while select accountingDistribution
       {
       tellerna++;
       }
      info(strFmt("Amount of records before the problem record(s) were deleted from table Accountingdistribution: %1",tellervoor));
      info(strFmt("Deleted: %1",teller));
      info(strFmt("Amount of records after the problem record(s) were deleted in table Accountingdistribution: %1",tellerna));
      if(tellervoor-teller==tellerna)
      {
      info("Check: OK!");
      }
      else
      {
      info(strFmt("Check: Error! Before %1 - deleted %2 is not %3 (result after deletion)",tellervoor,teller,tellerna));
      }
  }
}

The job did not find anything to delete and I cannot seem to find what is causing the period not to close. All the other periods are closed... Please anyone who can share some knowledge on this i would be grateful.

I have the same question (0)
  • Suggested answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hello Lionel07,

    You can test if the following mitigation from MS helps:

    fix.lcs.dynamics.com/.../Details

    Best regards,

    Ludwig

  • Lionel07 Profile Picture
    495 on at

    Thanks for this Ludwig, I did run an update script in the test environment and it worked.  My only concern now would be what are the implications of doing it like this given that Microsoft doesn't advise we work from the SQL server to AX but instead from AX 20 SQL server.

  • Suggested answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hello Lionel07,

    I had a look at the disclaimer and I think that this is a kind of 'standard' disclaimer that MS makes when they cannot or do not want to take over responsibility for this 'workaround'. I don't have any other insight into potential disadvantages and you would possibly have to reach out to the author of this solution - by opening a new support case - if you want to have more information about potential issues that this workaround inherits.

    Best regards,

    Ludwig

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 657

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 453 Super User 2026 Season 1

#3
Martin Dráb Profile Picture

Martin Dráb 190 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans