User Exits
ABAP Developmentintermediate

User Exits Part 6: RV60AFZZ — Billing User Exit Patterns

Key takeaway

Use billing exits correctly: RV60AFZZ FORMs such as USEREXIT FILL VBRK VBRP and USEREXIT NUMBER RANGE, RV60AFZC for account determination and invoice split, copy control data transfer routines (VOFM), and designing billing logic for large VF04 runs.

Explanation

📌 KEY POINTS
✅ Billing (SAPLV60A) exits live in RV60AFZZ (header/item fields, number range) and RV60AFZC (e.g. account determination, invoice split-related exits).

✅ USEREXIT_FILL_VBRK_VBRP fills billing header and item fields from reference documents.

✅ Many billing requirements are better solved with copy control data transfer routines (VOFM) — configured per billing type.

⚠️ Billing runs (VF04, billing jobs) process thousands of documents — every SELECT in a billing exit is multiplied.

━━━━━━━━━━━━━━━━━━━━
▶ WHERE WE ARE

Parts 4–5 covered order and delivery exits. Billing is the last step of order-to-cash — and the most volume-sensitive.

━━━━━━━━━━━━━━━━━━━━
▶ 1. KEY FORMS (RV60AFZZ)

  • USEREXIT_FILL_VBRK_VBRP — set VBRK/VBRP fields during billing document creation (e.g. custom fields, reference texts). XVBRK/XVBRP tables and the reference data (VBAK/VBAP/LIKP/LIPS in work areas) are available depending on the processing point.
  • USEREXIT_NUMBER_RANGE — choose a different number range for billing documents (e.g. per company code or country) via US_RANGE_INTERN.
  • USEREXIT_PRINT_ITEM / _HEAD — rarely used.

━━━━━━━━━━━━━━━━━━━━
▶ 2. RV60AFZC

Contains exits used in account determination and other billing processes (e.g. USEREXIT_ACCOUNT_PREP_KOMKCV / KOMPCV to fill account determination communication structures) — used together with customizing of account determination.

━━━━━━━━━━━━━━━━━━━━
▶ 3. COPY CONTROL (VOFM)

  • Data transfer routines (VTFL/VTFA copy control, Data VBRK/VBRP) — e.g. routine 9xx copies a field from the order to the billing document.
  • Split criteria: invoice split via the ZUKRI field in data transfer routines — the correct place for custom split rules.
  • Routines are client-independent code objects assigned in customizing — cleaner than user exits for these tasks.

━━━━━━━━━━━━━━━━━━━━
▶ 4. VOLUME

  • VF04 and billing jobs run for all due documents; exits run per document/item.
  • Use data from reference documents already in memory; buffer additional reads.
  • Error messages stop billing for that document and appear in the billing log (VFX3 for incomplete accounting).

━━━━━━━━━━━━━━━━━━━━
▶ 5. S/4HANA NOTE

Billing exits still exist; in S/4HANA, billing documents may be created via the billing due list and Fiori apps — test those paths. Released BAdIs exist for some billing extensions.

━━━━━━━━━━━━━━━━━━━━
▶ STEP BY STEP

  1. SE38: display RV60AFZZ and RV60AFZC.
  2. VTFL/VTFA: display a copy control item and its data transfer routine.
  3. Implement a custom number range rule in a sandbox and test with VF01.

✅ CHECKPOINT: you choose between billing exits and VOFM routines and write volume-safe billing logic.

Code example

ABAP Code
* ===== RV60AFZZ =====FORM userexit_number_range USING us_range_intern.* Separate number range for export billing documents (range defined in VN01)  IF vbrk-fkart = 'ZF2E'.    us_range_intern = '38'.  ENDIF.ENDFORM. FORM userexit_fill_vbrk_vbrp.* Copy the customer's project number from the order header into the billing header  IF vbrk-zzproject IS INITIAL AND vbak-zzproject IS NOT INITIAL.    vbrk-zzproject = vbak-zzproject.  ENDIF.ENDFORM. * ===== Data transfer routine (VOFM -> Data transfer -> Billing documents) =====* Routine 901: copy fields and define invoice split criteria* FORM data_vbrk_901.*   DATA: BEGIN OF zuk,*           modul(3) VALUE '901',*           vtweg    LIKE vbak-vtweg,*           zzproject LIKE vbak-zzproject,     " split by project*         END OF zuk.*   zuk-vtweg     = vbak-vtweg.*   zuk-zzproject = vbak-zzproject.*   vbrk-zukri    = zuk.                      " different ZUKRI -> separate invoices* ENDFORM. * ===== Volume-safe lookup (buffer class used from the exit) =====* lv_segment = zcl_customer_buffer=>get_segment( vbrk-kunag ).   " one read per customer

Real project scenario

A company needed one invoice per customer project, but VF04 combined deliveries of different projects into one invoice. A developer first tried to split in RV60AFZZ by manipulating tables, which caused inconsistent billing documents in tests.
The correct solution was a data transfer routine for VBRK adding the project to ZUKRI, assigned in copy control VTFL for the relevant billing types. Invoices split correctly, and no user exit code was needed.

Common mistakes

  • Implementing invoice split logic in user exits instead of ZUKRI routines.
  • SELECTs per item in billing exits.
  • Hard-coding number ranges without VN01 setup.
  • Forgetting billing due list/background paths in tests.
  • Changing accounting-relevant fields without FI alignment.

Best practices

  • Use copy control routines for data transfer and split.
  • Keep billing exits minimal and buffered.
  • Align number range changes with FI/legal requirements.
  • Test VF01, VF04 and billing jobs with volume.
  • Document routines and exits in a register.

Interview angle

Questions: "Which billing user exits do you know?", "How do you split invoices by a custom field?", "How do you change the billing number range?"
Strong answer: RV60AFZZ (USEREXIT_FILL_VBRK_VBRP, USEREXIT_NUMBER_RANGE with US_RANGE_INTERN), RV60AFZC for account determination preparation; invoice split via data transfer routine filling VBRK-ZUKRI in VOFM assigned in copy control; watch volume in VF04; test background paths.

Practice this lesson

Quick check

1. Which FORM in RV60AFZZ lets you change the internal number range of billing documents?

2. Invoices must be split by a custom project field. Where is this best implemented?

3. Which include is commonly used for billing user exits?

Interview questions

1. A billing exit added a custom reference to F2 invoices, but the reference is missing on invoices from VF04 and on credit memos it should not appear. How do you fix and design this?

Answer it in your own words first, then compare.

2. A validation in MV45AFZZ is blocking all order types, but it should run only for one order type. What is the issue?

Answer it in your own words first, then compare.

Practice more with Interview AI →

Reference-verified: the steps are checked against official SAP documentation and tutorials, and object and field names in the sample code are checked for consistency. The code has not been compiled or run on an SAP system by ERPClimb. Syntax marked release-dependent varies by SAP release, so check it in your own system.

More lessons in this topic

Interview questions on this topic

Related SAP topics