Sub topic 16
What changed in S/4HANA
This chapter covers what SAP S/4HANA changed for the material master. It assumes you know the views and organizational levels from earlier chapters and can read basic ABAP. The master data model is mostly the same. The changes are in the material number, the storage of stock, valuation, and the user interface. These changes affect custom code and interfaces more than they affect the way you maintain a material.
What stays and what moves
| Area | SAP ECC | SAP S/4HANA |
|---|---|---|
| Material number | 18 characters | Up to 40 characters, if you activate it |
| Material documents | Tables MKPF and MSEG | Table MATDOC, with MKPF and MSEG as compatibility views |
| Stock quantities | Stored in aggregate tables such as MARD | Calculated from MATDOC. Compatibility views serve old reads |
| Material Ledger | Optional | Always active for valuation |
| Vendors and customers | Separate master records | Business Partner, linked through Customer/Vendor Integration |
| MRP run | Classic MD01 | MRP Live (MD01N) on SAP HANA |
| Main user interface | MM01, MM02, MM03 | Fiori apps, with the transactions still available |
The general data (MARA), descriptions (MAKT), plant data (MARC), and valuation data (MBEW) still exist. Views, organizational levels, material types, and field selection work as in earlier chapters.
The 40-character material number
The data element MATNR is 40 characters long in S/4HANA. Whether the system accepts numbers longer than 18 characters depends on a setting you activate in Customizing.
- The default behavior stays at 18 characters, so existing interfaces keep working.
- Activation is a project decision. Treat it as irreversible.
- After activation, material numbers can reach 40 characters, so every interface, report, and custom table must handle that length.
Most breakage comes from custom code that assumes 18 characters. Typical causes are:
- A variable declared as
c LENGTH 18instead ofTYPE matnr. - A file layout with a fixed 18-character column.
- A custom table that stores the number in a shorter field.
- A conversion exit (
MATN1) that is applied or skipped inconsistently.
Declare material numbers with the data element. Run the custom code checks (ABAP Test Cockpit with the S/4HANA readiness checks) before activation.
BAPIs keep the old 18-character field and add a long field. In BAPIMATHEAD, the MATERIAL_LONG field carries the long number. The following program creates a material with a number longer than 18 characters. It only works if the extended length is activated.
REPORT zdemo_long_matnr.
DATA: ls_head TYPE bapimathead,
ls_client TYPE bapi_mara,
ls_clientx TYPE bapi_marax,
lt_desc TYPE STANDARD TABLE OF bapi_makt,
ls_return TYPE bapiret2.
ls_head-material_long = 'ZDEMO_LONG_MATERIAL_NUMBER_0001'.
ls_head-ind_sector = 'M'.
ls_head-matl_type = 'HAWA'.
ls_head-basic_view = abap_true.
ls_client-base_uom = 'EA'.
ls_clientx-base_uom = abap_true.
APPEND VALUE #( langu = 'E' matl_desc = 'Demo long number' ) TO lt_desc.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = ls_head
clientdata = ls_client
clientdatax = ls_clientx
IMPORTING
return = ls_return
TABLES
materialdescription = lt_desc.
IF ls_return-type CA 'EAX'.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
WRITE: / ls_return-message.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = abap_true.
ENDIF.Material documents and stock
In ECC, every goods movement wrote a header to MKPF and an item to MSEG. It also updated aggregate tables that held current stock, such as the quantity fields in MARD, MCHB, and MKOL. This produced locks and duplicate data.
S/4HANA redesigned this model:
- A goods movement writes one row to MATDOC.
- Stock quantities are derived from MATDOC instead of being updated in place.
- MKPF, MSEG, and the old stock tables remain as compatibility views, so older reports still run.
The practical effects are:
- Reading master data fields from MARD still works with ABAP SQL.
- Writing stock quantity fields in MARD directly no longer makes sense. Post a goods movement instead.
- Custom code that updates these tables with
UPDATEorMODIFYfails or corrupts data. Replace it with BAPIs such asBAPI_GOODSMVT_CREATE.
Compatibility details differ by release. Check SAP Note 2206980 and the simplification list for your version.
Valuation and the Material Ledger
The Accounting views still hold the valuation class, price control, and prices in MBEW. Two things changed:
- The Material Ledger is mandatory for valuation. In ECC it was an optional add-on.
- Valuation postings go to the Universal Journal (table ACDOCA), so material valuation and finance share one source.
Actual costing stays optional per valuation area. The price control still decides whether a material is valued at standard price (S) or moving average price (V). With the Material Ledger active, the system also keeps values in several currencies and valuation views.
Business Partner and MRP
The vendor and customer master are now maintained as business partners. The Purchasing and Sales views of the material master still reference vendors and customers, but you maintain the partners with transaction BP. Customer/Vendor Integration keeps the old vendor and customer numbers aligned.
MRP Live (MD01N) runs the planning logic in the database instead of the application server. The MRP views keep the same fields (MRP type, lot size, procurement type, planning time fence). Classic MRP (MD01) is only kept for compatibility, so do not build new processes on it.
Fiori and product terminology
SAP Fiori apps such as Manage Product Master Data use the word product for what the transactions call a material. The data is the same record. Keep these points in mind:
- Not every field and industry-specific view is available in every app. Check coverage before you remove transactions from a role.
- Field selection and material type settings still control what each user sees.
- MM01 and MM02 remain available, so training can move step by step.
Common errors after migration
- Programs that write stock fields directly and now fail.
- Hard-coded 18-character material numbers in files, IDocs, or custom tables.
- Reports that read MKPF and MSEG for large volumes. They work through compatibility views, but reading MATDOC directly is faster.
- Assuming MRP Live and classic MRP give the same results without testing the parameters.
Exercise
A custom report reads LABST from MARD and a custom program updates LABST directly after a count. What do you check, and what do you change in each program?
Show answer
The reading report should still run through the compatibility views, so test it on your release and check SAP Note 2206980. The updating program must stop writing to MARD, because stock is derived from MATDOC. Replace the direct update with a goods movement, for example a physical inventory posting or BAPIGOODSMVTCREATE.
Exercise
Your company wants to use 30-character material numbers. Name the setting that must be activated, one risk of activating it, and one coding rule that prevents most problems.
Show answer
The extended material number must be activated in Customizing. It is irreversible, and every interface or custom object that assumes 18 characters can break. Declare material numbers with the data element MATNR instead of a fixed length, and pass long numbers to BAPIs in MATERIAL_LONG.