Hi Ron,
Please try to run the below job in your server to get RecIds of the corrupted lines. It will be in the AccountingDistribution table ,and once you delete these lines, you will be able to close the period successfully.
static void ClosingPeriod(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));
//}
}
}
}
~ Nidhi :)