CO Program Custom development Mass upload

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

  • MR21 Price Change. Enters price changes material by material; no bulk preview or control list.
  • MR22 Material Debit/Credit. Enters debits/credits to inventory value one by one.
  • CKM3N Material Price Analysis. Shows the material price analysis; does not correct in bulk.

Tables used

The tables the program reads and updates. ECC and S/4HANA differences are marked separately.

TableRoleAccessSystem
MBEWMaterial ValuationMaterial valuation: price control, price, stock and valueRead / writeECC + S/4
QBEWProject Stock ValuationValuated project stock: price and value per WBSRead / writeECC + S/4
MARAGeneral Material DataMaterial and base unitReadECC + S/4
T001KValuation AreaValuation area to company codeReadECC + S/4
CKMLHDMaterial Ledger: Header RecordMaterial ledger header (costing run unit)ReadECC + S/4
CKMLCRMaterial Ledger: Period Totals (Values)Material ledger period price and valueReadECC + S/4
BKPFAccounting Document HeaderAccounting documents createdWriteECC + 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

ParameterDescriptionTypeReference fieldRequiredExample
P_FILEPrice correction fileSingle value—YesC:\temp\fiyat_duzeltme_2026_10.xlsx
P_BUDATPosting date (if empty in file)Single value—No31.10.2026
P_DEVPRPrice deviation threshold to flag (%)Single value—No20
P_TESTTest mode (preview only)Checkbox—NoX

Input file columns

The columns of the upload template and the SAP fields they are written to. Columns with an asterisk are mandatory.

#ColumnTarget fieldRequired
1PlantMBEW-BWKEYYes
2MaterialMBEW-MATNRYes
3Valuation typeMBEW-BWTARNo
4WBS element (project stock)QBEW-PSPNRNo
5OperationBy rule F = price change, B = debit, A = creditYes
6New priceBy rule Required for operation FNo
7Price unitMBEW-PEINHNo
8Debit/credit amountBy rule Required for operation B or ANo
9ReasonBy rule Written to the document header textNo

Sample upload file

1Plant *Material *Valuation typeWBS element (project stock)Operation *New pricePrice unitDebit/credit amountReason
21000BTN-C30F2,4501Supplier price difference correction
31000DMR-16P-26014.01F24,8001Project stock revaluation
42000KBL-NYY-3X95A18,400Freight refund
A view built with fictional sample data; not real system data.

Result list columns

#ColumnSource
1RowCalculated File row number
2PlantMBEW-BWKEY
3MaterialMBEW-MATNR
4WBSQBEW-PSPNR
5Price controlMBEW-VPRSV
6StockMBEW-LBKUM
7Old priceCalculated MBEW/QBEW-VERPR or STPRS (by VPRSV)
8New priceCalculated Price from the file or average after debit/credit
9Old valueMBEW-SALK3
10Value differenceCalculated New value − old value
11Document no.Calculated Price change or accounting document number
12MessageCalculated Check, BAPI or batch input message

Sample result list

RowPlantMaterialWBSPrice controlStockOld priceNew priceOld valueValue differenceDocument no.Message
21000BTN-C30V4202,3902,4501,003,80025,200Test: not posted
31000DMR-16P-26014.01V18.5023,90024,800442,15016,650Test: not posted
42000KBL-NYY-3X95V041241200Stock is zero; amount will go to the price difference account
A view built with fictional sample data; not real system data.

How does the program work?

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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

CO Report Custom ALV report

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 …

CKMLHD · CKMLPP · CKMLCR · MBEW

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.

Related report: Mass Material Price Change and Inventory Debit/Credit Posting