System.ClearAll() Method
Version: Available or changed with runtime version 1.0.
Clears all internal variables (except REC variables), keys, and filters in the object and in any associated objects, such as reports, pages, codeunits, and so on that contain AL code.
Syntax
System.ClearAll()
Note
This method can be invoked without specifying the data type name.
Remarks
ClearAll works by calling the Clear Method repeatedly on each variable. However, this is not the case with codeunits, where the ClearAll method works by calling ClearAll inside the codeunit. It deletes the contents of the codeunit, whereas Clear only deletes the reference to the codeunit.
ClearAll does not affect or change values for variables in single instance codeunits.
When a method is called repeatedly in the same transaction, the system retains all values for variables and filters in memory between calls. For example, this is used to assign numbers to entry numbers when posting. When you do not want to retain the values in memory, use the ClearAll method to clear them.
For information about the initial values of cleared variables, see the Clear Method. Take into consideration that fields in a record will be initialized with the InitValue Property of the field.