Skip to main content

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.

Getting the synchronization engine running requires satisfying a small set of infrastructure prerequisites, building the project for the correct platform target, and dropping a single configuration file next to the executable. The four steps below take you from a fresh clone to a working scheduled sync.
1

Prerequisites

Verify that every dependency is in place on the machine that will run the sync before you attempt a build or execution.Runtime and build tools
  • .NET Framework 4.8 Developer Pack (SDK + targeting pack) installed on the build machine
  • Visual Studio 2019 or later (Community edition is sufficient) with the .NET desktop development workload
  • x64 operating system — the project targets x64 due to the SAPBusinessOneSDK.dll dependency
SAP HANA connectivity
  • SAP HANA ODBC driver (HDBODBC) installed and registered in the Windows ODBC Data Source Administrator. The DSN value in config.ini must reference this driver using the syntax {HDBODBC}.
  • Network access to the SAP HANA server on port 30015 (HANA SQL / ODBC)
SAP Business One Service Layer
  • SAP Business One Service Layer accessible at https://your-hana-server:50000/b1s/v1/
  • A dedicated SAP B1 user (e.g. Hechizo06) with permissions to read and write items, business partners, orders, invoices, payments, and GL accounts across all ten company databases
  • Network access to the Service Layer HTTPS port (50000 by default) from the machine running MCH_IC.exe
The SAPBusinessOneSDK.dll referenced in the .csproj is resolved from an absolute path (C:\Users\consult07\source\repos\proyectoprueba\SAPBusinessOneSDK.dll). Before building on a new machine you must update the HintPath in MCH_IC/Inter_Hechiz.csproj to point to the copy of the DLL on your local file system.
2

Clone and Build

Clone the repository and open the solution in Visual Studio. The project must be compiled for the x64 platform — the SAPBusinessOneSDK.dll is a 64-bit assembly and the build will fail or produce a non-functional binary under AnyCPU or x86.
git clone https://github.com/FCS-Consultores/hechizo-SAP-intercompany.git
cd hechizo-SAP-intercompany
# Open Inter_Hechiz.sln in Visual Studio and build x64|Debug or x64|Release
In Visual Studio:
  1. Open Inter_Hechiz.sln.
  2. In the toolbar platform dropdown, select x64 (not Any CPU).
  3. Choose Debug or Release from the configuration dropdown.
  4. Press Ctrl+Shift+B (Build Solution).
The compiled output lands in:
  • Debug: MCH_IC/bin/x64/Debug/MCH_IC.exe
  • Release: MCH_IC/bin/x64/Release/MCH_IC.exe
3

Configure config.ini

config.ini is not embedded in the binary — the application reads it from the same directory as MCH_IC.exe at startup using Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location). Copy the file to your output directory (bin/x64/Debug/ or bin/x64/Release/) and fill in the [ConexionHanaProd] section with your environment’s values.
[ServiceLayer]
UrlSL=https://your-hana-server:50000/b1s/v1/
UID=SYSTEM
PWD=YOUR_SYSTEM_PASSWORD
DATABASENAME=NDB

[ConexionHanaProd]
UserSL=Hechizo06
PassSL=YOUR_SERVICE_LAYER_PASSWORD
DSN={HDBODBC}
SERVERNODE=your-hana-server:30015
UID=SYSTEM
PWD=YOUR_HANA_ODBC_PASSWORD
DATABASENAME=NDB
ORIGEN=10071_HECHIZO_DEP
sur=10071_DEPORTES_SUR
omdo=10071_OMDO
nedn=10071_NEDN
hogar=10071_HOGAR_IDEAL
flores=10071_FLORES_DEP
vital=10071_ENC_VITAL
emde=10071_EMDE
central=10071_AVECENTRAL
desampa=10071_3_102_956112

[CodSocio]
ORIGEN=PL00001
sur=2703
omdo=2704
nedn=2706
hogar=2776
flores=2731
vital=2775
emde=2705
central=2738
desampa=CL00041
Key fields reference
FieldUsed byDescription
UserSLConexion.CrearToken()SAP B1 username embedded in every Basic Auth token
PassSLConexion.CrearToken()SAP B1 user password — combined with UserSL and CompanyDB to produce each company’s token
DSNConexion.conexionhana()ODBC driver name; must match the installed HANA ODBC driver string
SERVERNODEConexion.conexionhana()HANA host and SQL port, e.g. hana-007:30015
ORIGENConexion.Consultar_Hechizo()SAP database name for the hub (Hechizo) company
surdesampaConexion.Consultar_*()SAP database names for each of the nine branch companies
[CodSocio]Runtime lookupsInternal business partner codes used when creating intercompany partner records
The UrlSL key in [ServiceLayer] is read directly by Intercompany.cs as the base URL for every Service Layer REST call (e.g. POST {UrlSL}Manufacturers). Ensure it points to your actual SAP Business One Service Layer endpoint, typically https://your-hana-server:50000/b1s/v1/. The SERVERNODE key in [ConexionHanaProd] is used separately for the HANA ODBC connection string.
4

Run the Sync

Execute MCH_IC.exe directly or invoke it from a script. The console window disappears immediately — this is intentional (OcultarConsola.DisappearConsole() is called as the very first statement in Main()). The process runs to completion in the background and then exits.
# Run from the output directory
cd MCH_IC\bin\x64\Debug
MCH_IC.exe
Monitoring progressAll activity is written to a daily rolling log file in the Log/ subdirectory next to the executable:
MCH_IC/bin/x64/Debug/Log/Log_20260113.txt
Each entry is timestamped in HH:mm:ss tt format. Successful operations produce confirmation lines (e.g. Cliente Creado : CL00009/ Hora: 11:28:31 AM). Errors include the full exception message and the operation context (e.g. Error en Orden Compra, ERROR [IM002] ...).A full sync cycle touches hundreds of API calls across all ten companies. Execution time depends on the volume of unsynced records and Service Layer response latency — plan for several minutes per run in a production environment.
Errors that cannot be resolved mid-run are persisted to the custom SAP table @SINCROERROR via Data.Intercompany.SINCROERROR_V2(), which is the first method called in Main(). This means you can query SELECT * FROM "@SINCROERROR" directly in SAP HANA Studio or from within SAP Business One’s user-defined table viewer to see any records that failed to sync during the last execution.
Use Windows Task Scheduler to run MCH_IC.exe on a recurring schedule (hourly or nightly is typical for intercompany sync workloads). Create a basic task, set the action to Start a program, point it at the full path of MCH_IC.exe, and set the Start in field to the directory containing config.ini and the Log/ folder. Because the console hides itself, the task runs silently with no visible window.

Build docs developers (and LLMs) love