Sub topic 11
Billing documents and invoices
Billing is the step where the company turns a delivered order into a claim for money. It creates the billing document (the invoice), copies the price and tax result from the order, and passes the posting to Financial Accounting (FI). This chapter assumes you know the sales order and delivery steps from earlier chapters, can read basic double-entry postings, and can read simple SQL.
What billing does
A billing document is the SD (Sales and Distribution) document that records what the customer owes. In the standard process it is created with reference to a delivery. It can also be created from a sales order, for example for services or down payments.
Billing does four jobs:
- It copies items, quantities and prices from the reference document.
- It determines the billing type, such as invoice, credit memo or cancellation.
- It creates an accounting document in FI for the receivable and the revenue.
- It updates the document flow, so you can trace the invoice back to the order.
The billing document is stored in table VBRK (header) and VBRP (items). Its number is the one the customer sees on the printed or electronic invoice.
Billing types
The billing type controls what kind of document is created and how it behaves. Common standard types are:
| Billing type | Name | Purpose |
|---|---|---|
| F1 | Invoice (F2 for delivery) | Invoice for an order (F1) or for a delivery (F2) |
| G2 | Credit memo | Reduces the amount the customer owes |
| L2 | Debit memo | Increases the amount the customer owes |
| S1 | Cancellation of invoice | Reverses an invoice |
| S2 | Cancellation of credit memo | Reverses a credit memo |
Each billing type has settings that matter in practice:
- The number range for billing document numbers.
- Whether the document posts to accounting.
- Whether it is cancelled by another type (the cancellation billing type).
- The output (print or electronic) determined for it.
- The copy control rules that define how data moves from the reference document.
Billing due list and billing methods
Billing happens in two main ways.
- Online, single document. A user creates one invoice for one delivery. This suits low volumes and corrections.
- Collective processing. The billing due list selects all documents that are ready to be billed and creates invoices in one run. This is the normal way in production. You can schedule it as a background job.
A delivery is billable only when its billing status says so. For goods, that means goods issue has been posted. If you try to bill a delivery before goods issue, the system rejects it. This protects the link between physical movement and revenue.
Splitting and combining invoices
The system can combine several deliveries into one invoice, or split one delivery into several invoices. It decides based on a few fields. Documents are combined only when the fields in the billing document header match. These include the payer, billing date, billing type, payment terms and incoterms. If one value differs, the system creates separate invoices. Copy control and the split settings on the billing type refine this behavior.
A common surprise is two deliveries to the same customer that produce two invoices. The cause is usually a differing header field, such as a different payment term or a different billing date.
Data copied into the billing document
Billing does not recalculate everything. It copies much of the result from the order.
- Quantities come from the delivery (the quantity actually issued).
- Prices come from the order, unless the pricing type in copy control says to redetermine them. Setting a pricing type that reprices at billing is common for products whose price changes between order and delivery.
- Taxes are determined from the tax conditions in pricing, using the country of the ship-from plant and the ship-to customer.
- Partners such as sold-to, ship-to and payer are copied to the billing document. The payer is the partner who is invoiced.
Quantities in the billing document can be lower than the order quantity. If only part of the order was delivered, the invoice shows only the delivered part.
Accounting integration
When you save a billing document and it is relevant for accounting, the system creates the FI document. The posting is, in simplified form:
| Account | Debit | Credit |
|---|---|---|
| Customer (accounts receivable) | Gross amount | |
| Revenue | Net amount | |
| Tax payable | Tax amount |
The system picks the accounts through account determination. Account determination uses keys such as the chart of accounts, sales organization, customer account assignment group and material account assignment group. If no account is found, billing is blocked with an accounting error and the invoice stays on the billing due list or in an accounting-block status. You then fix the configuration or master data and release the document to accounting.
Notice that the billing document and the accounting document are two separate documents. In S/4HANA the accounting side is stored in the Universal Journal table ACDOCA. The following query reads the line items created from one billing document.
DATA(lv_billing) = CONV vbeln_vf( '0090001234' ).
SELECT rbukrs, gjahr, belnr, docln, racct, hsl
FROM acdoca
WHERE rldnr = '0L'
AND awtyp = 'VBRK'
AND awref = @lv_billing
INTO TABLE @DATA(lt_journal).The filter rldnr = '0L' selects the leading ledger. The fields awtyp and awref hold the type and number of the originating document. VBRK is the billing document type. The result should show a receivable line, one or more revenue lines and a tax line. The field hsl is the amount in company code currency, with the sign showing debit or credit.
Release to accounting and blocks
Billing and accounting can be decoupled with the accounting status.
- A billing document may be saved first and posted to accounting afterwards.
- A billing block can be set on an order, delivery or billing document to stop invoicing. A typical reason is a pricing dispute or a missing customer document.
- An accounting block arises when posting fails, for example because of a closed posting period or missing account determination.
The usual workflow is to review blocked documents in a worklist and release them once the cause is fixed.
Cancelling and correcting an invoice
You cannot edit a posted invoice. To correct it, you have these options:
- Cancel it with a cancellation billing document (S1 for an invoice). The cancellation reverses the accounting posting and makes the delivery billable again.
- Issue a credit memo (G2) for a partial or full correction. This keeps the original invoice and adds a second document that offsets it.
- Issue a debit memo (L2) if the customer was undercharged.
Choose cancellation when the invoice was wrong in full and should disappear from the customer's view. Choose a credit memo when the invoice was legally issued and sent and you need a visible correction. Your local tax and legal rules often decide this. The returns and credit memo chapter covers the full process.
Tracing the billing document
Document flow links the billing document to its predecessors. The following query reads the immediate successors of a sales order, which includes deliveries. You can then repeat the query with a delivery number to find the invoice.
DATA(lv_vbeln) = CONV vbeln_va( '0000012345' ).
SELECT vbelv, posnv, vbeln, posnn, vbtyp_n
FROM vbfa
WHERE vbelv = @lv_vbeln
INTO TABLE @DATA(lt_flow).In VBFA, vbtyp_n identifies the type of the follow-on document. Delivery and invoice documents have different category codes. Repeating the query with the delivery number as vbelv returns the billing document as the next step.
Common errors
- Delivery not billable. Goods issue is missing, or the billing block is set.
- Account determination error. An account assignment group or a G/L account is missing for the key combination. Check the simulation of account determination in the billing document.
- Wrong price on the invoice. The pricing type in copy control kept the order price when you expected a new price.
- Unexpected extra invoices. A header field differs between deliveries. Compare payer, date and terms.
- Posting period closed. The accounting document cannot post. Open the period or change the posting date, then release.
Exercise
Two deliveries to the same customer were billed in one collective run, but the system created two invoices instead of one. Name two causes you would check first, and explain how you would find the accounting lines for one of the invoices.
Show answer
Check whether header fields differ between the deliveries, such as the billing date, payment terms, incoterms or payer, because the system combines documents only when these match. Also check whether the billing type or copy control rules require a split. To find the accounting lines, read ACDOCA with rldnr = '0L', awtyp = 'VBRK' and awref set to the billing document number. The result shows the receivable, revenue and tax lines.
Exercise
An invoice was sent to the customer with the wrong quantity. The invoice has already posted to accounting. Which two documents can you create to correct it, and when would you choose each?
Show answer
Create a cancellation billing document (type S1) when the whole invoice must be reversed and replaced, which also reverses the FI posting and makes the delivery billable again. Create a credit memo (type G2) when the invoice was legally issued and you need a visible, offsetting correction for the difference. Local legal and tax rules often decide which one to use.