SAP Document ap_invoice

A/P Invoice

Records the supplier's bill and the payable owed. Clears the GRNI accrual and books Accounts Payable โ€” the billed leg of the three-way match.

An A/P (Accounts Payable) Invoice records the supplier’s bill: the formal statement of what the supplier is charging and, once posted, the liability your company owes them. It is the document that turns received goods into a payable. It is the “what the supplier is charging” leg of the three-way match and the point at which the general ledger recognises the debt.

Purpose

An A/P Invoice answers the question “what do we owe this supplier, and for what?” When the supplier’s bill arrives, accounts payable records it against the goods already received (the GRPO). Posting the invoice books the amount payable and โ€” because the GRPO already recognised the stock and the accrual โ€” clears the temporary Goods Received Not Invoiced (GRNI) liability, replacing it with a firm Accounts Payable balance to the supplier.

The A/P Invoice does not change stock. In the normal flow the Goods Receipt PO already increased inventory when the goods physically arrived; the invoice is purely a financial event. (If an A/P Invoice is posted with no GRPO โ€” “service” or direct invoices โ€” it books the cost straight to an expense or inventory account instead, and the three-way match is bypassed.)

Position in the document chain

The A/P Invoice sits near the end of the purchasing chain: it copies from the Goods Receipt PO, and it is settled by an Outgoing Payment. An A/P Credit Memo reverses its value.

flowchart TD
    GRPO[Goods Receipt PO] -->|supplier invoices| API[A/P Invoice]
    API -->|payment due| OP([Outgoing Payment])
    API -->|value reversed| ACM[A/P Credit Memo]

    style API fill:#fef9c3,stroke:#ca8a04,stroke-width:3px
    style GRPO fill:#dcfce7,stroke:#16a34a
    style ACM fill:#fee2e2,stroke:#dc2626
  • Copies from: a Goods Receipt PO (normal three-way-match flow), or a Purchase Order directly, or nothing (a standalone service/expense invoice).
  • Becomes: settled by an Outgoing Payment. If the bill was wrong, an A/P Credit Memo reverses its value.

Each invoice line carries BaseType / BaseEntry / BaseLine pointing back to the GRPO (or PO) line it bills, which is exactly what lets the three-way match line up ordered vs. received vs. billed quantities and prices.

Key fields

An A/P Invoice is a Document entity โ€” the universal base shared by every SAP B1 transactional document โ€” distinguished by its DocObjectCode of oPurchaseInvoices (18). The supplier’s CardCode is a vendor V-code (e.g. V001).

Header

FieldMeaning
DocEntryInternal primary key (assigned by SAP).
DocNumUser-visible document number.
DocObjectCodeoPurchaseInvoices (18) โ€” identifies this as an A/P Invoice.
CardCodeSupplier’s business-partner code โ€” a vendor V-code (e.g. V001).
CardNameSupplier name (defaults from the BP master).
DocDatePosting date โ€” when the payable is recognised (string, YYYYMMDD).
DocDueDatePayment due date (drives A/P aging).
DocCurrencyCurrency of the invoice.
DocTotalInvoice total including tax, in document currency.
VatSumThe VAT portion (recoverable input tax).
DocumentStatusbost_Open until fully paid, then bost_Paid.
TransNumG/L transaction number of the journal entry this invoice posts.

Lines (DocumentLines collection)

FieldMeaning
LineNum0-based line index.
ItemCodeItem master code.
QuantityQuantity billed.
PriceUnit price before VAT โ€” the amount charged.
LineTotalQuantity ร— Price.
VatGroupTax code for the line.
AccountCodeG/L account override โ€” for a service invoice, the expense account.
BaseType / BaseEntry / BaseLineChain link back to the GRPO (or PO) line.

Stock and G/L effect

No stock effect in the normal flow โ€” the GRPO already increased inventory.

G/L effect: the invoice books the payable. It debits the GRNI accrual (clearing the liability the GRPO raised) and the recoverable input VAT, and credits Accounts Payable (the supplier’s balance):

A/P Invoice (based on a GRPO โ€” the accrual is cleared):

DR  Goods Received Not Invoiced       1,000
DR  VAT Recoverable                     170
CR      Accounts Payable (supplier)           1,170

If the invoice has no GRPO behind it, there is no accrual to clear, so the debit goes straight to Expense or Inventory instead:

A/P Invoice (no GRPO โ€” direct expense/service):

DR  Expense / Inventory               1,000
DR  VAT Recoverable                     170
CR      Accounts Payable (supplier)           1,170

The Accounts Payable credit is what a later Outgoing Payment settles (DR Accounts Payable / CR Bank).

Service Layer entity

PropertyValue
SL entityPurchaseInvoices
Object codeoPurchaseInvoices (18)
Norma path/b1s/v1/PurchaseInvoices

(SAP’s current generally-available Service Layer is /b1s/v2/; Norma’s connector and mock both speak /b1s/v1/PurchaseInvoices.)

How to create it in Norma

Use the create_ap_invoice tool. It needs:

  • card_code โ€” the supplier’s code, a vendor V-code (e.g. V001).
  • lines โ€” each an item_code + quantity.
  • Optionally per line, unit_price โ€” when given it is authoritative (the amount the supplier is billing); when omitted the line falls back to the item’s list price.

Every Norma write is held for human review before it reaches SAP. An A/P Invoice posts a real payable to the general ledger, so the review gate shows exactly what will be booked (supplier, lines, prices, VAT, total, due date) before anything posts. Only on approval does the connector POST it to /b1s/v1/PurchaseInvoices. Nothing is written to SAP until a human approves.