Document Line Fields

The DocumentLines fields on every SAP B1 marketing document โ€” item, quantity, price, warehouse, tax, and the line-level BaseType/BaseEntry/BaseLine copy chain.

Every SAP Business One marketing document has a DocumentLines collection โ€” an array of line items. Each line represents one item (or service) being sold or bought: what it is, how many, at what price, from which warehouse, and where it came from in the document chain. The header (see the Document Header Fields reference) holds the party, dates, and totals; the lines hold the goods.

The line fields below are shared across all document types, because โ€” as with the header โ€” there is only one Document entity in the Service Layer and one line shape beneath it.

What is being sold โ€” the item

FieldTypeMeaningRequired?
LineNumEdm.Int32Zero-based index of the line within the document. Referenced as BaseLine by the next document in the chain.Read-only (system-assigned)
ItemCodeEdm.StringItem master code (foreign key into Items). Required on item lines.Yes (item lines)
ItemDescriptionEdm.StringItem name/description; defaults from the item master, editable per line.No (defaults from item)
QuantityEdm.DoubleQuantity ordered / delivered / invoiced on this line.Yes

On a service-type document (DocType = dDocument_Service) a line has no ItemCode; it posts directly to a G/L account via AccountCode instead (see below).

Price and line value

All monetary and quantity fields are Edm.Double. Usually you supply Quantity and let SAP resolve the price from the BP’s price list and any special pricing; you can override Price per line.

FieldTypeMeaningRequired?
PriceEdm.DoubleUnit price before VAT. Defaults from the price list; overridable.No (defaults from price list)
PriceAfterVATEdm.DoubleUnit price including VAT.No
UnitPriceEdm.DoubleGross unit price field (synonymous with the pre-VAT unit price in most flows).No
DiscountPercentEdm.DoubleLine-level discount percentage.No
LineTotalEdm.DoubleLine total = Quantity ร— Price (after line discount, before header discount/tax). Usually computed.No (computed)
CurrencyEdm.StringCurrency for this line’s amounts.No (defaults from document)

Let SAP compute LineTotal from Quantity and Price. If you send all three and they disagree, the resolution rules are configuration-dependent โ€” send the drivers, not the derived total.

Stock, tax, and posting dimensions

FieldTypeMeaningRequired?
WarehouseCodeEdm.StringStock location this line draws from / receives into.Yes for stocked items (defaults to item’s default warehouse)
TaxCodeEdm.StringTax code governing the VAT rate and G/L accounts for this line.No (defaults from item/BP)
VatGroupEdm.StringTax group for the line (closely related to TaxCode).No (defaults)
AccountCodeEdm.StringG/L account override. On service lines this is where the value posts; on item lines it overrides account determination.Yes on service lines; else No
CostingCodeEdm.StringCost centre / profit centre dimension.No
ProjectCodeEdm.StringProject dimension for reporting.No
ShipDateEdm.String (yyyymmdd)Required delivery date for this line โ€” string, yyyymmdd, like all SAP dates.No

The line-level copy chain โ€” BaseType / BaseEntry / BaseLine

This is the heart of SAP B1 document tracing. When a document is “copied forward” (Quotation โ†’ Order โ†’ Delivery โ†’ Invoice), each new line records which source line it came from via three fields:

FieldTypeMeaningRequired?
BaseTypeEdm.Int32DocObjectCode of the source document (e.g. 17 = oOrders).No (set when copying forward)
BaseEntryEdm.Int32DocEntry of the source document (its internal id).No (set when copying forward)
BaseLineEdm.Int32LineNum of the source line the value came from.No (set when copying forward)

Read together: a Delivery line with BaseType = 17, BaseEntry = 42, BaseLine = 0 was copied from line 0 of Sales Order DocEntry 42. To follow a full Order โ†’ Delivery โ†’ Invoice path, chase these fields hop by hop โ€” there is no single query that returns the whole chain; each hop is a separate lookup.

Supplying BaseType/BaseEntry/BaseLine on create is also how you drive the copy: to create a Delivery from an Order, post Delivery lines that reference the Order’s object code, DocEntry, and line numbers, and SAP pulls the item, quantity, and price forward and updates the source document’s open quantities.

POST /b1s/v1/DeliveryNotes
{
  "CardCode": "C20000",
  "DocumentLines": [
    { "BaseType": 17, "BaseEntry": 42, "BaseLine": 0 }
  ]
}

Tracking and fulfilment flags

FieldTypeMeaningRequired?
SerialNumEdm.StringSerial number, for serial-tracked items.Only if item is serial-managed
TreeTypeSAPB1.BoItemTreeTypesBOM / assembly type when the line is a product tree.No
BackOrderSAPB1.BoYesNoEnumWhether the line is on back-order (tYES/tNO).No
PickStatusSAPB1.BoYesNoEnumWhether the line has been picked (pick-list status).Read-only

Reading lines with $expand

By default a document query returns the header only. To pull the lines inline, use $expand:

GET /b1s/v1/Orders(42)?$expand=DocumentLines

To trace a chain forward from an order, query the follow-on document type filtered on the Base* fields of its lines โ€” for example, deliveries created from a given order โ€” and walk each hop in turn.