fairlane.systems

SAP B1 · INTEGRATION

SAP Business One: AI integration via DI-API and Service Layer

SAP Business One is SAP's SME ERP. Two APIs: the DI-API (Java/.NET, low-level) and the Service Layer (REST, modern). AI connects via the Service Layer.

Researched & fact-checked by: · As of: 2026-05

What is SAP Business One?

SAP Business One (SAP B1 for short) is the SME ERP of the SAP family, used worldwide with over 80,000 customers in 170 countries as of May 2026. In contrast to SAP S/4HANA (mid-market to enterprise), B1 targets companies with 10 to 1,000 employees. It runs on two database backends: SAP HANA (modern, in-memory) and Microsoft SQL Server (classic, legacy installations).

For integrations there are two paths that historically exist in parallel. The DI-API (Data Interface API) is the older interface and is used as a COM component (Windows) or Java library. It covers the full B1 data model but depends on a local client and is not web-friendly. The Service Layer is the more modern REST/OData interface, based on HANA, and available since B1 version 9.3 (2018). In current installations from B1 10.0 onwards the Service Layer is the recommended path.

The Service Layer uses session-based authentication. You log in with company database, username, and password, and receive a session cookie that is sent in subsequent requests. Endpoints follow OData v4 conventions: /b1s/v1/BusinessPartners, /b1s/v1/Items, /b1s/v1/Invoices, /b1s/v1/JournalEntries. Filter, pagination, and field selection happen via OData query parameters ($filter, $select, $top, $skip).

Why it matters for Swiss fiduciary

SAP Business One sits in Switzerland mainly in two mandate profiles: medium-sized manufacturing and trading with international supply chains, and subsidiaries of larger foreign groups. If you support such mandates as a fiduciary office, integration into B1 is almost unavoidable as soon as AI-supported analyses are to be offered.

The AI use-cases differ from Bexio/Abacus. With B1 it is less about classic bookkeeping (the internal bookkeeper does that) and more about supply-chain data: enriching supplier master data (example: B1 has a supplier number, the LLM pulls additional data from public sources and writes it back), receipt OCR to the HANA backend (vendor invoices are created via Service Layer as draft invoices), and margin plausibility (sales price vs purchase price per item group).

Hosting is mostly customer-owned, either on-prem in Switzerland or in a private cloud (Azure, AWS). The AI layer then typically sits in the same network as the B1 server, which reduces latency and keeps data sovereignty clear.

How it works

Entry happens in four steps: activate the Service Layer, perform login, store the session cookie, query endpoints.

The Service Layer is active by default in B1 10.0 but runs on a dedicated port (typically 50000 for HANA, 50001 for SSL). In SQL-Server-based installations the Service Layer must be installed separately. The configuration in the B1 Administration Console defines which company database is reachable via the Service Layer and which users have access.

An example login and a follow-up query:

```bash # Login (returns session cookie) curl -X POST "https://b1.customer.ch:50000/b1s/v1/Login" \ -H "Content-Type: application/json" \ -d '{"CompanyDB":"SBODEMOCH","UserName":"manager","Password":"********"}' \ -c cookies.txt

# Fetch all open sales invoices curl -X GET "https://b1.customer.ch:50000/b1s/v1/Invoices?\$filter=DocumentStatus eq 'bost_Open'&\$top=50" \ -b cookies.txt ```

The response comes as an OData envelope with a value array and odata.nextLink for pagination. For AI workflows we typically read data in batches (500 to 5,000 records per run), index it in a vector DB, and use the Service Layer for write operations (create draft invoice, extend business-partner note). Writes happen via POST, updates via PATCH.

An important detail: the Service Layer keeps the session alive as long as requests come in. After more than 30 minutes of inactivity the session becomes invalid; you must re-login. For AI pipelines that run nightly, robust session management with re-login on 401 is essential.

SAP B1 integration in 5 steps

  1. 01Check the B1 version (>=10.0 recommended for Service Layer), clarify the database backend (HANA or SQL Server).
  2. 02Activate the Service Layer and create a technical API user with minimally required permissions.
  3. 03Set up the read pipeline: query OData endpoints (BusinessPartners, Items, Invoices) at the defined cadence, implement pagination via $skip correctly.
  4. 04Implement session management: re-login on 401, heartbeat request every 20 minutes to avoid session expiry.
  5. 05Write operations only via drafts: create DraftInvoice or DraftJournalEntry, final release via the B1 UI by a human.

When to use

The B1 integration is worthwhile mainly for three profiles. First: manufacturing and trade with large supplier bases. Here AI helps with enrichment (credit info, payment behaviour, compliance check). Second: mandates with high receipt volume. Vendor invoices are read via OCR pipeline, pre-coded by AI, and created as draft invoices in B1; the bookkeeper only reviews and releases. Third: group subsidiaries with reporting duties to the parent. The AI generates monthly reports in the structure the parent requires, based on B1 data.

ROI is high, but project-bound. A B1 AI integration is rarely a 2-week sprint; expect 6 to 16 weeks for a productive pipeline. The effort pays off when volume is right: from about 500 vendor invoices per month the investment typically pays off.

When not to use

For mandates with fewer than 200 postings or 100 vendor invoices per month, the effort of a dedicated B1 integration is hard to justify. Manual capture with occasional AI support in Excel or Outlook is sufficient here.

If the mandate still sits on B1 9.2 or older, the Service Layer is missing and integration runs via the DI-API. That is feasible but noticeably more effort: COM components on a Windows server, no web access, higher maintenance overhead. Recommendation: plan a B1 update to 10.0 or later as a precondition of the integration.

Write operations to the general ledger are sensitive and should run only through drafts. Direct JournalEntry insert via Service Layer is possible, but we recommend always going through DraftJournalEntries and leaving final release to a human.

Trade-offs

STRENGTHS

  • Service Layer is modern, REST/OData v4, good tooling support
  • Licence-free in B1 10.0 and later
  • Full B1 data model accessible, from master data to general ledger
  • Draft documents enable safe four-eyes principle

WEAKNESSES

  • B1 9.x and older installations need the DI-API, significantly more effort
  • Session management is idiosyncratic, robust re-login required
  • OData filter syntax takes getting used to for developers without SAP background
  • Write operations to the general ledger are sensitive, should run via drafts

FAQ

DI-API or Service Layer?

Service Layer for new integrations. The DI-API has no HTTP interface and needs a local Windows component, which makes containerisation and cloud deployment difficult. The Service Layer is REST/OData, modern, and simple to integrate.

What does the Service Layer cost?

The Service Layer is included in B1 from 10.0 onwards at no extra licence cost. You pay only the normal B1 user licences and need a technical user. Add-on tools such as SAP Integration Suite are optional.

How do I handle updates?

SAP updates occasionally bring schema changes to the OData model. Implement an abstraction layer between Service Layer calls and AI logic, so that a schema refresh does not bring the whole system down. Run integration tests on every update.

Can I run on-prem and cloud in parallel?

Yes, the AI layer can communicate with an on-prem B1 installation via VPN or reverse tunnel. We recommend TLS and IP whitelisting, plus an audit trail of all write operations.

Related topics

n8n · SERVICEn8n Workflow Automation: routine out, minds freeRECEIPT OCR · USE CASEAI receipt recognition for Swiss documents: structured capture of QR-bills, receipts and PDF invoicesYEAR-END QA · USE CASEAI-supported quality assurance for the annual financial statementREST · GRAPHQL · INTEGRATIONREST vs GraphQL: which API architecture for AI integrations?WEBHOOKS · INTEGRATIONWebhooks and event-based integration: HMAC, idempotency, retryBEXIO API · INTEGRATIONBexio API: AI integration into Swiss fiduciary bookkeepingFIDUCIARY · INDUSTRY HUBAI for Swiss fiduciary offices: a practical guide

Sources

  1. SAP Help Portal: Business One Service Layer Reference · 2026-05
  2. SAP B1 10.0 FP 2502: Release Notes · 2026-04
  3. Gartner: SAP B1 Customer Base Survey 2026 · 2026-03
  4. OData v4 Specification (OASIS) · 2026-05

FITS YOUR STACK?

What this looks like in your business – a 30-minute intro call.

Book a call