# Scheduled Billing Job with Pre-Billing Checks and Hold List

> A custom background job that bills goods-issued, unbilled deliveries at set times and runs customer-specific checks before billing. Deliveries that fail a check are not billed; they go to a hold list with the reason and the billing team is notified by email.

- Type: Program, Custom development, Background program
- Module: SD
- Estimated effort: M (5–7 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/programs/scheduled-billing-job-with-pre-billing-checks/


## Why is the standard not enough?

VF04 processes the billing due list and VF06 runs it in the background with a variant. Neither applies business rules outside standard copy control: customers who require a customer PO number, payment terms or incoterms that differ from master data and goods issue dates outside the period are billed anyway and then cancelled and re-billed. A job that checks these rules before billing and reports the held items is needed.

### Closest standard alternatives

- VF04: Processes the billing due list; does not apply customer-specific pre-checks.
- VF06: Runs billing in the background; produces no hold list or reason email.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| LIKP | Deliveries to bill and goods issue date | Read | - | ECC + S/4 |
| LIPS | Delivery item, value and reference order | Read | LIPS-VBELN = LIKP-VBELN | ECC + S/4 |
| VBUP | Item billing status in ECC | Read | VBUP-VBELN = LIPS-VBELN AND VBUP-POSNR = LIPS-POSNR | ECC only |
| VBAK | Order header and billing block | Read | VBAK-VBELN = LIPS-VGBEL | ECC + S/4 |
| VBKD | Customer PO number, payment terms and incoterms | Read | VBKD-VBELN = LIPS-VGBEL | ECC + S/4 |
| KNVV | Customer sales area data: payment terms, incoterms, billing block | Read | KNVV-KUNNR = VBAK-KUNNR AND KNVV-VKORG = VBAK-VKORG AND KNVV-VTWEG = VBAK-VTWEG AND KNVV-SPART = VBAK-SPART | ECC + S/4 |
| VBRK | Billing headers created | Write | - | ECC + S/4 |
| VBRP | Billing items created | Write | - | ECC + S/4 |
| KNA1 | Customer name | Read | KNA1-KUNNR = LIKP-KUNNR | ECC + S/4 |

## BAPIs and functions used

- BAPI_BILLINGDOC_CREATEMULTIPLE: Bills the deliveries that passed the checks; also supports a test run
- BAPI_TRANSACTION_COMMIT: Saves the invoices created permanently
- SO_DOCUMENT_SEND_API1: Emails the hold list to the billing team

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| S_VKORG | Sales organization | Range / multiple | VBAK-VKORG | Yes |
| S_VSTEL | Shipping point | Range / multiple | LIKP-VSTEL | No |
| S_KUNNR | Ship-to party | Range / multiple | LIKP-KUNNR | No |
| S_GIDAT | Goods issue date range | Range / multiple | LIKP-WADAT_IST | Yes |
| P_FKDAT | Billing date (blank = goods issue date) | Single value | VBRK-FKDAT | No |
| P_MAIL | Email address for the hold list | Single value | - | No |
| P_TEST | Test mode (check without creating invoices) | Checkbox | - | No |

## Result list columns

| Column | Source |
|---|---|
| Delivery | LIKP-VBELN |
| Ship-to | LIKP-KUNNR |
| Customer name | KNA1-NAME1 |
| Goods issue date | LIKP-WADAT_IST |
| Delivery value | Calculated: Sum of LIPS-NETWR of the delivery |
| Billing document | VBRK-VBELN |
| Invoice value | VBRK-NETWR |
| Result | Calculated: Billed, test OK, on hold or error |
| Reason | Calculated: Text of the first failed check or the BAPI error message |

## How does the program work?

1. Deliveries in the selection are read: goods-issued (WADAT_IST filled) items whose billing status is open or partially processed (VBUP-FKSTA in ECC, LIPS-FKSTA in S/4HANA).
2. For each delivery the order data is read and the checks run: the customer PO number (VBKD-BSTKD) must be filled for customers who require it, the payment terms (VBKD-ZTERM) and incoterms (VBKD-INCO1) on the order must match the customer's sales area data (KNVV), there must be no billing block on the order (VBAK-FAKSK) or the customer (KNVV-FAKSD), and the goods issue date must be in an open period. Which rule applies to which customer is kept in a small rule table maintained by the business.
3. Deliveries that pass are billed with BAPI_BILLINGDOC_CREATEMULTIPLE; in test mode the same BAPI is called as a test run and no invoice is created.
4. Deliveries that fail are written to a hold list with the reason; the list is emailed to the billing team with SO_DOCUMENT_SEND_API1.
5. Invoices created (VBRK, VBRP) and their values are listed in the job log; once the reason is fixed, the delivery is retried automatically in the next run.

## Authorization objects

- V_VBRK_FKA: Billing creation authorization by billing type
- V_VBRK_VKO: Billing authorization by sales organization
- S_OC_SEND: Authorization to send email

## Frequently asked questions

### Does it change the invoice split rules?

No. Standard copy control decides which deliveries combine into one invoice. The program only filters which deliveries go to billing, so one faulty delivery does not hold up the whole group.

### How are held deliveries released?

Once the reason is fixed on the order or in master data, the delivery is billed automatically in the next run. An authorized user can skip a specific check once for a single delivery; that decision is written to the log.

### Can it be used on S/4HANA?

Yes. BAPI_BILLINGDOC_CREATEMULTIPLE is supported on S/4HANA as well; the billing status is read from LIPS instead of VBUP. It also works alongside the Fiori billing apps.

---
Let us build this program for your system: https://nekuhub.com/en/request-a-quote/?report=sd-scheduled-billing-with-checks
