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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Cannot close period when there are source documents remaining to be journalized with an accounting date within the period. Error ???

(0) ShareShare
ReportReport
Posted on by 5,125

i am trying to close periods in LedgerCalendar in General Ledger-> Ledger ->  Ledger Calendar 

but it shows me the following message 

Cannot close period  when there are source documents remaining to be journalized with an accounting date within the period

AX Version AX 2012 R2 upgrade from FB

any suggestion how to solve these ???

*This post is locked for comments

I have the same question (0)
  • Wvduren Profile Picture
    1,435 on at

    Same issue here. Very annoying

  • mostafa mahmoud Profile Picture
    5,125 on at

    hi WVDUREN

    try to run the below job in your server to get the corrupted lines recid, you will find these line in AccountingDistribution  table ,and if you deleted these lines every thing will go ok and the period will be close successfully

    static void SFTYClosingLedgerDocumentsIssue(Args _args)

    {

       AccountingDistribution  accountingDistribution;

       FiscalCalendar          fiscalCalendar;

       FiscalCalendarPeriod    fiscalCalendarPeriod;

       FiscalCalendarPeriod    _currentPeriod;

       Ledger                  ledger;

       ;

       select * from _currentPeriod where _currentPeriod.RecId==5637145934;

       if (_currentPeriod)

       {

           while select  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

           {

           //if (accountingDistribution)

           //{

               info(queryValue(accountingDistribution.RecId));

               //_fiscalCalendars.addWarning(strFmt("@SYS344293",_currentPeriod.Name));

           //}

           }

       }

    }

  • Wvduren Profile Picture
    1,435 on at

    Hi Faress,

    Thank you for your suggestion. Unfortunately, your job runs perfectly, but gives no results. It seems this table is not the problem. Any ideas where to look?

     

    Maybe good to mention: I use AX 2012 R1 CU2

  • mostafa mahmoud Profile Picture
    5,125 on at

    i think that you need to made trace and debugging  for that issue , as the reason seems to be different

  • Wvduren Profile Picture
    1,435 on at

    Hi Faress. I guess so. I am sorry, but I never did that before. The only debugging I have done is add a breakpoint to some classes and debug.

    How can I add a trace for this problem? Where to start?

  • Community Member Profile Picture
    on at

    Debug class "subLedgerJournalFiscalCalenderEventHandler"

    and in table "LedgerFiscalCalendarPeriod" method "ValidateField"

  • Wvduren Profile Picture
    1,435 on at

    Actually, the code of Faress Mahmoud works fine after all. Although I changed the code a little, it is the right solution for this problem. I also updated it to auto-remove the data from the table and report how many were deleted.

    Thank you very much!

  • Khurram Aftab Profile Picture
    15 on at

    hi Willem,

    i have tried and run the same job, but nothing changes. The problem still exist and period can not be closed.

    please help if you have any solution

    Thank you

  • Community Member Profile Picture
    on at

    Problem comes from 

    \Classes\SubledgerJournalFiscalCalendarEventHandl\checkAccDistWithNoAccEvent

    And I can't figure out where how accountingDistribution table relaited with transaction or something. 

    I found that there are field SourceDocumentHeader SourceDocumentLine.

    But when i ket there I still cant find relaited transaction.

  • Wvduren Profile Picture
    1,435 on at

    Hi Khurrum, sorry for my late reply.

    Did you use the correct RecID ? You need to change it to the period you experience problems with:

    select * from _currentPeriod where _currentPeriod.RecId==5637144589;

    Then it should work fine.

    You can find the period and corresponding recID in the FiscalCalendarPeriod table (use table browser).

    Kind regards, Willem.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans