dear suzyan
please open new job and type this code and change the period name from fiscal calender period #
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==5637147130; //Replace RecID by FiscalCalendarPeriod recID of affected period
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
{
//nable 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));