SAP Business One Import

Data extraction from SAP Business One and import into Bilendo: keys, clearing, orders, and delta runs.

This page describes how data is extracted from SAP Business One, flattened, and handed over to Bilendo. It applies to both methods (pull and push; see the SAP Business One Hub page). The fields themselves are listed in the SAP Business One architecture.

How the data is extracted

Each SAP Business One company is its own database (SAP HANA or Microsoft SQL Server) and is extracted separately. The tables are already relational, so the preferred method is a read-only SQL query against this database for each category (customers, open items, cleared items, and optionally open, undelivered orders). Without database access, the Service Layer (OData: BusinessPartners, JournalEntries, Invoices, Orders) provides the same facts with paging and $filter; the DI API is the fallback for on-premise add-ons. The field names are the B1 table fields; the Service Layer simply spells them differently.

How the data is flattened

Each category is delivered as ONE flat table (CSV or SQL result), with one row per key, column header = field name, and no nested structures. The open amount and clearing date are calculated on the SAP side and delivered as ready-made columns; Bilendo does not recalculate them.

SAP Business One (one company database)
|
+- OCRD + CRD1 + OCPR -------------------------> 1) Customers, one row per CardCode
|     CardType = 'C', billing address, contact
|     Key: CompanyCode + CardCode, once per file
|
+- JDT1 (customer lines only, via OCRD)
|     Key: CompanyCode + TransId + Line_ID, never changes
|     + OJDT          Header text, creation date
|     + OINV / ORIN   Invoice number (TransType 13 / 14)
|     + ITR1 + OITR   Reconciliation (clearing)
|     |
|     |  OpenAmount   = BalDueDeb - BalDueCred
|     |  ClearingDate = latest ReconDate, only if OpenAmount = 0
|     |
|     +-- OpenAmount != 0 ---------------------> 2) Open items, key TransId + Line_ID
|     |
|     +-- OpenAmount = 0 and reconciled -------> 3) Cleared items, same template
|
+- ORDR + RDR1 (optional) ---------------------> 4) Open, undelivered orders, one row per order
      Key: CompanyCode + CardCode + DocNum
      each delivery = ALL open orders, no delta

1) to 4)  ->  flat CSV / SQL result  ->  Bilendo import

Keys and duplicates

Bilendo builds its keys from the delivered columns. A duplicate in the receivables sub-ledger leads to wrong balances, so the following rules are strict. Within ONE batch (one delivery object), Bilendo recognizes a repeated key as a duplicate and does not accept it. Across separate deliveries, the newer one overwrites the values of the older one under the same key (customers and postings; orders work differently, see below).

Cleared items

Cleared items use the SAME template as the open items: the same fields, the same flat table, and the same key (CompanyCode + TransId + Line_ID); only the selection differs, so they are delivered as a second extract (or in the same file, as long as the key is unique). A cleared item is the later state of an open item: it arrives with the key it already has.

Open, undelivered orders

Orders (optional) are a snapshot, not a stream of changes. Bilendo builds the order key from CompanyCode + CardCode + DocNum, and nothing is overwritten: with every delivery, Bilendo archives all order records it received before and creates the records of the new delivery as new ones.

Delta runs

Customers (master data): The first run delivers all customers. Later runs deliver new customers (OCRD.CreateDate) and changed customers (OCRD.UpdateDate), looking back one day, each under the same key (CompanyCode + CardCode), so that the newer values replace the older ones. A change to the billing address or contact person belongs to the customer: confirm on the customer's instance that such a change moves OCRD.UpdateDate; if it doesn't, every run delivers all customers, which the key rules make safe. Recommended: send a run's customers before its postings, so that a posting never points to a customer that Bilendo doesn't yet know.

Postings (transaction data): New postings are found via OJDT.CreateDate (re-read one day back); a change to an existing posting (OJDT.UpdateDate) arrives again with the same key. An open amount also changes when a line is reconciled, without a new posting: re-read every line with an open balance, plus the lines reconciled since the last run (OITR.ReconDate). A canceled reconciliation (Canceled = 'Y') sets the line back to open: it returns under the same key when open items are re-read, with OpenAmount above 0 and no reconciliation date, and drops out of the reconciled items.

Orders: no delta. Every run delivers the complete snapshot of open, undelivered orders.

Please verify on your system
The table and field names follow the SAP Business One standard schema. Customized installations (user-defined fields, add-ons, a different B1 version) may differ: before the first extraction, have your SAP partner confirm joins and field names on your own instance. The look-back period for reconciled items is agreed upon for each customer. Dunning level and dunning block have no standard field in B1 and therefore are not part of this page; if you keep them in a user-defined field, we will include it as a custom field. Two cases would change a key and must be clarified with the customer before the first extraction: manual postings (TransType 30) can be changed afterward in SAP Business One, and if lines are inserted or removed, Line_ID can shift; and a renamed business partner code is a new customer key.