C_MaterialStockByKeyDate

DDL: C_MATERIALSTOCKBYKEYDATE Type: view CONSUMPTION

Material Stock at posting date

C_MaterialStockByKeyDate is a Consumption CDS View that provides data about "Material Stock at posting date" in SAP S/4HANA. It reads from 1 data source (I_MaterialStock_2) and exposes 21 fields.

Data Sources (1)

SourceAliasJoin Type
I_MaterialStock_2 I_MaterialStock_2 from

Parameters (2)

NameTypeDefault
P_Language sylangu
P_KeyDate vdm_v_key_date

Annotations (13)

NameValueLevelField
AbapCatalog.sqlViewName CMATSTOCKBYKDATE view
AbapCatalog.preserveKey true view
AbapCatalog.compiler.compareFilter true view
EndUserText.label Material Stock at posting date view
AccessControl.authorizationCheck #PRIVILEGED_ONLY view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
ObjectModel.modelingPattern #ANALYTICAL_QUERY view
VDM.viewType #CONSUMPTION view
Analytics.query true view
Metadata.allowExtensions true view

Fields (21)

KeyFieldSource TableSource FieldDescription
Material Material
Plant Plant
StorageLocation StorageLocation
Batch Batch
Supplier Supplier
SDDocument SDDocument
SDDocumentItem SDDocumentItem
WBSElementInternalID
InventoryStockType InventoryStockType
InventorySpecialStockType InventorySpecialStockType
CompanyCode CompanyCode
MaterialBaseUnit MaterialBaseUnit
MatlWrhsStkQtyInMatlBaseUnit MatlWrhsStkQtyInMatlBaseUnit
MaterialName
CompanyCodeName _CompanyCode CompanyCodeName
PlantName _Plant PlantName
StorageLocationName _StorageLocation StorageLocationName
SupplierName _Supplier SupplierName
CustomerName _Customer CustomerName
InventoryStockTypeName
InventorySpecialStockTypeName
@AbapCatalog: {
                sqlViewName: 'CMATSTOCKBYKDATE',
                preserveKey: true,
                compiler.compareFilter: true
              }
@EndUserText.label: 'Material Stock at posting date'
@AccessControl.authorizationCheck:#PRIVILEGED_ONLY
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel: {
                usageType: {
                             sizeCategory: #XXL,
                             serviceQuality: #D,
                             dataClass:#TRANSACTIONAL
                           },
                modelingPattern: #ANALYTICAL_QUERY,
                supportedCapabilities: [#ANALYTICAL_QUERY]
              }
@VDM.viewType: #CONSUMPTION
@Analytics.query : true
@Metadata.allowExtensions: true
define view C_MaterialStockByKeyDate
  with parameters
    @Consumption.hidden: true
    @Environment.systemField: #SYSTEM_LANGUAGE
    P_Language : sylangu,
    @Environment.systemField: #SYSTEM_DATE
    P_KeyDate  : vdm_v_key_date
  as select from I_MaterialStock_2
{
  // Stock Identifier

  @ObjectModel.text.element: ['MaterialName']
  Material,
  @ObjectModel.text.element: ['PlantName']
  @AnalyticsDetails.query.axis: #ROWS
  Plant,
  @ObjectModel.text.element: ['StorageLocationName']
  StorageLocation,
  Batch,
  @ObjectModel.text.element: ['SupplierName']
  Supplier,
  SDDocument,
  SDDocumentItem,
  cast( WBSElementInternalID as mat_pspnr preserving type ) as WBSElementInternalID,   --I_MaterailStock_2 does a cast to a DE w/o conversion exit, for compatibility reason: cast back
  @ObjectModel.text.element: ['CustomerName']
  Customer,
  @ObjectModel.text.element: ['InventoryStockTypeName']
  InventoryStockType,
  @ObjectModel.text.element: ['InventorySpecialStockTypeName']
  InventorySpecialStockType,

  // Further Stock Groups

  CompanyCode,

  // Quantity and Unit

  @Semantics.unitOfMeasure: true
  MaterialBaseUnit,
  @AnalyticsDetails.query.axis: #COLUMNS
  MatlWrhsStkQtyInMatlBaseUnit,

  // Names and descriptions

  _Material._Text[1: Language=$parameters.P_Language].ProductName as MaterialName,
  _CompanyCode.CompanyCodeName,
  _Plant.PlantName,
  _StorageLocation.StorageLocationName,
  _Supplier.SupplierName,
  _Customer.CustomerName,
  _InventoryStockType._Text[1: Language=$parameters.P_Language].InventoryStockTypeName,
  _InventorySpecialStockType._Text[1: Language=$parameters.P_Language].InventorySpecialStockTypeName
}
where
  MatlDocLatestPostgDate <= $parameters.P_KeyDate                             
  
  
  
  
  
  
 /*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_COMPANYCODE",
"I_CUSTOMER",
"I_INVENTORYSPECIALSTOCKTYPE",
"I_INVENTORYSPECIALSTOCKTYPET",
"I_INVENTORYSTOCKTYPE",
"I_INVENTORYSTOCKTYPET",
"I_MATERIALSTOCK_2",
"I_PLANT",
"I_PRODUCT",
"I_PRODUCTTEXT",
"I_STORAGELOCATION",
"I_SUPPLIER"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/