I start by making an automation variable in the on-premises version of Dynamics 365 Business Central.
The first time I used this code, it functioned without any problems, but after that, an error occurred.
Code-
EVALUATE(_PC, PCStr);
CREATE(_Export, TRUE, TRUE);
_Export.process(_PC);
Here's a link that may help you.
Automation Data Type - Business Central | Microsoft Learn