This routine aims at removing records of transaction tables and balance tables in periods already closed, i.e., periods whose reports have already been printed and registered and will no longer be used for history queries or for comparison of fiscal years.
This routine obtains final balances of the fiscal year indicated, makes security copies (backup) of entries to be removed and deletes all entries and balances up to the last date of the fiscal year entered (including prior fiscal years). Finally, it generates an entry batch with final balances of the fiscal year that was cleaned, in order to maintain the integrity of balances for the following fiscal years.
Procedures executed by the Database Cleaning routine
1. A warning is displayed informing that balances must be updated and that the calendar(s) of fiscal year indicated in the routine must be closed, i.e., calendars with “Closed” status.
2. All currencies and balance types registered and bound are considered and transferred.
3. Final balances of the fiscal year entered are obtained and saved in a temporary file.
Note:
The quoted balance is not considered for the backup. However, quoted balances are also removed from balance tables during the cleaning (tables CV1 and CV2, of quotation origin, are maintained) based on the concept that in “Carried Forward“ periods, the base is no longer available for query. The backup table keeps a copy of the entries saved in the table CT2 to be removed.
01 | Company in which the cleaning is being performed |
01 | Branch in which the cleaning is being performed |
2004 | Year/Fiscal Year in which the cleaning is being performed |
4. Records of movements of table CT2 are copied up to the final dates of calendar(s) (considering each currency) to the table of entries backup (table CV6).
Tip: The structure of the backup table must be the same as the entries table's (CT2), adding the column CV6_EXERC, character with size 4, in order to identify the cleaning fiscal year in the event of a later recovery. |
5. The transaction records of table CT2 up to the final dates of the calendars are removed, considering the possibility of calendars with different final dates among the currencies.
6. Final balances are read from the work file (TRB). These final balances are saved in the format of the new entries, separated by document, according to balance type, currency and calendar dates, in the table of accounting entries (the lot and sub-lot numbers and the document indicated in the questions of the routine with sequential increase are considered). These entries are kept representing initial balances for the subsequent fiscal year.
7. Once entries with final balances are saved, recalculation of balances (reprocessing) is performed for the whole period that was cleaned, considering from the earlier date of movements transferred carried forward in CT2 to the later final date of the fiscal year, keeping only the balance records for the final date of the period.
8. After recalculating balances, status of the calendar(s) turns into “Carried Forward.”
9. At the end of processing, the user is asked to delete the work file (TRB), confirming the routine execution.
Notes: