Documentation Index
Fetch the complete documentation index at: https://mintlify.com/FCS-Consultores/hechizo-SAP-intercompany/llms.txt
Use this file to discover all available pages before exploring further.
Conexion lives in the Inter_Hechiz.Data namespace and is a purely static initialization class. There is no constructor to call — all public fields are initialized inline using C#‘s static field initializer mechanism, which means every value is computed once when the type is first accessed at program startup. Each field invokes a private method that reads config.ini through the IniFile P/Invoke wrapper. If config.ini is missing or a key is absent, the affected field is set to an empty string and the error is written to the rolling log via RegistroLog.Graba.
Because
Conexion fields are evaluated at class load time (before Program.Main executes), any config.ini read failures will produce empty tokens before the first log message is written. Verify that config.ini is present next to the executable and that all keys are populated before deploying.Service Layer Token Fields
Each company has a dedicated Basic Auth token field. Tokens are generated once at startup byCrearToken and reused throughout the synchronization run. If the Service Layer password or the database name changes, the application must be restarted.
Database Name Fields
ThestrCon field holds the HANA ODBC connection string used for all OdbcConnection instances. The BD_* fields hold the physical HANA schema names for each company and are passed as string arguments to most Intercompany methods.
Typical usage
Key Private Methods
conexionhana
[ConexionHanaProd] in config.ini and assembles the connection string. The DSN key is used as the ODBC driver name (DRIVER=), which must match a registered HDBODBC entry on the host machine.
Returns:
Conexion.strCon. On exception, returns an empty string and logs the error.
config.ini keys read by conexionhana
config.ini keys read by conexionhana
| Key | Section | Description |
|---|---|---|
DSN | ConexionHanaProd | ODBC driver name, e.g. HDBODBC |
SERVERNODE | ConexionHanaProd | SAP HANA host and port, e.g. 172.1.1.170:30015 |
UID | ConexionHanaProd | HANA database user |
PWD | ConexionHanaProd | HANA database password |
CrearToken
Basic <base64> authorization token for use in SAP Business One Service Layer requests. The token encodes the Service Layer username and the target company database name as a JSON object, then combines that JSON with the plaintext password before Base64-encoding the result.
Token construction:
_DB is a logical key string ("BD_Hechizo", "BD_sur", etc.) that is resolved to the physical HANA schema name via a switch block before being embedded in the credentials JSON. On exception, logs the error and returns an empty string.
config.ini keys read by CrearToken
config.ini keys read by CrearToken
| Key | Section | Description |
|---|---|---|
UserSL | ConexionHanaProd | SAP Business One Service Layer username |
PassSL | ConexionHanaProd | SAP Business One Service Layer password |
Consultar_xxx Methods
Each company has a corresponding private Consultar_ method (e.g. Consultar_Hechizo, Consultar_sur, Consultar_omdo, etc.) that reads a single key from [ConexionHanaProd] in config.ini and returns the physical HANA schema name. The key name matches the logical branch name (ORIGEN for Hechizo, sur, omdo, nedn, hogar, flores, vital, emde, central, desampa).
CrearToken’s switch block to resolve logical keys to physical names.
ConexionSAP (DI-API companion)
Inter_Hechiz.Data namespace). It holds a single SAPbobsCOM.Company instance for direct SAP DI-API calls. In the current codebase, ConexionSAP is used by ConexionDiapi.Open() to establish a DI-API session for attachment operations.
config.ini Section Reference
All connection configuration is stored in a single config.ini file placed next to the application executable. The file is read at startup by the static field initializers and again inside each method that needs the Service Layer URL.