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.

FieldTypeMeaningRequired?
CardCodeEdm.StringBusiness Partner code โ€” the customer (sales) or vendor (purchasing). Foreign key into BusinessPartners.Yes
CardNameEdm.StringBusiness Partner name. Defaults from the BP master but can be overridden per document.No (defaults from BP)
ContactPersonCodeEdm.Int32The named contact at the BP for this document.No
ShipToCodeEdm.StringShip-to address code (selects one of the BP’s addresses).No
PayToCodeEdm.StringPay-to / bill-to address code.No
AddressEdm.StringRendered bill-to address text.No
Address2Edm.StringRendered 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.

FieldTypeMeaningRequired?
DocDateEdm.String (yyyymmdd)Posting date โ€” the date the document takes accounting effect.Yes (defaults to today)
DocDueDateEdm.String (yyyymmdd)Due date (payment due for invoices; delivery/target date otherwise).Yes (defaults from payment terms)
TaxDateEdm.String (yyyymmdd)Tax point date โ€” the date used to pick the VAT rate/period.No (defaults to DocDate)
CreationDateEdm.String (yyyymmdd)When the record was created (read-only).Read-only
UpdateDateEdm.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.

FieldTypeMeaningRequired?
DocTotalEdm.DoubleGrand total in the document currency (incl. tax). Usually computed by SAP from the lines.No (computed)
DocTotalSysEdm.DoubleGrand total in the system currency.Read-only
DocTotalFcEdm.DoubleGrand total in the foreign currency.Read-only
VatSumEdm.DoubleTotal VAT/tax amount on the document.No (computed)
DocCurrencyEdm.StringCurrency code for the document (e.g. EUR, USD).No (defaults from BP)
DocRateEdm.DoubleExchange rate to the local currency at posting time.No
DiscountPercentEdm.DoubleHeader-level discount applied to the whole document.No
DownPaymentEdm.DoubleDown-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; DocTotal and VatSum are 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.

FieldTypeMeaningRequired?
DocumentStatusSAPB1.BoStatusOpen / Closed / Paid / Delivered โ€” the lifecycle state.Read-only
CancelledSAPB1.BoYesNoEnumWhether the document was cancelled (tYES/tNO).No
DocTypeSAPB1.BoDocumentTypesItems (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:

FieldTypeMeaningRequired?
DocEntryEdm.Int32Internal primary key โ€” the unique row id. Referenced as a line’s BaseEntry by the next document in the chain.Read-only (system-assigned)
DocNumEdm.Int32User-visible document number (per numbering series).Read-only
DocObjectCodeSAPB1.BoObjectTypesIdentifies the document type (e.g. oOrders=17). Referenced as a line’s BaseType.Read-only
SeriesEdm.Int32Numbering 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.

FieldTypeMeaningRequired?
CommentsEdm.StringFree-text remarks on the document. The primary human-readable note field.No
JournalMemoEdm.StringMemo written onto the resulting G/L journal entry.No
NumAtCardEdm.StringThe BP’s own reference number (e.g. the customer’s PO number on a sales order).No
SalesPersonCodeEdm.Int32The sales employee credited with the document.No
PaymentGroupCodeEdm.Int32Payment terms group applied.No
PaymentMethodEdm.StringPayment method code.No
ProjectEdm.StringProject dimension code for reporting.No
BPL_IDAssignedToInvoiceEdm.Int32Branch / Business Place the document belongs to.No
FinancialPeriodEdm.Int32Accounting period the posting falls in.Read-only
TransNumEdm.Int32The 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.