cEmpresaCompany authorized for the process.
AdvPL GuidePREPARE ENVIRONMENT EMPRESA cEmpresa FILIAL cFilial MODULO cModuloDefines context for automatic execution without an existing environment.
The historical reference shows company, branch and module in the command. Current RpcSetEnv automatic-environment documentation requires context awareness: menu routines already have an environment; REST/SOAP with PrepareIn and schedules may too. Do not reopen, switch or close that context. Since 12.1.2510, RpcSetEnv can raise an exception in services whose environment is already open. This example records commented historical syntax only, without opening an environment or reproducing illustrative credentials from sources. (Sources: refs. 1–2.)
PREPARE ENVIRONMENT EMPRESA cEmpresa FILIAL cFilial MODULO cModulocEmpresaCompany authorized for the process.
cFilialBranch matching the company.
cModuloAutomatic-process module.
Command: no function return in this syntax. RpcSetEnv has its own logical-return contract.
#Include "Protheus.ch"
User Function Ed596()
// Syntax only: opening, authentication and cleanup require the caller contract.
// PREPARE ENVIRONMENT EMPRESA cCompany FILIAL cBranch MODULO "FAT"
ConOut("PREPARE ENVIRONMENT")
Return NilPrints the command name; does not change company, branch or user. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
© 2026 Usina.BR. All rights reserved. TOTVS, Protheus, Microsiga and their respective logos are trademarks of their owners. AdvPL Guide is independent and uses limited, attributed excerpts justified by educational purposes. See the Terms of Use. Terms of Use
Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.