P_MaterialKPIStocksForPhysInv

DDL: P_MATERIALKPISTOCKSFORPHYSINV Type: view_entity COMPOSITE Package: ODATA_MM_IM_PI_CYC_MAINT

All Stocks with are used in Phys Inv

P_MaterialKPIStocksForPhysInv is a Composite CDS View that provides data about "All Stocks with are used in Phys Inv" 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. Part of development package ODATA_MM_IM_PI_CYC_MAINT.

Data Sources (1)

SourceAliasJoin Type
I_MaterialStock_2 I_MaterialStock_2 from

Parameters (2)

NameTypeDefault
P_StartDate nsdm_reference_startdate
P_EndDate nsdm_reference_enddate

Annotations (6)

NameValueLevelField
AccessControl.authorizationCheck #NOT_REQUIRED 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)

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
dec253asMatlStkQtySumInPeriod
_CurrentInvtryPrice _CurrentInvtryPrice
_CompanyCode _CompanyCode
@AccessControl.authorizationCheck: #NOT_REQUIRED

@VDM.private: true
@VDM.viewType: #COMPOSITE
@ObjectModel: {
                 usageType:{
                              sizeCategory: #L,
                              serviceQuality: #D,
                              dataClass:#TRANSACTIONAL
                           }
              }

define view entity 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,
  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