P_MatStkQtyValByKeyDateBaseHdr

DDL: P_MATSTKQTYVALBYKEYDATEBASEHDR Type: view_entity COMPOSITE Package: ODATA_MM_IM_SLONOMOMAT

SlowNonMovingMat: quant and val base

P_MatStkQtyValByKeyDateBaseHdr is a Composite CDS View that provides data about "SlowNonMovingMat: quant and val base" in SAP S/4HANA. It reads from 1 data source (I_MaterialStock_2) and exposes 18 fields with key fields Material, Plant, StorageLocation, Batch, Supplier. Part of development package ODATA_MM_IM_SLONOMOMAT.

Data Sources (1)

SourceAliasJoin Type
I_MaterialStock_2 I_MaterialStock_2 from

Parameters (1)

NameTypeDefault
P_KeyDate calendardate

Annotations (6)

NameValueLevelField
AccessControl.authorizationCheck #NOT_REQUIRED view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
VDM.viewType #COMPOSITE view
VDM.private true view

Fields (18)

KeyFieldSource TableSource FieldDescription
KEY Material Material
KEY Plant Plant
KEY StorageLocation StorageLocation
KEY Batch Batch
KEY Supplier Supplier
KEY SDDocument SDDocument
KEY SDDocumentItem SDDocumentItem
KEY WBSElementInternalID WBSElementInternalID
KEY Customer Customer
KEY SpecialStockIdfgStockOwner SpecialStockIdfgStockOwner
KEY InventoryStockType InventoryStockType
KEY InventorySpecialStockType InventorySpecialStockType
KEY MaterialBaseUnit MaterialBaseUnit
CostEstimate CostEstimate
CompanyCode CompanyCode
MatlWrhsStkQtyInMatlBaseUnit
_CurrentInvtryPrice _CurrentInvtryPrice
_CompanyCode _CompanyCode
@AccessControl.authorizationCheck: #NOT_REQUIRED

@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass:#TRANSACTIONAL
@VDM.viewType: #COMPOSITE
@VDM.private: true

/*
Calculate the stock for a given date (summing up to that date) on storage location level
and provide the link to the material prices
Important: because for a set of stock identifiying fields a dedicated CostEstimate does exist (or not if the movement is non-valuated)
and because there might be a mapping of various stock identifiying fields to the same CostEstimate 
(e.g. all stock types with special stock type = blank do map to the same CostEstimate for a material/plant combination)
it is sufficient to work with CostEstimate as key below for cases where quantities and values on storage location level
(and not beyond e.g. splitted up to special stock identifier or below like on dedicated customers (consignments) are required
*/

define view entity P_MatStkQtyValByKeyDateBaseHdr
  with parameters
    P_KeyDate : calendardate
  as select from I_MaterialStock_2
{
  key Material,
  key Plant,
  key StorageLocation,
  key Batch,
  key Supplier,
  key SDDocument,
  key SDDocumentItem,
  key WBSElementInternalID,
  key Customer,
  key SpecialStockIdfgStockOwner,    
  key InventoryStockType,
  key InventorySpecialStockType,
  key MaterialBaseUnit,
      CostEstimate,
      CompanyCode,
      @Semantics.quantity.unitOfMeasure: 'MaterialBaseUnit'
      @DefaultAggregation : #SUM
      sum(MatlWrhsStkQtyInMatlBaseUnit) as MatlWrhsStkQtyInMatlBaseUnit,
      _CurrentInvtryPrice,
      _CompanyCode
}
where
  MatlDocLatestPostgDate <= $parameters.P_KeyDate
group by
  Material,
  Plant,
  StorageLocation,
  Batch,
  Supplier,
  SDDocument,
  SDDocumentItem,
  WBSElementInternalID,
  Customer,
  SpecialStockIdfgStockOwner,    
  InventoryStockType,
  InventorySpecialStockType,
  MaterialBaseUnit,
  CostEstimate,
  CompanyCode