Reset Accounting can't reset documents without fact acct
Description
We found this issue in a customer:
The accounting schema flag "Accrual" was unchecked
Then all invoices were "posting" no fact acct records - but marked as posted (this is correct, it is how cash based accounting works)
Then after fixed the "Accrual" flag we tried to repost all invoices
PROBLEM -> Reset accounting was not able to mark as Non-Posted the invoices that didn't have fact acct
Diagnose: This is because of the UPDATE on FactAcctReset.delete (line 256 with current code) It has a condition "AND EXISTS (SELECT ...INNER JOIN Fact_Acct fact" - so if the document doesn't have fact acct records cannot be marked as non-posted.
Solution must be towards to change that condition, instead of checking the existence of fact acct records, it must check:
when automatic period: check processed, active and dateacct directly, like: AND Processed='Y' AND IsActive='Y' AND TRUNC(fact.DateAcct) >= p_DateAcct_From AND TRUNC(fact.DateAcct) <= p_DateAcct_To
when using period control, then it must check procesed, active and that dateacct lands in an open period of the default calendar (this last part is not present in actual code I think)
We found this issue in a customer:
The accounting schema flag "Accrual" was unchecked
Then all invoices were "posting" no fact acct records - but marked as posted (this is correct, it is how cash based accounting works)
Then after fixed the "Accrual" flag we tried to repost all invoices
PROBLEM -> Reset accounting was not able to mark as Non-Posted the invoices that didn't have fact acct
Diagnose:
This is because of the UPDATE on FactAcctReset.delete (line 256 with current code)
It has a condition "AND EXISTS (SELECT ...INNER JOIN Fact_Acct fact" - so if the document doesn't have fact acct records cannot be marked as non-posted.
Solution must be towards to change that condition, instead of checking the existence of fact acct records, it must check:
when automatic period: check processed, active and dateacct directly, like:
AND Processed='Y' AND IsActive='Y'
AND TRUNC(fact.DateAcct) >= p_DateAcct_From
AND TRUNC(fact.DateAcct) <= p_DateAcct_To
when using period control, then it must check procesed, active and that dateacct lands in an open period of the default calendar (this last part is not present in actual code I think)
Regards,
Carlos Ruiz