RetSqlName and physical table names
Resolves SQL table names without hardcoding company suffixes.
Overview
RetSqlName maps a logical dictionary alias to its configured physical name. Appending 010 is unsafe because company configuration varies. Name resolution does not add branch, logical-deletion or authorization filters. In joins calculate xFilial per table rather than comparing branch fields with different sharing rules. The example reads only the SB1 name in an already prepared environment and executes no query. Bind input values using the available SQL API. (Sources: refs. 1–2.)
Commented example
#Include "Protheus.ch"
User Function Ed628()
// Uninvoked block; requires an environment with dictionary access.
Local bName := {|| RetSqlName("SB1")}
ConOut(ValType(bName))
Return NilCreates block B; assumes neither SB1010 nor product access. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Physical names must not come from arbitrary user input. Resolving a table grants no record access.
- Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.