Document Header Fields
The universal marketing-document header fields shared by every SAP B1 sales and purchasing document โ CardCode, dates, totals, status, and the copy-chain links.
Every transactional document in SAP Business One โ Sales Quotation, Sales Order,
Delivery, A/R Invoice, Purchase Order, GRPO, A/P Invoice, Credit Note, and the rest
โ is the same Document entity in the Service Layer. There is only one
EntityType for all of them; the individual type is distinguished by the
DocObjectCode field (see the Codes and Enums reference). Because of this, the
header fields described here are shared across every marketing document: learn them
once and they apply everywhere.
The header is the “top” of a document โ the party, the dates, the currency, the
totals, and the status. The individual goods or services sit in the
DocumentLines collection (see the Document Line Fields reference).
The party and its addresses
Every document is raised against exactly one Business Partner. The header names that partner and pins the addresses used for delivery and billing.
| Field | Type | Meaning | Required? |
|---|---|---|---|
CardCode | Edm.String | Business Partner code โ the customer (sales) or vendor (purchasing). Foreign key into BusinessPartners. | Yes |
CardName | Edm.String | Business Partner name. Defaults from the BP master but can be overridden per document. | No (defaults from BP) |
ContactPersonCode | Edm.Int32 | The named contact at the BP for this document. | No |
ShipToCode | Edm.String | Ship-to address code (selects one of the BP’s addresses). | No |
PayToCode | Edm.String | Pay-to / bill-to address code. | No |
Address | Edm.String | Rendered bill-to address text. | No |
Address2 | Edm.String | Rendered ship-to address text. | No |
CardCode is the one field you almost always must supply on create; nearly
everything else on the header can default from the BP master or the company
configuration.
Dates โ the SAP gotcha
SAP B1 documents carry three business dates. All of them are Edm.String, not a
date type, formatted yyyymmdd (e.g. 20250131). This is the single most common
mistake when integrating: do not send an ISO timestamp, and filter with string
comparison, not date functions.
| Field | Type | Meaning | Required? |
|---|---|---|---|
DocDate | Edm.String (yyyymmdd) | Posting date โ the date the document takes accounting effect. | Yes (defaults to today) |
DocDueDate | Edm.String (yyyymmdd) | Due date (payment due for invoices; delivery/target date otherwise). | Yes (defaults from payment terms) |
TaxDate | Edm.String (yyyymmdd) | Tax point date โ the date used to pick the VAT rate/period. | No (defaults to DocDate) |
CreationDate | Edm.String (yyyymmdd) | When the record was created (read-only). | Read-only |
UpdateDate | Edm.String (yyyymmdd) | When the record was last changed (read-only). | Read-only |
Filter example (note the quoted string literals):
$filter=DocDate ge '20250101' and DocDate le '20251231'Amounts and currency โ the other gotcha
Every monetary field is Edm.Double, not a decimal type. A document can be
denominated in the local, system, or a foreign currency, and SAP stores the total
in each.
| Field | Type | Meaning | Required? |
|---|---|---|---|
DocTotal | Edm.Double | Grand total in the document currency (incl. tax). Usually computed by SAP from the lines. | No (computed) |
DocTotalSys | Edm.Double | Grand total in the system currency. | Read-only |
DocTotalFc | Edm.Double | Grand total in the foreign currency. | Read-only |
VatSum | Edm.Double | Total VAT/tax amount on the document. | No (computed) |
DocCurrency | Edm.String | Currency code for the document (e.g. EUR, USD). | No (defaults from BP) |
DocRate | Edm.Double | Exchange rate to the local currency at posting time. | No |
DiscountPercent | Edm.Double | Header-level discount applied to the whole document. | No |
DownPayment | Edm.Double | Down-payment amount linked to the document. | No |
Do not compute totals client-side and trust them. Send the lines and let SAP total the document;
DocTotalandVatSumare derived from the line values and the tax codes.
Status and lifecycle
A document’s status drives whether it can still be copied forward, edited, or closed. The header exposes several status/flag fields.
| Field | Type | Meaning | Required? |
|---|---|---|---|
DocumentStatus | SAPB1.BoStatus | Open / Closed / Paid / Delivered โ the lifecycle state. | Read-only |
Cancelled | SAPB1.BoYesNoEnum | Whether the document was cancelled (tYES/tNO). | No |
DocType | SAPB1.BoDocumentTypes | Items (dDocument_Items, 0) vs Service (dDocument_Service, 1) document. | No |
DocumentStatus is the field most reports filter on. Its two everyday values:
bost_Open(0) โ the document is still live: not fully copied forward, not fully paid, not closed. Open sales orders are the backlog; open invoices are the receivables.bost_Close(1) โ the document is finished: fully drawn into a follow-on document, fully paid, or manually closed. It no longer contributes to open balances.
(Some contexts also expose bost_Paid (2) and bost_Delivered (3); see the
Codes and Enums reference for the full BoStatus enum.)
Filter example:
$filter=DocumentStatus eq 'bost_Open' and Cancelled eq 'tNO'The copy chain โ Base* referencing fields
SAP B1 documents are linked in a chain: a Quotation is copied into an Order, the
Order into a Delivery, the Delivery into an Invoice. This “copy forward” is recorded
at the line level (BaseType/BaseEntry/BaseLine on each DocumentLine;
see the Document Line Fields reference), which is what makes cross-document
tracing possible.
At the header level the two identity fields anchor the document itself:
| Field | Type | Meaning | Required? |
|---|---|---|---|
DocEntry | Edm.Int32 | Internal primary key โ the unique row id. Referenced as a line’s BaseEntry by the next document in the chain. | Read-only (system-assigned) |
DocNum | Edm.Int32 | User-visible document number (per numbering series). | Read-only |
DocObjectCode | SAPB1.BoObjectTypes | Identifies the document type (e.g. oOrders=17). Referenced as a line’s BaseType. | Read-only |
Series | Edm.Int32 | Numbering series that assigned DocNum. | No |
To trace where a document came from you read the lines’ Base* fields; to be
traced forward, this document’s DocObjectCode + DocEntry are what the next
document’s lines point back to.
Remarks, references, and dimensions
The header carries free-text and posting metadata used across every module.
| Field | Type | Meaning | Required? |
|---|---|---|---|
Comments | Edm.String | Free-text remarks on the document. The primary human-readable note field. | No |
JournalMemo | Edm.String | Memo written onto the resulting G/L journal entry. | No |
NumAtCard | Edm.String | The BP’s own reference number (e.g. the customer’s PO number on a sales order). | No |
SalesPersonCode | Edm.Int32 | The sales employee credited with the document. | No |
PaymentGroupCode | Edm.Int32 | Payment terms group applied. | No |
PaymentMethod | Edm.String | Payment method code. | No |
Project | Edm.String | Project dimension code for reporting. | No |
BPL_IDAssignedToInvoice | Edm.Int32 | Branch / Business Place the document belongs to. | No |
FinancialPeriod | Edm.Int32 | Accounting period the posting falls in. | Read-only |
TransNum | Edm.Int32 | The G/L transaction (journal entry) number created by the document. | Read-only |
What a minimal create looks like
Because so many fields default from the master data and company configuration, a valid create is small โ the required party, a date if you don’t want today, and the lines:
POST /b1s/v1/Orders
{
"CardCode": "C20000",
"DocDueDate": "20250215",
"DocumentLines": [
{ "ItemCode": "A1001", "Quantity": 5, "WarehouseCode": "01" }
]
}SAP fills CardName, DocDate (today), the currency, the prices, the tax, and the
totals from the master data. DocEntry, DocNum, DocumentStatus, and the Base*
back-links are all system-assigned.