Once purchase orders exist in a branch and the corresponding goods have been delivered, Hechizo raises AR invoices (FacturaDeudor) against each branch company. Hechizo SAP Intercompany automatically mirrors those invoices as AP invoices (FacturaProveedor) in the branch, closing the commercial loop between the hub and its subsidiaries. The same mirroring applies to AR credit notes. Incoming payments complete the cycle: because intercompany settlements can originate in any company and be received by any other, the payment sync covers every ordered pair across the entire 10-company network (Hechizo plus 9 branches), totaling 90 calls per execution cycle.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.
Duplicate prevention for all invoice, credit note, and payment documents is enforced by checking
U_DocEntryOrigen before creating a new record. If a document with that origin DocEntry already exists in the destination company, the creation is skipped. This field is set on every document created by the sync application and must not be cleared or modified manually.AR Invoices → AP Invoices
When Hechizo issues an AR invoice to a branch,ProcesarFacturaProveEnSucursales reads that invoice and creates the corresponding AP invoice in the branch, using the branch’s own open purchase order as the base document. Lines carry BaseType, BaseEntry, and BaseLine references so SAP B1 correctly links the AP invoice to its purchase order.
Create
OINV / INV1 tables for open, uncancelled invoices with U_Estado = 'N' whose U_OrigenIntercompany matches the branch database name or whose CardCode matches the branch’s intercompany partner. For each invoice:
- Resolves the branch purchase order
DocEntrythat underlies the invoice’s base sales order. - Reads header and line data from the branch
OPOR/POR1tables. - Sets
U_DocEntryOrigen,U_DocNumOrigen, andU_OrigenIntercompanyon the new AP invoice. - Posts to
PurchaseInvoiceson the branch Service Layer endpoint. - Marks the Hechizo
OINVrecord withU_Estado = 'Y'and stores the branchDocEntry/DocNum.
U_DocEntryOrigen.
AR Credit Notes → AP Credit Notes
Credit notes issued by Hechizo against a branch are mirrored as AP credit notes (NotaCredProveedor) in the branch using a symmetric create-then-update pattern. Two method variants exist to handle a historical schema difference in theomdo branch.
Create — standard branches
omdo company database. All other branches use the standard method.
Incoming Payments
ProcesarEnPagoRecibido reads incoming payments from bdOrigen’s OVPM table where U_Intercompany = 'Y', Canceled = 'N', U_Estatus = 'N', and U_DestinoIntercompany matches bdDestino. It then constructs an IncomingPayments payload and posts it to bdDestino’s Service Layer.
Key transformations applied during the process:
U_OrigenIntercompanyis set tobdOrigenon the created payment.DocTypeis forced torAccount(account payment).- The destination bank account is sourced from
U_BancoDestinoon the origin payment. - The bank reference is sourced from
U_RefBancaria. - For USD payments, the
TransferSumand line amounts are divided byDocRateto convert to the functional currency.
VPM4 and included as PaymentAccounts in the JSON payload.
Example calls
Document payload structure
The following is a real JSON payload captured fromLogJson_20260527.txt, representing a purchase order created in branch 10071_3_102_956112 from Hechizo sales order 1509:
U_DocEntryOrigen and U_DocNumOrigen store the Hechizo-side document keys. U_OrigenIntercompany holds the full HANA schema name of the source company. These three fields together form the cross-company document reference that all subsequent update and duplicate-check operations rely on.
UDF reference for invoices and payments
| UDF | Table | Purpose |
|---|---|---|
U_Estado | OINV, ORIN | Processing flag: 'N' = pending, 'Y' = processed |
U_Estatus | OVPM | Payment processing flag: 'N' = pending, 'Y' = processed |
U_DocEntryOrigen | OPCH, ORPC, OVPM | DocEntry of the source document in the origin company |
U_DocNumOrigen | OPCH, ORPC, OVPM | Human-readable DocNum of the source document |
U_OrigenIntercompany | OINV, ORIN, OPCH, ORPC, OVPM | Full HANA database name of the originating company |
U_Intercompany | OVPM | Marks a payment as an intercompany payment eligible for sync ('Y') |
U_DestinoIntercompany | OVPM | Full HANA database name of the intended payment destination |
U_BancoDestino | OVPM | Bank account code to use in the destination company |
U_RefBancaria | OVPM | Bank transfer reference number |
U_ComentarioError | All document tables | Service Layer error message on failed sync attempts |