ERPClimb logoERPClimb
Copy Control
SD / O2Cintermediate 6 min read

SD Copy Control Part 3: Copy Requirements and Data Transfer Routines (VOFM)

Preview · a free account unlocks the full lesson

Key takeaway

How copying requirements and data transfer routines work: standard routines (001, 301, 004, 051, 151…), creating custom routines (900+) in VOFM, activation and transport, typical use cases, and the rules for writing safe routines that run for every document.

In this lessonShow sections

Visual overview

SD Copy Control Part 3: Copy Requirements and Data Transfer Routines (VOFM) — learning sheetFlow: Identify the standard routine used today → Copy it to 9xx in VOFM and add logic → Activate and assign in copy control → Test positive and negative cases; transport. Key ideas: COPYING REQUIREMENTS; DATA TRANSFER ROUTINES; CREATING A CUSTOM ROUTINE; SAFE ROUTINE RULES. Watch out: Modifying a standard routine instead of copying it to 9xx changes behavior for every copy control entry using it.ERPClimb.com / SD / LESSON 3/5 / LEARNING SHEETSD Copy Control Part 3: Copy Requirements and DataTransfer Routines (VOFM)1 · HOW IT FLOWS1Identify thestandard routineused today2Copy it to 9xxin VOFM and addlogic3Activate andassign in copycontrol4Test positiveand negativecases; transport2 · KEY IDEAS EXPLAINEDCopying RequirementsHeader: e.g. 001 (same sold-to, sales area…), 002(not blocked…).Item: e.g. 301 (item not rejected, status), 303(always relevant).Data Transfer RoutinesHeader VBAK 051, business data VBKD 001/002,partners, item VBAP 151/102.Used to set or clear fields in the target (e.g.keep customer PO, clear delivery block).Creating A Custom RoutineVOFM > Requirements > Copying requirements(or Data transfer) > new number 9xx.Copy logic from the closest standard routine, addyour check.Safe Routine RulesOnly read and set the relevant structures; seterror via sy-subrc/bp_subrc with a message.No database updates, no COMMIT, no pop-ups.3 · REMEMBER · WATCH OUTRememberCopying requirement = ABAP routine that decides whether copying isallowed (sets sy-subrc/bp_subrc ≠ 0 to stop with a message).Data transfer routine = ABAP routine that moves fields from source totarget structures (e.g. VBAK from quotation).Custom routines use numbers 900–999, are created and activated inVOFM, then assigned in copy control.!Watch outModifying a standard routine insteadof copying it to 9xx changesbehavior for every copy controlentry using it.4 · IN A REAL PROJECTA client needed to prevent release orders against a contract when the release order's payer differed from thecontract payer, because rebate settlement depended on it. A developer modified standard routine 001 directly,which then applied to every copy control entry in the system, blocking unrelated scenarios such as returns…Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

Part 2 covered the copy control fields themselves; this part looks at the ABAP routines that sit behind two of those fields.

A copying requirement is an ABAP routine that decides whether copying from one document to another is allowed at all — it sets sy-subrc or bp_subrc to a non-zero value, together with a message, to stop the copy when its condition isn't met.

A data transfer routine, by contrast, is an ABAP routine that actually moves fields from the source document's structures into the target's — for example, transferring VBAK fields from a quotation into the new order — and is used to set or clear specific fields in the target, such as keeping the customer PO number or clearing a delivery block.

Standard copying requirements include header-level routines like 001 (checking things such as the same sold-to party and sales area) and 002 (checking the document isn't blocked), and item-level routines like 301 (checking the item isn't rejected, based on status) and 303 (always relevant). Billing copy control uses its own set, such as 004 for delivery-related items and 002 for order-related headers. Data transfer routines follow a similar numbering pattern — header VBAK routine 051, business data VBKD routines 001 and 002, and item VBAP routines 151 and 102, among others.

Free account

Create a free account to keep reading

You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.

  • Full explanation
  • Code example
  • Real project scenario
  • Common mistakes
  • Best practices
  • Interview angle

One tap with Google works too. Every topic keeps its first lesson open to everyone.

Keep exploring

Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.