# EWM to ERP Production Consumption and Stock Type Reconciliation Report

> A custom report that compares ERP consumption per production order with the quantity staged to the production supply area in EWM and the quantity left in the PSA, and shows duplicate consumption, consumption missing after a reversal and failed movements in one list. It also compares ERP stock types with EWM stock types per material and storage location; selected differences can be checked in test mode and corrected in bulk.

- Type: Report, Custom development, ALV report
- Module: WM
- Estimated effort: M (8–12 working days)
- Last updated: 2026-11-18
- URL: https://nekuhub.com/en/reports/ewm-erp-production-consumption-and-stock-type-reconciliation/


## Why is the standard not enough?

Consumption differences between EWM and ERP arise from queue errors, the same consumption posted twice, or consumption not reposted after a reversal. COGI shows only failed movements, SMQ2 the queues, and /SCWM/ERP_STOCKCHECK the total stock difference; none of them links the difference to a production order or detects duplicate consumption. Stock type differences (unrestricted, quality, blocked) are investigated separately.

### Closest standard alternatives

- COGI: Shows failed movements; does not detect duplicate or missing consumption.
- SMQ2: Shows queue errors; does not link them to orders or differences.
- /SCWM/MON: Shows PSA stock; does not compare it with ERP consumption.
- MB51: Lists consumption documents; does not show the EWM side.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| RESB | Order component requirement and withdrawn quantity | Read | - | ECC + S/4 |
| MATDOC | ERP consumption movements; corrections write new consumption or reversals | Read / write | MATDOC-RSNUM = RESB-RSNUM AND MATDOC-RSPOS = RESB-RSPOS | ECC + S/4 |
| AFFW | Failed goods movements (COGI) | Read | AFFW-RSNUM = RESB-RSNUM AND AFFW-RSPOS = RESB-RSPOS | ECC + S/4 |
| /SCWM/ORDIM_C | Quantity staged to the PSA | Read | - | ECC + S/4 |
| /SCWM/AQUA | Stock left in the PSA and EWM stock types | Read | - | ECC + S/4 |
| MARD | ERP stock types: unrestricted, quality, blocked | Read | MARD-MATNR = RESB-MATNR AND MARD-WERKS = RESB-WERKS | ECC + S/4 |

## BAPIs and functions used

- BAPI_GOODSMVT_CREATE: Posts missing consumption
- BAPI_GOODSMVT_CANCEL: Cancels duplicate consumption
- BAPI_TRANSACTION_COMMIT: Commits the correction

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| P_WERKS | Plant | Single value | MATDOC-WERKS | Yes |
| P_LGNUM | Warehouse number | Single value | /SCWM/AQUA-LGNUM | Yes |
| S_BUDAT | Posting date | Range / multiple | MATDOC-BUDAT | Yes |
| S_AUFNR | Production order | Range / multiple | RESB-AUFNR | No |
| S_MATNR | Material | Range / multiple | RESB-MATNR | No |
| P_MODE | Mode: consumption reconciliation / stock type comparison | Radio button | - | Yes |
| P_TEST | Test mode for corrections | Checkbox | - | No |

## Output columns

| Column | Source |
|---|---|
| Order | RESB-AUFNR |
| Material | RESB-MATNR |
| Required | RESB-BDMNG |
| Staged to PSA | Calculated: Σ /SCWM/ORDIM_C-NISTA |
| ERP consumption | Calculated: Σ MATDOC 261 − 262 |
| PSA stock (EWM) | Calculated: Σ /SCWM/AQUA-QUAN, PSA storage types |
| Difference | Calculated: (Staged − ERP consumption) − PSA stock |
| Failed movements | Calculated: Number of AFFW records |
| Finding | Calculated: Duplicate, missing consumption, failed movement, stock type difference or matched |
| Status | Calculated: Open, test OK, corrected or error |

## How does the report work?

1. Components of the orders in the selected plant and date range are read from RESB (BDMNG, ENMNG).
2. ERP consumption is totalled from MATDOC per order and reservation item (261 − 262; documents flagged CANCELLED excluded). Two 261 postings of the same quantity on the same reservation item within a short time, and total consumption above both the requirement and the staged quantity, are flagged as suspected duplicates.
3. Items reversed with 262 but not consumed again with 261, while the order has confirmations, are flagged as 'missing consumption'.
4. Failed movements from AFFW (MSGID, MSGNO) are added per order and material.
5. EWM side: the quantity staged to the PSA is read from /SCWM/ORDIM_C (PSA, NISTA) and the stock left in the PSA from /SCWM/AQUA; the product GUID is resolved through /SAPAPO/MATKEY and the storage location mapping through /SCWM/TMAPSTLOC. Expected PSA stock = staged − ERP consumption; the difference is shown on the line.
6. Stock type mode: per material and storage location, MARD (LABST, INSME, SPEME) is compared with the EWM stock types (CAT) in /SCWM/AQUA using the mapping defined during installation.
7. Correction: for selected lines missing consumption is posted with BAPI_GOODSMVT_CREATE and duplicate consumption is cancelled with BAPI_GOODSMVT_CANCEL. Test mode only checks; every action is logged.

## Authorization objects

- M_MSEG_BWA: Correction authorization for movement types 261/262
- M_MSEG_WWA: Material document authorization by plant
- C_AFKO_AWK: Production order display

## Frequently asked questions

### Are duplicate consumptions cancelled automatically?

No. The program flags suspected lines; cancellation is done by user selection and first in test mode. The order's confirmation and costing status (e.g. closed period, technically completed order) is checked.

### Which system releases does it run on?

The report is designed for embedded EWM on S/4HANA; ERP consumption is read from MATDOC. With decentralized EWM the EWM tables are in another system, so data is fetched through RFC and the effort grows by about 3 days.

---
Let us build this report for your system: https://nekuhub.com/en/request-a-quote/?report=ewm-erp-consumption-reconciliation
