# Number Range Exhaustion Alert Program (Email)

> A custom background program that checks the utilization of document, material and other number ranges every night and reports by email the intervals above the threshold, as well as objects that have no interval for the next year before year end. Mornings where nothing can be posted because a number range ran out are prevented in advance.

- Type: Program, Custom development, Background program
- Module: BASIS
- Estimated effort: S (2–3 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/programs/number-range-exhaustion-alert-program/


## Why is the standard not enough?

SNRO and the application screens show the current status of a number range one object at a time; the warning percentage of the object only produces a message when a number is drawn in dialog, and nobody sees that message for background postings. There is no standard monitor that scans all objects at once and reports a missing next-year interval before year end. The custom program does this check every night and sends an email only when there are findings.

### Closest standard alternatives

- SNRO: Shows the intervals and current level of one number range object; there is no automatic alert that scans all objects.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| NRIV | Number range intervals: sub-object, year, from, to and current level | Read | - | ECC + S/4 |
| TNRO | Warning percentage, year dependency and buffering of the object | Read | TNRO-OBJECT = NRIV-OBJECT | ECC + S/4 |

## BAPIs and functions used

- SO_NEW_DOCUMENT_ATT_SEND_API1: Sends the findings list to the BASIS team as an Excel attachment

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| S_OBJECT | Number range object | Range / multiple | NRIV-OBJECT | No |
| S_SUBOBJ | Sub-object (for example company code) | Range / multiple | NRIV-SUBOBJECT | No |
| P_PCT | Warning threshold (%) | Single value | - | Yes |
| P_NEXTYR | Check next-year interval | Checkbox | - | No |
| P_MAIL | Email recipient | Single value | - | No |
| P_ONLYF | Send email only when there are findings | Checkbox | - | No |

## Result list columns

| Column | Source |
|---|---|
| Object | NRIV-OBJECT |
| Sub-object | NRIV-SUBOBJECT |
| Interval | NRIV-NRRANGENR |
| To year | NRIV-TOYEAR |
| From number | NRIV-FROMNUMBER |
| To number | NRIV-TONUMBER |
| Current level | NRIV-NRLEVEL |
| Utilization % | Calculated: (NRLEVEL − FROMNUMBER) ÷ (TONUMBER − FROMNUMBER) × 100 |
| Remaining numbers | Calculated: NRIV-TONUMBER − NRIV-NRLEVEL |
| Object warning % | TNRO-PERCENTAGE |
| Buffering | TNRO-BUFFER |
| Finding | Calculated: Threshold exceeded or next-year interval missing |

## How does the program work?

1. The intervals of the selected objects are read from NRIV; external intervals (EXTERNIND = X) are skipped because the number is given by the user.
2. Utilization % = (NRLEVEL − FROMNUMBER) ÷ (TONUMBER − FROMNUMBER) × 100; remaining numbers = TONUMBER − NRLEVEL. Intervals from which no number has been drawn yet (NRLEVEL = 0) count as zero utilization.
3. Threshold: the general threshold on the selection screen or the warning percentage defined for the object in TNRO (PERCENTAGE), whichever is lower.
4. For year-dependent intervals (TOYEAR filled), with "Check next year" selected, a next-year entry is searched for every sub-object and interval number used this year; if none exists, a finding is written.
5. Buffering information (TNRO-BUFFER, NOIVBUFFER) is added to the finding; for buffered objects it is noted that actual usage can be a few numbers ahead.
6. Findings are written to an ALV list and the application log; if there is at least one finding, an email with an Excel attachment is sent with SO_NEW_DOCUMENT_ATT_SEND_API1.

## Authorization objects

- S_NUMBER: Display authorization for number range objects (activity 03)

## Frequently asked questions

### Does the program change number ranges?

No. The program only reads and reports. A new interval or next-year interval is created by an authorized person in SNRO or in the application's own screen (for example FBN1).

### Is the utilization correct for buffered objects?

For buffered objects the application servers reserve numbers in packages, so the level in NRIV is slightly ahead of actual usage. This means the warning comes early; the finding line shows the buffering setting.

### Can an exhaustion forecast (days left) be added?

Yes. Because the program writes the level to the log in each run, an estimated exhaustion date can be calculated from the consumption of the last 30 days. This extension takes about one day.

---
Let us build this program for your system: https://nekuhub.com/en/request-a-quote/?report=basis-number-range-exhaustion-alert-job
