# Average Due Date and Late Payment Interest (Adat) Calculation Program

> A custom program that calculates the amount-weighted average due date, days overdue and the adat total (amount × days) from open and cleared items on customer accounts, works out late payment interest at the contractual annual rate, and creates the interest invoice as an accounting document for the amounts approved.

- Type: Program, Custom development, Background program
- Module: FI
- Estimated effort: M (7–10 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/programs/average-due-date-and-late-payment-interest-calculation/


## Why is the standard not enough?

FBL5N shows the due date and days overdue per item, but it does not calculate the amount-weighted average due date of the account or the adat total. The standard item interest calculation (FINT) needs an interest indicator and separate configuration, and it does not give an account-level adat statement that covers partial payments and items cleared in the period. So average due date and late payment interest are usually worked out in a spreadsheet and invoiced by hand.

### Closest standard alternatives

- FBL5N: Shows due date and delay per item; no average due date or adat calculation.
- FD10N: Shows the customer balance by period; no due date weighting.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| BSID | Customer open items: amount, baseline date and payment terms | Read | - | ECC + S/4 |
| BSAD | Items cleared in the period and their clearing date | Read | - | ECC + S/4 |
| KNA1 | Customer name and address (for the statement) | Read | KNA1-KUNNR = BSID-KUNNR | ECC + S/4 |
| KNB1 | Company code customer data: reconciliation account and interest indicator | Read | KNB1-KUNNR = BSID-KUNNR AND KNB1-BUKRS = BSID-BUKRS | ECC + S/4 |
| T052 | Payment term days: net due date calculation | Read | - | ECC + S/4 |
| BKPF | Late payment interest invoice document created | Write | - | ECC + S/4 |

## BAPIs and functions used

- BAPI_ACC_DOCUMENT_POST: Posts the interest invoice as an accounting document
- BAPI_TRANSACTION_COMMIT: Commits after each customer document
- CALCULATE_TAX_FROM_NET_AMOUNT: Calculates the tax on the interest amount

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| P_BUKRS | Company code | Single value | BSID-BUKRS | Yes |
| S_KUNNR | Customer | Range / multiple | BSID-KUNNR | No |
| P_KEYDT | Calculation date | Single value | - | Yes |
| S_AUGDT | Clearing date range | Range / multiple | BSAD-AUGDT | No |
| P_RATE | Annual interest rate (%) (if no customer setting) | Single value | - | No |
| P_MIN | Minimum interest amount to invoice | Single value | - | No |
| P_POST | Create interest invoice document | Checkbox | - | No |

## Result list columns

| Column | Source |
|---|---|
| Customer | BSID-KUNNR |
| Name | KNA1-NAME1 |
| Total amount | Calculated: Total amount of the items included |
| Average due date | Calculated: Σ(amount × due day) / Σ amount |
| Average days overdue | Calculated: Σ adat / Σ amount |
| Adat | Calculated: Σ(amount × days overdue) |
| Annual rate (%) | Calculated: Customer setting or the rate on the selection screen |
| Interest amount | Calculated: Adat × rate / (100 × 365) |
| Invoice document | BKPF-BELNR |
| Status | Calculated: Calculated, below minimum, invoiced or error |

## How does the program work?

1. For the selected customers, open items are read from BSID and items cleared in the period from BSAD; the net due date is calculated from the baseline date and payment terms (T052).
2. Average due date = Σ(amount × due date as day number) / Σ amount; debit and credit items can be shown separately and net.
3. Days overdue are found for each item: key date − due date for open items, clearing date − due date for cleared items. Adat = amount × days overdue; for partial payments the remaining amount is calculated as its own slice.
4. Interest = Σ adat × annual rate / (100 × 365); the rate comes from the selection screen or a customer-level settings table. Interest below the minimum amount is listed but not invoiced.
5. Once the list is approved, a document is created with BAPI_ACC_DOCUMENT_POST that debits the customer and credits late payment interest income; the tax code comes from the settings table and the tax amount is calculated.
6. An adat statement with the item breakdown can be sent to the customer as a PDF.

## Authorization objects

- F_KNA1_BUK: Authorization to display customer accounts in the company code
- F_BKPF_BUK: Posting authorization for the interest invoice

## Frequently asked questions

### Can it be calculated for vendor accounts too?

Yes. The same calculation can be applied to vendor accounts through BSIK and BSAK; on the vendor side the result is listed for information or used to check incoming interest invoices.

### How do credit items (returns, down payments) affect the average?

Depending on the selection, credit items are either left out of the average or included as negative amounts. With the net method a customer's early payments offset its delays; the method is chosen according to the customer contract.

### How is tax determined on the interest invoice?

The interest income account and tax code are defined per company code in the settings table. The tax amount is calculated with that tax code when the document is created; the tax treatment is checked against current regulation at installation.

---
Let us build this program for your system: https://nekuhub.com/en/request-a-quote/?report=fi-average-due-date-interest
