Skip to content
SyncMyShop

Systems

SAP Business One integration with your online store, through the Service Layer

SAP Business One gives an integration the Service Layer: OData over HTTPS, a session that expires after 30 minutes and pages of 20 records by default. We build the integration on it, map your price lists and special prices to what the store can show, then host and run it.

What SAP Business One is and who runs it

SAP Business One is SAP's ERP for small and midsize companies: accounting, sales, purchasing, inventory, warehousing and production in one database per company. SAP positions it apart from S/4HANA, which it sells to organizations of all sizes, and implementation runs through SAP partners. It is common at wholesale distributors, importers and manufacturers, often as the system of a subsidiary inside a larger group.

It runs on your own server or at a hosting partner, on SAP HANA or on Microsoft SQL Server. Those two choices, database and version, decide which API an integration gets. A HANA installation has the Service Layer. A SQL Server installation has it from version 10.0 PL01. Below that, the DI API and the DI Server are what is left.

What connects to SAP Business One

SAP Business One is the system of record for items, stock, prices and invoices. The store owns the order and new customers. These are the flows we build as part of an e-commerce ERP integration, with the Service Layer entity each one uses:

Flow Direction Service Layer entity
Orders store to SAP Orders with DocumentLines
Customers store to SAP BusinessPartners with BPAddresses
Items SAP to store Items
Stock per warehouse SAP to store ItemWarehouseInfoCollection on Items
Price lists SAP to store ItemPrices on Items
Special prices per customer SAP to store SpecialPrices
Deliveries and invoices SAP to store DeliveryNotes, Invoices

An order goes in with its lines in one call:

POST /b1s/v2/Orders
Cookie: B1SESSION=PTRzIjYK-weN6-1Lx1; ROUTEID=.node1
Content-Type: application/json

{
  "CardCode": "C10432",
  "NumAtCard": "WEB-100482",
  "DocDueDate": "2026-10-05",
  "DocumentLines": [
    { "ItemCode": "KB-2210", "Quantity": 120,
      "UnitPrice": 9.60, "WarehouseCode": "01", "TaxCode": "CA-SF" }
  ]
}

SAP answers with two numbers: DocEntry, the internal key, and DocNum, the order number your staff see. The integration stores both next to the store order number, so a delivery or invoice created later in SAP can be traced back to the store order. The fields per flow are on orders and fulfillment.

How SAP Business One exposes data

Service Layer, DI API and DI Server

SAP Business One has three APIs on the same business objects. The Service Layer is an OData service over HTTPS on port 50000 by default: /b1s/v1 for OData version 3, /b1s/v2 for version 4, JSON in both. The DI API is built on Microsoft COM and runs only on Windows. The DI Server offers the same objects over SOAP.

We build new integrations on the Service Layer. SAP lists what it cannot do that the DI API can: direct SQL through a RecordSet, import and export of XML, and transactions that span more than one call. For reads outside the standard entities there is SQLQueries from 10.0 FP 2011: a stored query that the integration runs through the Service Layer. SAP's guide Working with SAP Business One Service Layer has the full description.

A session instead of a token

The integration logs in with POST /b1s/v2/Login, sending the company database, a user name and a password. It gets back a B1SESSION cookie with a SessionTimeout of 30 minutes, plus a ROUTEID cookie that keeps the session on the same node behind SAP's load balancer. Every later call sends both. After 30 minutes without a call the session is gone, and the next call returns 401 with "Invalid session or session already timeout". SAP calls a login a heavy job, so the integration reuses one session and logs in again only after a 401. The SAP user it logs in with is a normal user, and that user's authorizations decide what the integration can read and write.

Limits that are settings

SAP documents no request rate limit for the Service Layer. Throughput depends on your server and on these settings:

Setting Default Where it is changed
Records per page 20 PageSize in b1s.conf, or per call with Prefer: odata.maxpagesize
Session timeout 30 minutes SessionTimeout
Webhooks per company 16 MaxNumberOfWebHooks
Webhook message lifetime 24 hours MessageTTL
Webhook request timeout 10 seconds WebhookRequestTimeout

The page size decides how many calls a full read takes. Worked through for a catalog of 40,000 items: at the default of 20 that is 40,000 / 20 = 2,000 calls, each following an @odata.nextLink. With Prefer: odata.maxpagesize=1000 it is 40 calls. Special prices add to it: 300 customers with 150 special prices each are 45,000 rows, which is 45 pages of 1,000. The integration asks only for the fields the store uses with $select, and after the first full run reads only what changed since the last one. The method is in integration throughput.

Webhooks from FP 2602

From SAP Business One 10.0 FP 2602 the Service Layer sends a notification when an event happens, for example sap.b1.Orders.Created.v1. Orders have six events: created, updated, deleted, closed, cancelled and reopened. Webhooks are off per company by default and need the Webhook Messenger Service on the server.

SAP's guide gives two retry policies: the configuration table says 3 retries 2 seconds apart, its FAQ says up to 5 retries from 2 to 32 seconds. Either way the retries are over within about a minute. A receiver that is down for longer loses the notification, and SAP warns that retries can deliver the same event twice. Next to the webhooks we therefore run a check on the update date, and on versions before FP 2602 that check is the only route. See webhooks are not a guarantee.

Where an SAP Business One integration gets stuck

Special prices per customer

An item has a price per price list in ItemPrices, and a business partner points to one price list through PriceListNum. On top of that come special prices: a price or discount for one item and one customer in SpecialPrices, with periods (DateFrom, Dateto) and per period a quantity scale. SAP's training material states that a special price for a business partner overrides all other prices.

How SAP Business One arrives at the price for one customer A price for item KB-2210 and customer C10432 comes from four layers. The customer's price list gives 10.00 dollars, a special price for the customer gives 9.80, a period from January 1 to December 31, 2026 gives 9.60, and a quantity scale inside that period gives 9.20 from 200 units. The most specific layer wins. most specific layer wins Wholesale: $10.00 Price list PriceListNum on the business partner $9.80 Special price SpecialPrices for CardCode C10432 2026: $9.60 Period DateFrom and Dateto on the special price from 200 units: $9.20 Quantity scale Quantity inside that period
One item, one customer, four layers. The integration resolves them into a price the store can show and keeps track of when a period ends.

Worked through for the example in the diagram: an order of 120 units of KB-2210 for C10432 in 2026 gets the period price, 120 × $9.60 = $1,152.00. An order of 250 units hits the scale, 250 × $9.20 = $2,300.00. Most store platforms have no model for four layers with dates, so the integration resolves them into what the platform supports, such as a catalog or price list per customer and a quantity rule, and changes the store price on January 1, 2027, the day the period ends. See customer-specific pricing.

Stock per warehouse is three numbers

Per item and warehouse SAP returns InStock (in the warehouse), Committed (committed to customers) and Ordered (ordered from vendors). None of them is the number the store should show. With 20 in stock in warehouse 01, 4 committed and 10 on order, 20 - 4 = 16 can be sold; the 10 on order count once they arrive. Which warehouses count for the store is set per integration, as described in multi-location inventory.

Keys, addresses and sales tax

Field What SAP documents What it means for the mapping
CardCode customer key, 15 characters, mandatory the store knows a customer by email; a mapping table sits between them
NumAtCard customer reference, 100 characters holds the store order number
Street 100 characters street and house number usually share this field
StreetNo "For Brazil only" in the SDK reference the house number stays in Street
TaxCode on a line US sales tax code, 8 characters the store's tax per destination has to resolve to one code
WarehouseCode on a line 8 characters the line names the warehouse that ships it

Sales tax is where US orders stop. The store calculates tax by ship-to address; SAP Business One expects a TaxCode on each line, a code defined in your company for the sales tax of the location where the sale takes place. The integration maps each ship-to location to its code and holds an order whose location has no code, with the address in the message, instead of posting it with the wrong tax. Address splitting is covered in address field mapping.

By default a PATCH overwrites an order even when an employee changed it a second earlier. From 10.0 FP 2102 the Service Layer returns an ETag on orders, deliveries and invoices. The integration sends it back in If-Match; when the order has changed in the meantime, SAP answers 412 Precondition Failed with error -2039, and the integration reads the new version before it tries again.

Platforms we integrate with SAP Business One

The integration is built on your installation: your version, your database, your price lists and user-defined fields. Each store platform has its own pair page:

  • Shopify SAP integration: business partners against Shopify companies, special prices against catalogs, Shopify's GraphQL cost budget against SAP's session.
  • Magento SAP integration: price lists and special prices against Magento's customer groups and tier prices, configurable products against SAP items.

The platform side is on Shopify, Magento and WooCommerce. For other ERPs, see Business Central and NetSuite.

We build the integration for a fixed price, then host it, monitor it and fix it when SAP or the store platform changes something, for a monthly fee. Before go-live it runs as a dry run that writes nothing: you see per order which business partner, price and lines would be created in SAP. Every integration comes with a dashboard, logs and a per-run diff. Tell us which version and database you run.

Frequently asked questions

Which API does the integration use: Service Layer or DI API?

The Service Layer, wherever it is available. It is OData over HTTPS with JSON, and SAP builds it on the same DI core as the DI API, so the objects and properties are the same. The DI API is a COM library that runs only on Windows next to SAP Business One and is not built for multithreading. We use it only where an installation has no Service Layer.

Does it work with SAP Business One on Microsoft SQL Server?

Yes, from SAP Business One 10.0 PL01. From that version the Service Layer also runs on Windows and with SQL Server; before it, the Service Layer was part of the SAP HANA version only. An older SQL Server installation leaves the DI API and the SOAP-based DI Server.

Is this the same as an SAP S/4HANA or SAP ECC integration?

No. SAP positions Business One for small and midsize companies and S/4HANA for organizations of all sizes. They are separate products with separate databases and APIs. Everything on this page about sessions, entities and fields applies to SAP Business One only.

Does SAP Business One have webhooks?

From SAP Business One 10.0 FP 2602. They are switched off per company by default, a company can create 16 by default, and a separate Webhook Messenger Service has to run on the server. A notification carries the key of the record and optional properties you configure. On an older version the integration polls on the update date.

Do our user-defined fields come along?

Yes. User-defined fields carry the prefix U_ and sit on the same entity as the standard fields, so an order or item is read and written in one call with them. SAP lists one limitation: a newly created user-defined field is not accessible until the Service Layer is restarted. We plan that restart with you when a new field is added.

How do you stop a timeout from creating a second order?

The store order number goes into NumAtCard, the customer reference on the document, which holds 100 characters. Before a retry the integration queries open orders for that reference. A call that timed out after SAP saved the order is therefore found and not sent again. See duplicate customers and orders.

Tell us what you need

Tell us which systems you use and what needs to work better. We reply personally within one working day. We help you define the work, then agree the price and timing before you commit.

  • You know the price and the timeline before you commit to anything
  • We work out the connection that takes the work off your hands
  • We handle the build, hosting, monitoring and maintenance
  • Your team has less information to retype and fewer discrepancies to chase

Suppliers, products, orders per day, a rough estimate is fine.

Or email directly: carsten@syncmyshop.com