Skip to content
SAP Reference

MSEG

transaction S/4HANA status: Replaced · Compat View

Compatibility view: the classic table name is redirected to a view over the new persistence

Document Segment: Material

Notes

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.

In field listings, K marks a primary-key field, and linked type codes in the Type column jump to the matching quirks-guide section.

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.

Table fields: key flag, field name, description, data type (linked to the data quirks guide where the type carries a known trap), length, and check-table references. 59 fields.
KeyFieldDescriptionTypeLengthReferences
Primary keyMANDTClientCLNT3T000
Primary keyMBLNRNumber of Material DocumentCHAR10MKPF
Primary keyMJAHRMaterial Document YearNUMC4
Primary keyZEILEItem in Material DocumentNUMC4
BWARTMovement Type (Inventory Management)CHAR3T156
MATNRMaterial NumberCHAR18 / 40MARA
WERKSPlantCHAR4T001W
LGORTStorage LocationCHAR4T001L
CHARGBatch NumberCHAR10
INSMKStock TypeCHAR1
SOBKZSpecial Stock IndicatorCHAR1T148
LIFNRAccount Number of Vendor or CreditorCHAR10LFA1
KUNNRAccount Number of Customer or DebtorCHAR10KNA1
KDAUFSales Order Number of Valuated Sales Order StockCHAR10
KDPOSSales Order ItemNUMC6
SHKZGDebit/Credit IndicatorCHAR1
WAERSCurrency KeyCUKY5TCURC
DMBTRAmount in Local CurrencyCURR13,2
MENGEQuantityQUAN13,3
MEINSBase Unit of MeasureUNIT3T006
ERFMGQuantity in Unit of EntryQUAN13,3
ERFMEUnit of EntryUNIT3T006
EBELNPurchase Order NumberCHAR10EKKO
EBELPItem Number of Purchasing DocumentNUMC5
RSNUMNumber of Reservation/Dependent RequirementsNUMC10
RSPOSItem Number of Reservation/Dependent RequirementsNUMC4
AUFNROrder NumberCHAR12AUFK
KOSTLCost CenterCHAR10CSKS
SAKTOG/L Account NumberCHAR10
GSBERBusiness AreaCHAR4TGSB
PRCTRProfit CenterCHAR10CEPC
BUKRSCompany CodeCHAR4T001
VBELN_IMDeliveryCHAR10
VBELP_IMDelivery ItemNUMC6
LGNUMWarehouse Number/ComplexCHAR3T300
LGTYPStorage TypeCHAR3
LGPLAStorage BinCHAR10
BWTARValuation TypeCHAR10
GRUNDReason for MovementNUMC4
EXBWRExternally Entered Posting Amount in Local CurrencyCURR13,2
EXVKWExternally Entered Sales Value in Local CurrencyCURR13,2
BUDAT_MKPFPosting Date in the DocumentDATS8
CPUDT_MKPFDay On Which Accounting Document Was EnteredDATS8
CPUTM_MKPFTime of EntryTIMS6
USNAM_MKPFUser NameCHAR12
XBLNR_MKPFReference Document NumberCHAR16
PS_PSP_PNRWork Breakdown Structure Element (WBS Element)NUMC8
NPLNRNetwork Number for Account AssignmentCHAR12
ANLN1Main Asset NumberCHAR12
ANLN2Asset Sub-NumberCHAR4
WEMPFGoods RecipientCHAR12
ABLADUnloading PointCHAR25
VFDATShelf Life Expiration or Best-Before DateDATS8
KZBEWMovement IndicatorCHAR1
KZVBRConsumption PostingCHAR1
KZZUGReceipt IndicatorCHAR1
UMWRKReceiving/Issuing PlantCHAR4T001W
UMLGOReceiving/Issuing Storage LocationCHAR4T001L
SGTXTItem TextCHAR50

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.

Query parameters

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

More query patterns: MB01 MB51 MIGO

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.

Join details

  • MKPFMSEGheader item · 1:N
    ON mkpf.MBLNR = mseg.MBLNR
  • MSEGMARAforeign key · N:1
    ON mseg.MATNR = mara.MATNR
  • MSEGEKKOforeign key · N:1
    ON mseg.EBELN = ekko.EBELN
  • MSEGAUFKforeign key · N:1
    ON mseg.AUFNR = aufk.AUFNR
  • MSEGT156check table · N:1
    ON mseg.BWART = t156.BWART

Transaction Codes That Use This Table

More Materials Management tables