Sub topic 10
Sales and Distribution
This chapter assumes you know the idea of an ERP system, the organizational units from earlier chapters (client, company code, plant, sales organization), and basic relational concepts such as keys and joins. It also assumes you have met business partners and materials as shared master data.
What Sales and Distribution does
Sales and Distribution (SD) handles everything between a customer's request and the customer's payment. It covers pricing, sales orders, delivery, shipping, and billing. SD does not own stock or the general ledger. It hands off to Inventory when goods leave and to Finance when an invoice is issued.
The sales organization structure
Sales activity is structured by three organizational units:
- Sales organization is the unit responsible for selling and for terms of sale. It belongs to one company code.
- Distribution channel is the route to the customer, such as wholesale, retail, or web.
- Division is a product grouping.
A combination of sales organization and distribution channel defines which customers and materials can be traded. The shipping side uses the plant and shipping point from the earlier organizational chapter.
The document flow
Each step in SD creates a document that references the one before it. This chain is called the document flow.
The same chain, written out as text:
Order-to-cash (Sales -> Inventory -> Finance)
Sales order -> Delivery -> Goods issue -> Billing document -> Customer paymentTwo steps create accounting entries:
- Goods issue reduces stock and posts the cost of goods sold.
- Billing posts the customer receivable and the revenue.
The customer payment then clears the receivable.
Inside a sales order
A sales order has a header and items. The header holds the customer (a business partner in the customer role), the sales area, and the terms. Each item holds a material, a quantity, and a net value. Pricing is applied per item, using condition records such as base price, discounts, and taxes.
The following query joins headers (table VBAK) to items (table VBAP) for one sales organization:
SELECT FROM vbak
INNER JOIN vbap ON vbap~vbeln = vbak~vbeln
FIELDS vbak~vbeln, vbak~kunnr, vbap~posnr, vbap~matnr, vbap~netwr
WHERE vbak~vkorg = '1010'
INTO TABLE @DATA(order_items)
UP TO 100 ROWS.The join key vbeln is the sales document number. kunnr links the order to the customer, and matnr links each item to a material. This is how one sales document ties business partner data and material data together.
Common errors
- Missing sales area on the customer. An order cannot be created if the business partner has no customer role or no data for that sales organization, distribution channel, and division.
- Material not extended. The material must exist for the sales organization and distribution channel, and for the delivering plant.
- No price found. Pricing fails when no condition record is valid for the customer, material, and date.
- Incomplete document. Missing mandatory data blocks delivery or billing until you fix it.
- Account determination errors. Billing cannot post if no revenue account is configured for the combination of sales area, material, and customer.
Exercise
A delivery has been created for a sales order, but no goods issue has been posted yet. Which accounting entries exist so far, and which appear after the goods issue and after billing?
Show answer
None exist after the delivery alone, because it is only a logistics document. The goods issue reduces stock and posts the cost of goods sold. Billing then posts the customer receivable and the revenue.
Exercise
In the VBAK/VBAP query, which field links an order item to the customer, and which to the material?
Show answer
The customer comes from the header field kunnr in VBAK. The material comes from the item field matnr in VBAP. The two tables are joined on vbeln.