cRpcEmpCompany code.
AdvPL GuideRpcSetEnv([cRpcEmp],[cRpcFil],[cEnvUser],[cEnvPass],[cEnvMod],[cFunName],[aTables],[lShowFinal],[lAbend],[lOpenSX],[lConnect]) -> lRetOpens an automatic environment with company, branch and identity.
Returns .T. on successful preparation and .F. on failure, without replacing exception handling. TDN prohibits reopening/closing menu-owned environments and warns about Schedule and REST with PrepareIn. Since 12.1.2510, framework-prepared REST/SOAP may raise an exception. cEnvPass supports an authentication token only from LIB 20251117 under the cited contract, not an arbitrary external token. The GitHub sample embeds a credential and does not close the environment in that subset; those patterns were not carried over. (Sources: refs. 1–2.)
RpcSetEnv([cRpcEmp],[cRpcFil],[cEnvUser],[cEnvPass],[cEnvMod],[cFunName],[aTables],[lShowFinal],[lAbend],[lOpenSX],[lConnect]) -> lRetcRpcEmpCompany code.
cRpcFilBranch code.
cEnvUserAuthorized user provided outside source.
cEnvPassPassword or token only under the supported LIB contract; never log.
cEnvModModule; documented default FAT.
cFunNameRoutine/audit identifier; default RPC.
aTablesAliases to open; default {}.
lShowFinalControls lMsFinalAuto; default .F.
lAbendLicense-failure message; default .T.
lOpenSXSX opening/first branch when absent; default .T.
lConnectDatabase connection; default .T.
Opening Boolean; exceptions remain possible.
#Include "Protheus.ch"
User Function Ed637()
// Uninvoked block; context and secret belong to the authorized caller.
Local bOpen := {|cCompany,cBranch,cUser,cSecret,cModule| ;
RpcSetEnv(cCompany,cBranch,cUser,cSecret,cModule)}
ConOut(ValType(bOpen))
Return NilCreates block B. No authentication, environment opening or secret logging occurs. 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.