MSEG
transaction S/4HANA status: Replaced · Compat ViewCompatibility view: the classic table name is redirected to a view over the new persistence
Document Segment: Material
In S/4HANA replaced by MATDOC; exists as CDS compatibility view
What the badges mean
- S/4HANA status: Active
- Active and unchanged in S/4HANA.
- S/4HANA status: Deprecated
- Still readable today, but no longer SAP's strategic path — plan around it.
- S/4HANA status: Replaced
- Replaced by a new persistence in S/4HANA; the classic name may still answer reads (see read mechanism).
- S/4HANA status: Migrating to IBP
- Planning scope is moving from APO toward IBP.
- S/4HANA status: Active (StRM) · Replaced (EWM)
- Path-dependent: active with SAP Stock Room Management, replaced where EWM is the warehouse path.
- S/4HANA status: Replaced · Compat View
- Compatibility view: the classic table name is redirected to a view over the new persistence — see how the physical model moved.
- S/4HANA status: Active · Proxy View
- Proxy view: reads route through NSDM proxy/CDS views — see how the physical model moved.
- master
- Data class: what the table holds — master data, transaction documents, org structure, config, or texts (one row per language — see the quirks guide).
- Linked type codes
CLNT — the client key; filter it explicitly and carry it through every join.
NUMC — fixed-width numeric text; keep it a string and keep the leading zeros.
DATS, TIMS — character date (YYYYMMDD) and time (HHMMSS), zero-filled when initial.
CURR, CUKY, QUAN, UNIT — amounts and quantities, meaningful only beside the currency key or unit that qualifies them.
LANG — a language key in a text table — one row per language.
Fields
59 fields · 4 key
The join key is all 4 key fields together — matching on any single one fans out. See composite keys in the quirks guide.
59 fields.
| Key | Field | Description | Type | Length | References |
|---|---|---|---|---|---|
| Primary key | MANDT | Client | CLNT | 3 | T000 |
| Primary key | MBLNR | Number of Material Document | CHAR | 10 | MKPF |
| Primary key | MJAHR | Material Document Year | NUMC | 4 | |
| Primary key | ZEILE | Item in Material Document | NUMC | 4 | |
| BWART | Movement Type (Inventory Management) | CHAR | 3 | T156 | |
| MATNR | Material Number | CHAR | 18 / 40 | MARA | |
| WERKS | Plant | CHAR | 4 | T001W | |
| LGORT | Storage Location | CHAR | 4 | T001L | |
| CHARG | Batch Number | CHAR | 10 | ||
| INSMK | Stock Type | CHAR | 1 | ||
| SOBKZ | Special Stock Indicator | CHAR | 1 | T148 | |
| LIFNR | Account Number of Vendor or Creditor | CHAR | 10 | LFA1 | |
| KUNNR | Account Number of Customer or Debtor | CHAR | 10 | KNA1 | |
| KDAUF | Sales Order Number of Valuated Sales Order Stock | CHAR | 10 | ||
| KDPOS | Sales Order Item | NUMC | 6 | ||
| SHKZG | Debit/Credit Indicator | CHAR | 1 | ||
| WAERS | Currency Key | CUKY | 5 | TCURC | |
| DMBTR | Amount in Local Currency | CURR | 13,2 | ||
| MENGE | Quantity | QUAN | 13,3 | ||
| MEINS | Base Unit of Measure | UNIT | 3 | T006 | |
| ERFMG | Quantity in Unit of Entry | QUAN | 13,3 | ||
| ERFME | Unit of Entry | UNIT | 3 | T006 | |
| EBELN | Purchase Order Number | CHAR | 10 | EKKO | |
| EBELP | Item Number of Purchasing Document | NUMC | 5 | ||
| RSNUM | Number of Reservation/Dependent Requirements | NUMC | 10 | ||
| RSPOS | Item Number of Reservation/Dependent Requirements | NUMC | 4 | ||
| AUFNR | Order Number | CHAR | 12 | AUFK | |
| KOSTL | Cost Center | CHAR | 10 | CSKS | |
| SAKTO | G/L Account Number | CHAR | 10 | ||
| GSBER | Business Area | CHAR | 4 | TGSB | |
| PRCTR | Profit Center | CHAR | 10 | CEPC | |
| BUKRS | Company Code | CHAR | 4 | T001 | |
| VBELN_IM | Delivery | CHAR | 10 | ||
| VBELP_IM | Delivery Item | NUMC | 6 | ||
| LGNUM | Warehouse Number/Complex | CHAR | 3 | T300 | |
| LGTYP | Storage Type | CHAR | 3 | ||
| LGPLA | Storage Bin | CHAR | 10 | ||
| BWTAR | Valuation Type | CHAR | 10 | ||
| GRUND | Reason for Movement | NUMC | 4 | ||
| EXBWR | Externally Entered Posting Amount in Local Currency | CURR | 13,2 | ||
| EXVKW | Externally Entered Sales Value in Local Currency | CURR | 13,2 | ||
| BUDAT_MKPF | Posting Date in the Document | DATS | 8 | ||
| CPUDT_MKPF | Day On Which Accounting Document Was Entered | DATS | 8 | ||
| CPUTM_MKPF | Time of Entry | TIMS | 6 | ||
| USNAM_MKPF | User Name | CHAR | 12 | ||
| XBLNR_MKPF | Reference Document Number | CHAR | 16 | ||
| PS_PSP_PNR | Work Breakdown Structure Element (WBS Element) | NUMC | 8 | ||
| NPLNR | Network Number for Account Assignment | CHAR | 12 | ||
| ANLN1 | Main Asset Number | CHAR | 12 | ||
| ANLN2 | Asset Sub-Number | CHAR | 4 | ||
| WEMPF | Goods Recipient | CHAR | 12 | ||
| ABLAD | Unloading Point | CHAR | 25 | ||
| VFDAT | Shelf Life Expiration or Best-Before Date | DATS | 8 | ||
| KZBEW | Movement Indicator | CHAR | 1 | ||
| KZVBR | Consumption Posting | CHAR | 1 | ||
| KZZUG | Receipt Indicator | CHAR | 1 | ||
| UMWRK | Receiving/Issuing Plant | CHAR | 4 | T001W | |
| UMLGO | Receiving/Issuing Storage Location | CHAR | 4 | T001L | |
| SGTXT | Item Text | CHAR | 50 |
Lengths shown as ECC / S/4HANA where the extended material number applies.
Linked type codes in the Type column jump to the matching section of the SAP data quirks guide.
Field provenance: hand-curated.
Boilerplate SQL
Starting point for reading MSEG on Databricks. Set your Unity Catalog location and filter values below — they’re substituted into the SQL and the copy button.
3 parameters not filled: <catalog>, <schema>, <MANDT>
-- ============================================================
-- Table : MSEG Document Segment: Material
-- Purpose: Column-selected read of MSEG — auto-generated from field metadata
-- Grain : One row per MBLNR + MJAHR + ZEILE
-- Notes : Auto-generated skeleton. For multi-table transaction query patterns, see the linked t-codes on this page. Set catalog/schema to your Unity Catalog location; fill remaining placeholders (<...>) for your tenant.
-- ============================================================
SELECT
l.MANDT AS "Client",
l.MBLNR AS "Number of Material Document",
l.MJAHR AS "Material Document Year",
l.ZEILE AS "Item in Material Document",
l.BWART AS "Movement Type (Inventory Management)",
l.MATNR AS "Material Number",
l.WERKS AS "Plant",
l.LGORT AS "Storage Location",
l.CHARG AS "Batch Number",
l.INSMK AS "Stock Type",
l.SOBKZ AS "Special Stock Indicator",
l.LIFNR AS "Account Number of Vendor or Creditor",
l.KUNNR AS "Account Number of Customer or Debtor",
l.KDAUF AS "Sales Order Number of Valuated Sales Order Stock",
l.KDPOS AS "Sales Order Item",
l.SHKZG AS "Debit/Credit Indicator",
l.WAERS AS "Currency Key",
l.DMBTR AS "Amount in Local Currency",
l.MENGE AS "Quantity",
l.MEINS AS "Base Unit of Measure",
l.ERFMG AS "Quantity in Unit of Entry",
l.ERFME AS "Unit of Entry",
l.EBELN AS "Purchase Order Number",
l.EBELP AS "Item Number of Purchasing Document",
l.RSNUM AS "Number of Reservation/Dependent Requirements",
l.RSPOS AS "Item Number of Reservation/Dependent Requirements",
l.AUFNR AS "Order Number",
l.KOSTL AS "Cost Center",
l.SAKTO AS "G/L Account Number",
l.GSBER AS "Business Area",
l.PRCTR AS "Profit Center",
l.BUKRS AS "Company Code",
l.VBELN_IM AS "Delivery",
l.VBELP_IM AS "Delivery Item",
l.LGNUM AS "Warehouse Number/Complex",
l.LGTYP AS "Storage Type",
l.LGPLA AS "Storage Bin",
l.BWTAR AS "Valuation Type",
l.GRUND AS "Reason for Movement",
l.EXBWR AS "Externally Entered Posting Amount in Local Currency"
-- … plus 19 more columns — full list in the Fields section above
FROM <catalog>.<schema>.mseg l
WHERE
l.MANDT = '<MANDT>'
ORDER BY l.MBLNR;Verified August 2026
Released CDS views over this table
Released SAP standard VDM views that read over MSEG. Prefer these over classic-table reads on S/4HANA where available.
Relationships
Diagram of 1-hop neighbors — join details below.
Transaction Codes That Use This Table
R read · W write · R/W read + write
Primary t-codes
Secondary t-codes
- CO15Enter Confirmation (Order)Write accessCreate
- MB1AGoods WithdrawalRead/write accessCreateS/4HANA status: Replaced
- MB1BTransfer PostingRead/write accessCreateS/4HANA status: Replaced
- MB1COther Goods ReceiptsRead/write accessCreateS/4HANA status: Replaced
- MB31Goods Receipt for Production OrderRead/write accessCreateS/4HANA status: Replaced