CLEARALL in Codeunit 80

Hi there. I have a question about the Codeunit 80. In the function “Code” at the very beginning there is a call to CLEARALL wich, apparently, clears everything. Now i have some variables that i set through some functions in the codeunit before i call it. These variables should control the way a sales order is posted but they dont, since they are reset to zero everytime codeunit 80 is run, because of CLEARALL. I wonder how i could bypass this thing without having to write a single instance codeunit … Any ideas?

You could add fields to the Sales Header table to store those values and set them before you call CU80.

Exactly, just look at fields 57 Ship and 58 Invoice.

Or put them in the record before CLEARALL like posting and ducument date.

Or create a global var of type record with temporary = yes. Insert some records with values in that temporary table. CLEARALL does not clear that table.