P_MaterialKPIStocksForPhysInv
P_MaterialKPIStocksForPhysInv is a Composite CDS View in SAP S/4HANA. It reads from 1 data source (I_MaterialStock_2) and exposes 19 fields with key fields Material, Plant, StorageLocation, Batch, Supplier.
Data Sources (1)
| Source | Alias | Join Type |
|---|---|---|
| I_MaterialStock_2 | I_MaterialStock_2 | from |
Parameters (2)
| Name | Type | Default |
|---|---|---|
| P_StartDate | nsdm_reference_startdate | |
| P_EndDate | nsdm_reference_enddate |
Annotations (10)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | PMATKPISTKPIN | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AbapCatalog.preserveKey | true | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view | |
| VDM.private | true | view | |
| VDM.viewType | #COMPOSITE | view | |
| ObjectModel.usageType.sizeCategory | #L | view | |
| ObjectModel.usageType.serviceQuality | #D | view | |
| ObjectModel.usageType.dataClass | #TRANSACTIONAL | view |
Fields (19)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| 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 | ||||
| dec253asMatlStkQtySumInPeriod | ||||
| _CurrentInvtryPrice | _CurrentInvtryPrice | |||
| _CompanyCode | _CompanyCode |
@AbapCatalog.sqlViewName: 'PMATKPISTKPIN'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.private: true
@VDM.viewType: #COMPOSITE
@ObjectModel: {
usageType:{
sizeCategory: #L,
serviceQuality: #D,
dataClass:#TRANSACTIONAL
}
}
define view P_MaterialKPIStocksForPhysInv
with parameters
P_StartDate : nsdm_reference_startdate,
P_EndDate : nsdm_reference_enddate
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,
@Semantics.unitOfMeasure: true
key MaterialBaseUnit,
CostEstimate,
CompanyCode,
@Semantics.quantity.unitOfMeasure: 'MaterialBaseUnit'
sum(MatlWrhsStkQtyInMatlBaseUnit) as MatlWrhsStkQtyInMatlBaseUnit,
@Semantics.quantity.unitOfMeasure: 'MaterialBaseUnit'
cast(sum(
case when MatlDocLatestPostgDate < $parameters.P_StartDate
then
cast( MatlWrhsStkQtyInMatlBaseUnit as abap.dec(25,3)) * (dats_days_between($parameters.P_StartDate, $parameters.P_EndDate)+1)
else
cast( MatlWrhsStkQtyInMatlBaseUnit as abap.dec(25,3)) * (dats_days_between(MatlDocLatestPostgDate, $parameters.P_EndDate)+1)
end
) as abap.dec(25,3)) as MatlStkQtySumInPeriod,
_CurrentInvtryPrice,
_CompanyCode
}
where
MatlDocLatestPostgDate <= $parameters.P_EndDate and
( InventoryStockType = '01' or
InventoryStockType = '02' or
InventoryStockType = '07' or
InventoryStockType = '08' )
group by
Material,
Plant,
StorageLocation,
Batch,
Supplier,
SDDocument,
SDDocumentItem,
WBSElementInternalID,
Customer,
SpecialStockIdfgStockOwner,
InventoryStockType,
InventorySpecialStockType,
MaterialBaseUnit,
CostEstimate,
CompanyCode
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_MATERIALSTOCK_2"
],
"ASSOCIATED":
[
"I_COMPANYCODE",
"I_CURRENTMATLPRICEBYCOSTEST"
],
"BASE":
[
"I_MATERIALSTOCK_2"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/
Learn More
- What Is a CDS View in SAP S/4HANA?
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- CDS View Annotations — A Complete Guide
- CDS View Field Mapping and Associations
- Understanding the SAP S/4HANA Data Model
- CDS View Extensions and Custom Fields in SAP S/4HANA
- Released APIs and Stability Contracts in SAP S/4HANA