I think I found a solution.
(defun c:Test ( )
(c:PrimaryFunction) ;cmdecho is 1 and unchanged - delete objects
(vla-startundomark *doc*) ;*doc* is the active document
(setvar "cmdecho" 0) ;suppress "Hatch boundary..." messages
(vla-endundomark *doc*)
(command "undo" "1") ;reset cmdecho to 1
(ReportFunction) ;run the report function
(princ)
)