# WM Count Result Upload from Scanner File with Tolerance Check Program

> A custom upload program that enters WM count results made with handheld scanners or Excel into inventory documents in bulk, calculates the difference value and separates rows outside tolerance for recount. Differences within tolerance become ready for clearing in LI20.

- Type: Program, Custom development, Mass upload
- Module: WM
- Estimated effort: M (6–9 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/programs/wm-inventory-count-result-upload-with-tolerance-check/


## Why is the standard not enough?

LI11N enters count results by hand, document by document and item by item; it does not upload from a file and does not compare the value of the entered difference with a tolerance. LI20 clears differences but does not separate which ones should be recounted first. In large counts, keying hundreds of bins by hand causes errors and delays.

### Closest standard alternatives

- LI11N: Enters count results by hand, document by document; no file upload and no tolerance check.
- LI20: Clears differences in WM; does not separate which differences should be recounted.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| LINK | Inventory document header and status | Read | - | ECC + S/4 |
| LINP | Bins in the document (items) | Read | LINP-LGNUM = LINK-LGNUM AND LINP-IVNUM = LINK-IVNUM | ECC + S/4 |
| LINV | System stock and counted quantity per quant (written via L_INV_COUNT_EXT) | Write | LINV-LGNUM = LINP-LGNUM AND LINV-IVNUM = LINP-IVNUM AND LINV-IVPOS = LINP-IVPOS | ECC + S/4 |
| MBEW | Unit price for the difference value | Read | MBEW-MATNR = LINV-MATNR AND MBEW-BWKEY = değerleme alanı (LINV-WERKS) | ECC + S/4 |
| MAKT | Material description in the logon language | Read | MAKT-MATNR = LINV-MATNR AND MAKT-SPRAS = SY-LANGU | ECC + S/4 |

## BAPIs and functions used

- L_INV_COUNT_EXT: Enters count results made outside SAP into the inventory document

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| P_FILE | Count file (XLSX or CSV) | Single value | - | Yes |
| P_TOLVAL | Allowed difference value per row | Single value | - | No |
| P_TOLPCT | Allowed difference percentage | Single value | - | No |
| P_ALL | Also enter rows outside tolerance | Checkbox | - | No |
| P_TEST | Test mode (check without entering counts) | Checkbox | - | No |

## Input file columns

| Column | Target field | Required |
|---|---|---|
| Warehouse number | LINV-LGNUM | Yes |
| Inventory document | LINV-IVNUM | Yes |
| Storage bin | LINV-LGPLA | Yes |
| Material | LINV-MATNR | Yes |
| Batch | LINV-CHARG | No |
| Counted quantity | LINV-MENGA | Yes |
| Unit | LINV-MEINS | No |

## Result list columns

| Column | Source |
|---|---|
| Row | Calculated: Row number in the file |
| Inventory document | LINV-IVNUM |
| Storage bin | LINV-LGPLA |
| Material | LINV-MATNR |
| Description | MAKT-MAKTX |
| System stock | LINV-GESME |
| Counted | LINV-MENGA |
| Difference qty | Calculated: Counted − system stock |
| Difference value | Calculated: Difference qty × MBEW price (STPRS or VERPR by VPRSV) ÷ PEINH |
| Status | Calculated: Entered, recount or error |
| Message | Calculated: Tolerance result or message from L_INV_COUNT_EXT |

## How does the program work?

1. The file (XLSX or CSV) is read; each row is expected to hold warehouse number, inventory document, bin, material, batch and counted quantity.
2. LINK-ISTAT is checked to confirm the inventory document is open and LINP to confirm the bin belongs to the document; system stock is read from LINV-GESME.
3. Difference quantity = counted − system stock; the difference value uses the MBEW price (STPRS when price control is S, VERPR when V, divided by the price unit).
4. When the difference value and percentage are within the tolerances on the selection screen, the row is entered as a count result with L_INV_COUNT_EXT.
5. Rows outside tolerance are not entered unless "Also enter rows outside tolerance" is selected; they go to a recount list that can be downloaded as a file to send back to the scanners.
6. In test mode no count is entered; the difference and tolerance result of all rows is listed.

## Authorization objects

- L_LGNUM: Inventory authorization by warehouse number and storage type
- L_TCODE: WM transaction authorization (count entry)

## Frequently asked questions

### Does the program also post the differences to stock?

No. The program enters the count result and evaluates the difference. Clearing the WM difference (LI20) and posting it to IM (LI21) deliberately remain separate steps, so finance approval is preserved.

### What if the scanner file layout changes?

The file layout is kept in a mapping table; adding a mapping for scanners with a different column order or headers needs no code change.

### How is a row matched when a bin holds several quants?

The row is matched to the quant (LINV-LQNUM) by material and batch. If the same material and batch has several quants, the counted quantity is split in proportion to system stock and this is shown in the log.

---
Let us build this program for your system: https://nekuhub.com/en/request-a-quote/?report=wm-cycle-count-result-upload
