Sub topic 10
Copy control: who may follow whom, and what gets copied
Prerequisites and scope
This chapter assumes you can navigate the SAP GUI and use transaction codes. It also assumes you know the header and item structure of sales documents, and that you have read the earlier chapters on VBFA and the order-to-cash chain. It covers copy control in SD, the sales and distribution module. Other areas, such as purchasing, use different mechanisms.
Copy control is the configuration that decides two things when a user creates a document with reference to another one:
- Who may follow whom. Which target document type can be created from which source document type.
- What gets copied. Which fields, items and quantities move from the source to the target, and how they are checked and adjusted.
Every link you see in the document flow was allowed by a copy control entry. If the entry is missing or its conditions fail, the follow-on document cannot be created.
Where copy control lives
Copy control is customizing. It is not master data and not transaction data. You maintain it in the IMG, the Implementation Guide, under Sales and Distribution. The most used transaction is VTAA for sales document to sales document. VTLA covers sales document to delivery, and VTFL covers delivery to billing. VTFA covers sales document to billing.
| Transaction | Source | Target | Typical example |
|---|---|---|---|
| VTAA | Sales document | Sales document | Quotation to standard order, order to return |
| VTLA | Sales document | Delivery | Standard order to outbound delivery |
| VTFA | Sales document | Billing document | Order to invoice, order-related billing |
| VTFL | Delivery | Billing document | Outbound delivery to invoice, delivery-related billing |
| VTFF | Billing document | Sales document | Invoice to credit memo request |
Each transaction shows a table of source type and target type pairs. A pair is created by entering the source type and the target type. For example, the pair OR (standard order) to LF (delivery) is defined in VTLA by the source order type and the target delivery type.
The three levels of a copying control entry
Each source and target pair has settings at three levels. The levels nest inside each other.
- Header level. Settings for the whole document.
- Item category level. Settings for each source item category and target item category.
- Schedule line level. Settings for sales order schedule lines, mainly for delivery creation.
A target document can be created only if the pair exists at header level and the item category pair exists at item level. If the item category pair is missing, the item is not copied. The user can then see a document with fewer items than the source, or no items at all.
What the entries control
Data transfer routines
A data transfer routine is an ABAP routine, kept in the routine include for copy control, that SAP runs during copying. Each routine has a number. At header level you assign routines in these fields:
- Copying requirements. A routine that checks whether copying is allowed. If it returns a non-zero
SY-SUBRC, the copy stops or the item is skipped. - Data transfer. A routine that changes or sets fields in the target document after the standard copy.
Standard routines have numbers below 500. Custom routines must use numbers from 900 to 999. This keeps them out of the way of SAP updates. Copy control routines are normally created in the SD include programs, for example RV45C... for sales and LV60C... for billing. In practice many teams use an enhancement spot or a custom form routine, depending on the release.
Document flow update
In the item category entry the field Update document flow controls whether VBFA receives a record for the copied item. Values include:
- blank: the standard behavior, the flow is updated.
X: do not update the document flow. This is a special setting.
Switching the document flow update off is rarely correct. Without a VBFA record, the GUI document flow is incomplete and later reversals, quantity checks and billing status checks cannot find the link.
Copy quantity and pricing
Several fields at item level control how quantities and prices are copied.
| Field | Effect |
|---|---|
| Copy quantity | Whether the target takes the full source quantity, or only the open quantity. |
| Pricing type | How prices are determined in the target. Examples: copy price components again, or carry them over unchanged. |
| Pos/neg. quantity | Whether the sign of the quantity is kept or reversed, for example in returns or credit memos. |
| Reference item category | Whether the target item references the source item and checks its status. |
The pricing type matters most in practice. A billing document normally takes the pricing from the order. If the type is set to redetermine prices, a later price change can make the invoice differ from the order. That is correct behavior, not an error.
How the system checks a copy
When a user creates a follow-on document with reference, SAP runs a sequence. This helps you place a failure on the right step.
The VBFA record is written when the target document is saved, not while copying. If the user abandons the screen, no link exists.
Seeing the effect in VBFA
After a copy is saved, VBFA holds one row for each source and target item pair. You can verify the result with a query. This matches the SELECT shown in the earlier chapter and adds a filter on the subsequent category.
DATA lv_order TYPE vbeln_va VALUE '0000004711'.
SELECT vbelv, posnv, vbeln, posnn, vbtyp_n
FROM vbfa
WHERE vbelv = @lv_order
INTO TABLE @DATA(lt_followers).The VBTYP_N column holds the document category of the target. If you expect a delivery category and see none, check whether the VTLA entry exists for the order type and whether the schedule line category is relevant for delivery.
Worked example: why no delivery is created
A user creates a standard order of type ZOR1 and tries to create a delivery. The system answers that nothing is due for delivery. Follow these steps.
- Open VTLA and look for the source type
ZOR1. If no entry exists with a delivery type target, there is no allowed path. Add the pairZOR1toLF. - Check the item category pair. The item category of the order, for example
TAN, must be assigned to a delivery item category such asTANin the delivery type. - Check the schedule line category. It must be relevant for delivery. Look at the delivery relevance flag in the schedule line category, which you maintain in the IMG.
- Check blocks. A delivery block in the order header or schedule line stops delivery creation even when copy control is correct.
- Check the copying requirement routine. A routine can reject the copy because of a condition such as an incomplete order.
Steps 1 to 3 belong to copy control. Steps 4 and 5 are other causes that look the same to the user. Always rule out a block before changing customizing, since customizing changes affect every order.
Common errors
- Copy control pair missing. The order type or billing type was added, but no pair was defined. The error says the document type cannot be created with reference.
- Item category pair missing. The document is created but items are not copied. The user sees an empty target.
- Wrong pricing type. An invoice price differs from the order price. Check the pricing type in the item entry.
- Document flow update off. The follow-on document exists but does not show in the document flow. VBFA lacks the row.
- Custom routine in the wrong number range. A routine with a number below 900 can be overwritten by an SAP update.
- Blocked or incomplete source. Copy control is fine, but a block or an incompleteness check stops the copy.
Exercises
Exercise
A user creates an invoice from a delivery and finds that the document flow of the order does not show the invoice. Which copy control setting do you check first, and which table do you check to confirm the finding?
Show answer
Check the "Update document flow" field in the item category entry for the delivery to billing pair (transaction VTFL). Then confirm in VBFA by selecting rows where VBELV is the delivery number and looking for a row whose VBTYP_N is the billing category. If no row exists, the link was not written.
Exercise
Which transaction defines the allowed path from a standard order to an outbound delivery, and at which three levels does the entry hold settings?
Show answer
VTLA defines it. The entry holds settings at header level, item category level and schedule line level.
Exercise
You add a custom copying requirement routine. In which number range must it be created, and why?
Show answer
In the range 900 to 999, because SAP reserves the lower numbers for its standard routines and may overwrite them during an upgrade or support package.