MS Dynamics AX 2013 R3 Closing Year Problem

This error is raised every year, when trying to close the periods of last year, or put them on hold, the following error might raise:

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

the following clip shows how to do that:

 

View For seeing the problematic records:

CREATE VIEW [dbo].[zz_AccountingDistribution_Problematic]
AS
SELECT sdl.TYPEENUMNAME as Operation, ad.ACCOUNTINGDATE as date, ad.TRANSACTIONCURRENCYAMOUNT as amount
 , ad.TRANSACTIONCURRENCY, sdl.TYPEENUMVALUE, ad.SOURCEDOCUMENTLINE, sdl.PARENTSOURCEDOCUMENTLINE, ad.SOURCEDOCUMENTHEADER, sdl.SOURCEDOCUMENTHEADER AS sdl_SOURCEDOCUMENTHEADER, 
 ad.REFERENCEDISTRIBUTION, ad.PARENTDISTRIBUTION, ad.NUMBER_, ad.FINALIZEACCOUNTINGEVENT, ad.ACCOUNTINGLEGALENTITY, ad.TRANSACTIONCURRENCYAMOUNT, ad.LEDGERDIMENSION, ad.AMOUNTSOURCE, 
 ad.ACCOUNTINGEVENT, ad.TYPE, ad.ROLE, ad.ACCOUNTINGDATE, ad.ALLOCATIONFACTOR, ad.MONETARYAMOUNT, ad.REFERENCEROLE, ad.RECVERSION, ad.PARTITION, ad.RECID, sdh.ACCOUNTINGSTATUS AS sdh_ACCOUNTINGSTATUS, 
 CASE sdh.ACCOUNTINGSTATUS WHEN 0 THEN 'None' WHEN 1 THEN 'InProcess' WHEN 2 THEN 'Completed' WHEN 3 THEN 'Finalized' WHEN 4 THEN 'Canceled' END AS SourceDocumentAccountingStatus_Enumeration, 
 ae.CREATEDBY, ae.EVENTDATETIME, sdh.TYPEENUMNAME, sdl.SOURCERELATIONTYPE, sdl.ACCOUNTINGSTATUS, sdl.ISFINAL, sdl.STATECONTAINER, sdl.TYPEENUMNAME AS sdl_TYPEENUMNAME, sdl.EXCHANGERATEDATE, 
 sdl.RECVERSION AS sdl_RECVERSION, sdl.PARTITION AS sdl_PARTITION, sdl.RECID AS sdl_RECID
 , isProblematic
FROM dbo.ACCOUNTINGDISTRIBUTION AS ad LEFT OUTER JOIN
 dbo.LEDGER ON dbo.LEDGER.PRIMARYFORLEGALENTITY = ad.ACCOUNTINGLEGALENTITY LEFT OUTER JOIN
 dbo.ACCOUNTINGEVENT AS ae ON ad.ACCOUNTINGEVENT = ae.RECID LEFT OUTER JOIN
 dbo.SOURCEDOCUMENTHEADER AS sdh ON ad.SOURCEDOCUMENTHEADER = sdh.RECID LEFT OUTER JOIN
 dbo.SOURCEDOCUMENTLINE AS sdl ON ad.SOURCEDOCUMENTHEADER = sdl.RECID
WHERE (ad.ACCOUNTINGDATE >= '2016-01-01') AND (ad.ACCOUNTINGDATE <= '2016-12-31') AND (ad.ACCOUNTINGEVENT = 0)

Editable view, to easily delete the problematic rows:

create VIEW [dbo].[zz_AccountingDistribution_Problematic_ToThinkOfDeleting]
AS
SELECT ad.ACCOUNTINGDATE as date, ad.TRANSACTIONCURRENCYAMOUNT as amount
 , ad.TRANSACTIONCURRENCY, ad.SOURCEDOCUMENTLINE, ad.SOURCEDOCUMENTHEADER,
 ad.REFERENCEDISTRIBUTION, ad.PARENTDISTRIBUTION, ad.NUMBER_, ad.FINALIZEACCOUNTINGEVENT, ad.ACCOUNTINGLEGALENTITY, ad.TRANSACTIONCURRENCYAMOUNT, ad.LEDGERDIMENSION, ad.AMOUNTSOURCE, 
 ad.ACCOUNTINGEVENT, ad.TYPE, ad.ROLE, ad.ACCOUNTINGDATE, ad.ALLOCATIONFACTOR, ad.MONETARYAMOUNT, ad.REFERENCEROLE, ad.RECVERSION, ad.PARTITION, ad.RECID 
, isProblematic
FROM dbo.ACCOUNTINGDISTRIBUTION AS ad 
WHERE (ad.ACCOUNTINGDATE >= '2017-01-01') AND (ad.ACCOUNTINGDATE <= '2017-12-31') AND (ad.ACCOUNTINGEVENT = 0)

 

Advertisements

About Reader Man حسين ناجي الصفافير

حسين ناجي الصفافير Hussain Naji Al-Safafeer Info: https://readerman1.wordpress.com/aboutme
This entry was posted in Bugs. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s