Mass Material Price Change and Inventory Debit/Credit Posting
Short answer: A custom program that posts moving average or standard price corrections and debits/credits to inventory value from a file, for company and project stock. Before posting it shows old and new price, stock quantity and value difference for every material; after posting a control list with document numbers remains.
- Estimated effort
- M · 6–9 working days
- System
- ECC and S/4HANA
- Tables
- 7
- Scope
- Global
- Built by
- NeKuDos Teknoloji
- Last updated
Why is the standard not enough?
MR21 price changes and MR22 inventory debits/credits are entered material by material; for a correction of hundreds of materials the lines are typed by hand and no control list showing the value impact is available before posting. For project stock (valuated WBS stock) the same work is repeated in separate lines. CKM3N shows the result per material but does not correct in bulk. The custom program checks the file, shows the impact in advance and posts in bulk.
Who uses it? Cost accounting, inventory valuation and period-end closing teams, project controlling teams.
Closest standard alternatives
Tables used
The tables the program reads and updates. ECC and S/4HANA differences are marked separately.
| Table | Role | Access | System |
|---|---|---|---|
| MBEWMaterial Valuation | Material valuation: price control, price, stock and value | Read / write | ECC + S/4 |
| QBEWProject Stock Valuation | Valuated project stock: price and value per WBS | Read / write | ECC + S/4 |
| MARAGeneral Material Data | Material and base unit | Read | ECC + S/4 |
| T001KValuation Area | Valuation area to company code | Read | ECC + S/4 |
| CKMLHDMaterial Ledger: Header Record | Material ledger header (costing run unit) | Read | ECC + S/4 |
| CKMLCRMaterial Ledger: Period Totals (Values) | Material ledger period price and value | Read | ECC + S/4 |
| BKPFAccounting Document Header | Accounting documents created | Write | ECC + S/4 |
S/4HANA notes
- MBEW: In S/4HANA the Material Ledger is mandatory and valuation data is read through a compatibility view. Prices remain readable; validate value calculations against the currency and valuation view in use.
- QBEW: In S/4HANA QBEW is read through the compatibility view MBVQBEW. Reading code keeps working, but nothing should write to the table directly.
Selection screen parameters
| Parameter | Description | Type | Reference field | Required | Example |
|---|---|---|---|---|---|
| P_FILE | Price correction file | Single value | — | Yes | C:\temp\fiyat_duzeltme_2026_10.xlsx |
| P_BUDAT | Posting date (if empty in file) | Single value | — | No | 31.10.2026 |
| P_DEVPR | Price deviation threshold to flag (%) | Single value | — | No | 20 |
| P_TEST | Test mode (preview only) | Checkbox | — | No | X |
Input file columns
The columns of the upload template and the SAP fields they are written to. Columns with an asterisk are mandatory.
| # | Column | Target field | Required |
|---|---|---|---|
| 1 | Plant | MBEW-BWKEY | Yes |
| 2 | Material | MBEW-MATNR | Yes |
| 3 | Valuation type | MBEW-BWTAR | No |
| 4 | WBS element (project stock) | QBEW-PSPNR | No |
| 5 | Operation | By rule F = price change, B = debit, A = credit | Yes |
| 6 | New price | By rule Required for operation F | No |
| 7 | Price unit | MBEW-PEINH | No |
| 8 | Debit/credit amount | By rule Required for operation B or A | No |
| 9 | Reason | By rule Written to the document header text | No |
Sample upload file
| 1 | Plant * | Material * | Valuation type | WBS element (project stock) | Operation * | New price | Price unit | Debit/credit amount | Reason |
|---|---|---|---|---|---|---|---|---|---|
| 2 | 1000 | BTN-C30 | F | 2,450 | 1 | Supplier price difference correction | |||
| 3 | 1000 | DMR-16 | P-26014.01 | F | 24,800 | 1 | Project stock revaluation | ||
| 4 | 2000 | KBL-NYY-3X95 | A | 18,400 | Freight refund |
Result list columns
| # | Column | Source |
|---|---|---|
| 1 | Row | Calculated File row number |
| 2 | Plant | MBEW-BWKEY |
| 3 | Material | MBEW-MATNR |
| 4 | WBS | QBEW-PSPNR |
| 5 | Price control | MBEW-VPRSV |
| 6 | Stock | MBEW-LBKUM |
| 7 | Old price | Calculated MBEW/QBEW-VERPR or STPRS (by VPRSV) |
| 8 | New price | Calculated Price from the file or average after debit/credit |
| 9 | Old value | MBEW-SALK3 |
| 10 | Value difference | Calculated New value − old value |
| 11 | Document no. | Calculated Price change or accounting document number |
| 12 | Message | Calculated Check, BAPI or batch input message |
Sample result list
| Row | Plant | Material | WBS | Price control | Stock | Old price | New price | Old value | Value difference | Document no. | Message |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 2 | 1000 | BTN-C30 | V | 420 | 2,390 | 2,450 | 1,003,800 | 25,200 | Test: not posted | ||
| 3 | 1000 | DMR-16 | P-26014.01 | V | 18.50 | 23,900 | 24,800 | 442,150 | 16,650 | Test: not posted | |
| 4 | 2000 | KBL-NYY-3X95 | V | 0 | 412 | 412 | 0 | 0 | Stock is zero; amount will go to the price difference account |
How does the program work?
- The file contains plant (valuation area), material, valuation type, optional WBS element (project stock), operation (price change, debit, credit), new price and price unit or debit/credit amount, posting date and reason.
- Checks: does valuation data exist in MBEW, or in QBEW for project stock; does the price control (VPRSV) fit the operation; is the posting period open; if the new price differs from the current price by more than the percentage set during setup, the row is flagged.
- Preview: old price, new price, stock quantity (LBKUM), old value (SALK3), new value and the difference are calculated. If the material ledger is active, the period price is read from CKMLHD/CKMLCR.
- Price changes are posted with BAPI_MATVAL_PRICE_CHANGE; for valuated project stock the WBS element is passed as the special stock key. Debits/credits are posted as batch input of the MR22 transaction; if stock is zero, the amount goes to the price difference account as in standard and this is shown on the row.
- Price and stock value are updated in MBEW or QBEW and the accounting document is created in standard. For every row the material ledger or accounting document number is written to the list.
- In test mode only the preview runs; faulty rows go to an error file.
Performance notes
Read MBEW and QBEW in one query with the list of materials and valuation areas in the file. Package postings per valuation area and issue COMMIT WORK after each package; process batch input sessions in the background for thousands of rows.
Features
- Test mode (check without posting) Test mode shows the value impact of all rows without posting.
- Download failed lines as a separate file
- Export to Excel
- Line-by-line result and error log
Authorization objects
- K_ML_VAAuthorization to change prices in the material ledger
- F_BKPF_BUKAccounting posting authorization in the company code
Frequently asked questions
What happens with standard price materials?
For standard price materials a price change is only possible under the conditions allowed in the period, and the difference goes to the revaluation account. The program flags an operation that the price control does not allow as an error before posting.
What is different on S/4HANA?
On S/4HANA the material ledger is always active; a price change creates a material ledger document and inventory value is written to ACDOCA. The program reads the period price from CKMLCR in the preview; the posting path stays the same.
Related reports
Material Ledger Price Differences by Plant Report
A custom ALV report that shows the standard price, periodic unit price and price differences from the material ledger for all materials and plants in …
Material Quantity and Value Reconciliation Report (Opening, Receipts, Issues, Closing)
A custom ALV report that shows, for each material and the selected periods, opening stock, receipts, issues and closing stock in quantity and value …
Project Stock Left on Technically Completed or Closed WBS Elements Report
A custom ALV report that lists project stock (special stock Q) still sitting on technically completed (TECO) or closed (CLSD) WBS elements with …
Let us build this program for your system
Briefly describe your system and expectations. We will clarify the scope and come back with an effort and price quote.