SAP Business One Service Layer Sales Order Request Generator
The SAP Business One Service Layer exposes business objects such as sales orders as REST resources. Getting the first login and order request right is the usual hurdle for integration developers, so this tool generates both from your values.
Fill in
1. Log in
POST https://b1server.example.com:50000/b1s/v1/Login
Content-Type: application/json
{
"CompanyDB": "SBODEMOUS",
"UserName": "api_user",
"Password": "<your password>"
}2. Create the sales order
POST https://b1server.example.com:50000/b1s/v1/Orders
Content-Type: application/json
Cookie: B1SESSION=<session id from login response>
{
"CardCode": "C20000",
"DocDueDate": "2026-11-15",
"NumAtCard": "PO-77415",
"DocumentLines": [
{
"ItemCode": "A00001",
"Quantity": 10,
"UnitPrice": 125.50
},
{
"ItemCode": "A00002",
"Quantity": 4
}
]
}3. Read it back
GET https://b1server.example.com:50000/b1s/v1/Orders?$filter=NumAtCard eq 'PO-77415'&$select=DocEntry,DocNum,CardCode,DocTotal Cookie: B1SESSION=<session id>
Verify the base path, port and entity names for your version, since Service Layer paths and supported fields differ between releases. Line two omits UnitPrice so the system applies the price list. Never commit passwords. Log out with POST /b1s/v1/Logout when done and test in a non-production company first.
Integration review
Optional review of your Service Layer integration design, error handling and security.
Optional. The tool and every export work without this. No spam.
How to use it
Enter your Service Layer host and port, company database, user and the business data for the order. Copy the generated Login request, send it with any REST client, and take the session ID from the response. Then send the Orders request with that session cookie. The third block reads the order back by customer PO number.
How the API is shaped
Login returns a session ID that you send as the B1SESSION cookie. Documents are created by POST to their collection, such as Orders, with header fields at the top level and an array of DocumentLines. Field names follow the business object schema, for example CardCode, DocDueDate, ItemCode and Quantity. Queries use OData options like filter and select.
- Sessions time out, so handle re-login on a 401
- Omitting UnitPrice lets the price list apply
- Use NumAtCard to store the customer's PO reference
Testing and safety
Create the order in a test company first, then check it in the client. Use a dedicated API user with limited authorisations. Keep passwords in a secret store, not in scripts. Record the returned DocEntry and DocNum in your integration log so you can trace each order back to its source.
Common mistakes
Forgetting the session cookie, sending numbers as strings, using a date format the server rejects, passing an inactive item or customer code, and posting duplicates after a timeout. Make integrations idempotent by checking NumAtCard before creating the order.
Frequently Asked Questions
What is the Service Layer?
It is the REST and OData based API of SAP Business One for HANA and SQL versions that lets external applications read and write business objects over HTTPS. Availability and details depend on your version.
Why does my POST return an authentication error?
Usually the session cookie is missing or expired. Log in again and send the B1SESSION value on every request. Also check the user has authorisation for the object.
How do I avoid duplicate orders?
Query by a unique reference such as NumAtCard before you post, and store the returned DocEntry. If a request times out, check for the order before retrying.
Can I create other documents the same way?
Yes. Deliveries, invoices, purchase orders and business partners follow the same pattern with their own collections and field names. Check the entity reference for your version.
If you want an integration between your e-commerce, EDI or shop floor and SAP Business One reviewed or built, Netray can help. The generator is free on its own.
Related Tools
SAP B1 Warehouse Bin Location Capacity Planner
An editable worksheet to list bin codes, dimensions and fill factor, compute usable volume and plan bins before you load them into a B1 warehouse.
SAPSAP Business One License and 5-Year TCO Calculator
Enter professional and limited user counts, prices from your quote, maintenance and services ratio to see total cost of ownership over your horizon.
SAPSAP B1 Early Payment Discount Calculator
See the implied annual return of taking a supplier's early payment discount and compare it with your cost of capital before setting payment terms.
SAPSAP B1 Production Order Cost Variance Calculator
Compare actual to standard on a closed production order and see how much of the variance is material, labor rate and labor efficiency.
More Developer Tools tools
See all- SAP Business One Service Layer Request Builder
- SAP Business One DI API Sales Order Code Generator (C#)
- SAP Sales Order ABAP SELECT Generator (VBAK, VBAP, VBFA)
- SAP Sales Order Create BAPI ABAP Generator (BAPI_SALESORDER_CREATEFROMDAT2)
- SAP ABAP Open Items SELECT Generator
- SAP ACDOCA SQL Query Generator
- SAP QM Inspection Lot ABAP SELECT Generator
- SAP Quality Notification Pareto SQL Query Generator
- SAP QM Usage Decision BAPI Skeleton