C_CN_MaterialStockSum

DDL: C_CN_MATERIALSTOCKSUM SQL: CCNMATSTKSUM Type: view CONSUMPTION

China Stock Summary for Material

C_CN_MaterialStockSum is a Consumption CDS View that provides data about "China Stock Summary for Material" in SAP S/4HANA. It reads from 1 data source (I_CN_MaterialStockDetail) and exposes 36 fields with key fields Plant, StockIdentifyingBatch, InventoryValuationType, GoodsMovementType, StockIdfgStorageLocation. It has 1 association to related views.

Data Sources (1)

SourceAliasJoin Type
I_CN_MaterialStockDetail I_CN_MaterialStockDetail from

Parameters (3)

NameTypeDefault
P_FromPostingDate budat
P_ToPostingDate budat
P_IsReversal char1

Associations (1)

CardinalityTargetAliasCondition
[1..*] I_CN_MaterialStockDetail _child $projection.StockIdentifyingMaterial = _child.StockIdentifyingMaterial and _detail.Plant = _child.Plant and _detail.StockIdfgStorageLocation = _child.StockIdfgStorageLocation and _detail.StockIdentifyingBatch = _child.StockIdentifyingBatch and _detail.InventoryValuationType = _child.InventoryValuationType and _detail.GoodsMovementType = _child.GoodsMovementType

Annotations (16)

NameValueLevelField
AbapCatalog.sqlViewName CCNMATSTKSUM view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
ClientHandling.algorithm #SESSION_VARIABLE view
AccessControl.authorizationCheck #CHECK view
EndUserText.label China Stock Summary for Material view
VDM.viewType #CONSUMPTION view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.sizeCategory #S view
ObjectModel.usageType.dataClass #MIXED view
UI.headerInfo.typeName Items view
UI.headerInfo.typeNamePlural Items view
UI.headerInfo.title.value StockIdentifyingMaterial view
UI.headerInfo.title.label Material view
UI.headerInfo.description.value MaterialDescription view
UI.headerInfo.description.label MaterialDescription view

Fields (36)

KeyFieldSource TableSource FieldDescription
P_FromPostingDate
P_ToPostingDate
KEY Plant Plant Valuation Area
KEY StockIdentifyingBatch StockIdentifyingBatch
KEY InventoryValuationType InventoryValuationType Valuation Type
KEY GoodsMovementType GoodsMovementType Movement Type
KEY StockIdfgStorageLocation StockIdfgStorageLocation
KEY MaterialBaseUnit _detail BaseUnit Unit of Measure
KEY CompanyCode CompanyCode Receiver Company Code
KEY InventorySpecialStockType InventorySpecialStockType Special Stock Type
KEY CompanyCodeCurrency CompanyCodeCurrency Local Currency
MaterialGroup MaterialGroup Product Group
MaterialGroupName MaterialGroupName Material Group Name
MaterialType MaterialType Material Type
MaterialTypeName MaterialTypeName Material Type Name
MaterialDescription MaterialDescription Material Description
StandardPriceInCoCodeCrcy StandardPriceInCoCodeCrcy Standard price
CompanyCodeName CompanyCodeName Company Name
StorageLocationName StorageLocationName StorageLocation name
PlantName PlantName Plant Name
AccountingDocumentIsExcluded AccountingDocumentIsExcluded Accounting Indicator Code
IsCrossPlantTransfer IsCrossPlantTransfer Is Cross Plant Transfer
IsStorageLocChangeByTransf IsStorageLocChangeByTransf Is Cross Storage Location Transfer
IsBatchChangeByTransf IsBatchChangeByTransf Is Cross Batch Transfer
MatlStkIncrQtyInMatlBaseUnit Total Goods Receipt Quantity
GoodsMovementStkAmtInCCCrcy Total Goods Receipt Value
MatlStkDecrQtyInMatlBaseUnit Total Goods Issue Quantity
MatlStkDecrQtyAmountInCCCrcy Total Goods Issue Value
PeriodStartStockQuantity Initial Stock Quantity
PeriodStartStockAmountInCoCrcy Initial Stock Value
MatlStkPerdStrtPriceInCCCrcy Initial Unit Price
CN_MatlsStkSpclStkNoValStrtQty Non valuation of special stock Initial Stock Qty
MatlStkPerdEndPriceInCCCrcy Closing Unit Price
MatlStkCreditRevalAmtInCCCrcy Credit
MatlStkDebitRevalAmtInCCCrcy Debit
_child _child

Derived SQL interpretation, reconstructed from the parsed view metadata (data sources, associations, and field mappings). SAP annotations are omitted and the structure is reformulated as SQL — this is a functional approximation, not the verbatim SAP source.

-- Derived SQL interpretation of CDS view C_CN_MaterialStockSum.
-- Reconstructed from parsed metadata (data sources, associations, fields).
-- SAP annotations are omitted and the structure is reformulated as SQL;
-- this is a functional approximation, not the verbatim SAP source. Some join
-- conditions may be unavailable and a few CDS constructs are kept as-is.
-- SQL view name: CCNMATSTKSUM
-- Parameters: P_FromPostingDate : budat, P_ToPostingDate : budat, P_IsReversal : char1

CREATE VIEW C_CN_MaterialStockSum AS
SELECT
  defaultValue: '20210331' AS P_FromPostingDate,
  P_ToPostingDate : $parameters.P_ToPostingDate AS P_ToPostingDate,
  Plant,
  StockIdentifyingBatch,
  InventoryValuationType,
  GoodsMovementType,
  StockIdfgStorageLocation,
  _detail.BaseUnit AS MaterialBaseUnit,
  CompanyCode,
  InventorySpecialStockType,
  CompanyCodeCurrency,
  MaterialGroup,
  MaterialGroupName,
  MaterialType,
  MaterialTypeName,
  MaterialDescription,
  StandardPriceInCoCodeCrcy,
  CompanyCodeName,
  StorageLocationName,
  PlantName,
  AccountingDocumentIsExcluded,
  IsCrossPlantTransfer,
  IsStorageLocChangeByTransf,
  IsBatchChangeByTransf,
  sum ( case when PostingDate >= :P_FromPostingDate and PostingDate <= :P_ToPostingDate then MatlStkIncrQtyInMatlBaseUnit else 0 end ) AS MatlStkIncrQtyInMatlBaseUnit,
  sum ( case when PostingDate >= :P_FromPostingDate and PostingDate <= :P_ToPostingDate then MatlStkIncrQtyAmountInCCCrcy else 0 end ) AS GoodsMovementStkAmtInCCCrcy,
  sum ( case when PostingDate >= :P_FromPostingDate and PostingDate <= :P_ToPostingDate then MatlStkDecrQtyInMatlBaseUnit else 0 end ) AS MatlStkDecrQtyInMatlBaseUnit,
  sum ( case when PostingDate >= :P_FromPostingDate and PostingDate <= :P_ToPostingDate then MatlStkDecrQtyAmountInCCCrcy else 0 end ) AS MatlStkDecrQtyAmountInCCCrcy,
  sum ( case when PostingDate < :P_FromPostingDate then MatlStkChangeQtyInBaseUnit else 0 end ) AS PeriodStartStockQuantity,
  sum ( case when PostingDate < :P_FromPostingDate then GoodsMovementStkAmtInCCCrcy else 0 end ) AS PeriodStartStockAmountInCoCrcy,
  cast( '99999999' as nsdm_dmbtr_stock ) AS MatlStkPerdStrtPriceInCCCrcy,
  sum ( case when ( PostingDate < :P_FromPostingDate) and ( CN_MatlsStkSpclStkIsNoValFlag = 'X') then MatlStkChangeQtyInBaseUnit else 0 end ) AS CN_MatlsStkSpclStkNoValStrtQty,
  cast( '99999999' as nsdm_dmbtr_stock ) AS MatlStkPerdEndPriceInCCCrcy,
  cast( '99999999' as j_3rm_credreval ) AS MatlStkCreditRevalAmtInCCCrcy,
  cast( '99999999' as j_3rm_debreval ) AS MatlStkDebitRevalAmtInCCCrcy
FROM I_CN_MaterialStockDetail
LEFT OUTER JOIN I_CN_MaterialStockDetail AS _child ON StockIdentifyingMaterial = _child.StockIdentifyingMaterial AND _detail.Plant = _child.Plant AND _detail.StockIdfgStorageLocation = _child.StockIdfgStorageLocation AND _detail.StockIdentifyingBatch = _child.StockIdentifyingBatch AND _detail.InventoryValuationType = _child.InventoryValuationType AND _detail.GoodsMovementType = _child.GoodsMovementType  -- association [1..*]
;