Sub topic 5
Creating and understanding the sales order
This chapter assumes you can navigate the SAP GUI or Fiori launchpad and know basic order-to-cash vocabulary. You should also know the sales area (sales organization, distribution channel, division) from the earlier chapter on organizational units. The SQL examples are optional.
The sales order is the first binding document in the process. It records what the customer wants, the price, and when and where the goods should arrive. Every later document (delivery, billing document, accounting document) refers back to it.
Structure of a sales order
A sales order has three levels.
- Header: data that applies to the whole order. Examples are the order type, sales area, customer purchase order number, payment terms, incoterms and overall status. It is stored in table VBAK.
- Item: one line per material and quantity, stored in VBAP. The item holds the material, quantity, unit of measure, plant, net value and item category.
- Schedule line: one or more delivery dates and quantities per item, stored in VBEP. A single item for 100 pieces can have two schedule lines, for example 60 pieces on Monday and 40 on Friday.
Business partners sit beside this hierarchy in table VBPA, and pricing conditions are stored per header and item.
Creating an order
You create an order with transaction VA01 or the Fiori app for creating sales orders. Use VA02 to change an order and VA03 to display it. The entry screen asks for three things:
- The order type, such as OR (standard order). It controls the document number range, which fields are required, and what the order may be copied into.
- The sales area: sales organization, distribution channel and division.
- The sold-to party and, if needed, the ship-to party, plus the materials and quantities.
When you enter the customer, the system copies defaults from the customer master for that sales area. These include the payment terms, incoterms, shipping conditions and partner functions. At the item level it copies data from the material master (sales organization views), such as the delivery plant, units of measure and item category group.
Partner functions
A customer can play several roles in one order. The main ones are:
| Partner function | Role |
|---|---|
| Sold-to party (AG) | Places the order |
| Ship-to party (WE) | Receives the goods |
| Bill-to party (RE) | Receives the invoice |
| Payer (RG) | Pays the invoice |
If all four are the same account, the master data usually proposes one customer for every role. For a customer with a central buying office and several stores, the roles are often different accounts. The delivery goes to the ship-to party, but the receivable is posted to the payer.
Item categories and schedule line categories
The item category tells the system how to treat the item. For example, TAN is a standard item that is delivered and billed. TANN is a free-of-charge item, and TAD is a service item. The system determines the category from four inputs:
- the sales document type,
- the item category group from the material master (for example NORM),
- the usage, and
- the higher-level item category.
The item category controls whether the item is relevant for delivery, billing and pricing. It also controls whether it is a schedule line item. Schedule line categories work the same way. CP means the item takes part in MRP and the availability check, and CN means it does not. The schedule line category is determined from the item category and the MRP type of the material.
These are configuration tables. If an order shows an unexpected item category, check the material's item category group before you change the configuration.
Pricing, availability and credit in the order
Three functions run while you create the order. Later chapters cover each in depth, so here is only where they appear:
- Pricing reads the condition records and writes the result to the order as condition lines, such as a base price, a discount and tax. In S/4HANA the condition lines are stored in table PRCD_ELEMENTS. In ECC they were in KONV.
- The availability check looks at stock and planned receipts. It sets the confirmed quantity and date in the schedule lines.
- The credit check can block the order if the customer exceeds the credit limit. A blocked order cannot be delivered until someone releases it.
Incompleteness and status
A sales order can be saved when data is missing, but it cannot be used for follow-on documents until it is complete. The incompletion procedure defines which fields are required. For example, an order may require the payment terms before delivery. Run the incompletion log from the Edit menu to see what is missing.
Each document carries status fields: overall processing status, delivery status, billing status and credit status. In ECC these were in the separate tables VBUK and VBUP. In S/4HANA the status fields are part of VBAK and VBAP, and the old status tables are obsolete. If your custom code reads VBUK or VBUP, it needs to be changed when you migrate.
Verifying an order in the database
The screen shows the order in a friendly layout. The query below shows the same data as the database stores it, so you can compare the two. It reads the header and item data of one order.
REPORT z_show_sales_order.
DATA(lv_vbeln) = CONV vbeln_va( '0000012345' ).
SELECT h~vbeln, h~auart, h~kunnr,
i~posnr, i~matnr, i~kwmeng, i~vrkme, i~netwr
FROM vbak AS h
INNER JOIN vbap AS i ON i~vbeln = h~vbeln
WHERE h~vbeln = @lv_vbeln
INTO TABLE @DATA(lt_items).
cl_demo_output=>display( lt_items ).Replace the order number with one from your system. Expect one row per item. The kunnr field is the sold-to party, and netwr is the item net value in document currency.
Copy control and document flow
When you create an order from a quotation, or a delivery from an order, the system copies data using copy control. Copy control settings decide which fields are copied and which checks run. They also decide whether quantities are copied from the source or recalculated. Each step also writes a link into the document flow table VBFA. The order's document flow is the starting point for tracing the whole transaction, and a later chapter covers it.
Common problems
- No pricing found: the condition record is missing or its validity dates do not cover the order's pricing date. Check the pricing analysis in the item conditions.
- Item category cannot be determined: the combination of order type, item category group and usage has no entry in the configuration.
- Material not defined for the sales area: the material master has no sales organization view for this sales organization and distribution channel.
- Order saved but cannot be delivered: look at the incompletion log, the credit status and any delivery block in the header.
Summary of the order's job in the process
The sales order creates the legally relevant agreement. It reserves stock through the availability check and fixes the price through pricing. It also feeds the due list for delivery. It does not post to accounting, so the order has no financial effect yet. The first accounting entries come with goods issue and billing.
Exercise
A sales order item has quantity 100. The availability check can confirm 60 pieces now and 40 pieces next week. How many schedule lines does the item have, and in which table are they stored?
Show answer
Two schedule lines, one for 60 pieces on the earlier date and one for 40 pieces on the later date. Schedule lines are stored in table VBEP, linked to the item in VBAP.
Exercise
A customer's head office is the payer, but each store is a separate ship-to party. In which table do you find which partner has which role on one order, and which role receives the receivable?
Show answer
Partner roles for the order are in table VBPA. The payer (partner function RG) receives the receivable in accounting. The ship-to party (WE) only receives the goods.
Exercise
Your custom report reads the delivery status of sales orders from VBUK after an upgrade to S/4HANA. What is wrong, and what should you do?
Show answer
In S/4HANA the status tables VBUK and VBUP are obsolete. The status fields are now part of VBAK and VBAP, so the report should read the status fields from those tables.