P_SlowMoMatPrMoStockDelta

DDL: P_SLOWMOMATPRMOSTOCKDELTA Type: view_entity COMPOSITE Package: ODATA_MM_IM_SLONOMOMAT

Stock Delta

P_SlowMoMatPrMoStockDelta is a Composite CDS View that provides data about "Stock Delta" in SAP S/4HANA. It reads from 2 data sources (I_Product, P_SlowMoMatPrMoStockFloat) and exposes 43 fields with key fields CalendarMonth, Material, Plant, MaterialBaseUnit. Part of development package ODATA_MM_IM_SLONOMOMAT.

Data Sources (2)

SourceAliasJoin Type
I_Product prod left_outer
P_SlowMoMatPrMoStockFloat rec from

Annotations (6)

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

Fields (43)

KeyFieldSource TableSource FieldDescription
KEY CalendarMonth P_SlowMoMatPrMoStockFloat CalendarMonth
KEY Material P_SlowMoMatPrMoStockFloat Material
KEY Plant P_SlowMoMatPrMoStockFloat Plant
KEY MaterialBaseUnit P_SlowMoMatPrMoStockFloat MaterialBaseUnit
ProductGroup I_Product ProductGroup
ProductType I_Product ProductType
StockQtyM1 P_SlowMoMatPrMoStockFloat StockQtyM1
StockQtyM2 P_SlowMoMatPrMoStockFloat StockQtyM2
StockQtyM3 P_SlowMoMatPrMoStockFloat StockQtyM3
StockQtyM4 P_SlowMoMatPrMoStockFloat StockQtyM4
StockQtyM5 P_SlowMoMatPrMoStockFloat StockQtyM5
StockQtyM6 P_SlowMoMatPrMoStockFloat StockQtyM6
StockQtyM7 P_SlowMoMatPrMoStockFloat StockQtyM7
target P_SlowMoMatPrMoStockFloat StockQtyM7
StockDeltaM2M1 P_SlowMoMatPrMoStockFloat StockDeltaM2M1
StockDeltaM3M2 P_SlowMoMatPrMoStockFloat StockDeltaM3M2
StockDeltaM4M3 P_SlowMoMatPrMoStockFloat StockDeltaM4M3
StockDeltaM5M4 P_SlowMoMatPrMoStockFloat StockDeltaM5M4
StockDeltaM6M5 P_SlowMoMatPrMoStockFloat StockDeltaM6M5
StockQtyM1endendasStockRatioM2M1
StockQtyM2endendasStockRatioM3M2
StockQtyM3endendasStockRatioM4M3
StockQtyM4endendasStockRatioM5M4
StockQtyM5endendasStockRatioM6M5
NumberOfBomM5 P_SlowMoMatPrMoStockFloat NumberOfBomM5
NumberOfBomM6 P_SlowMoMatPrMoStockFloat NumberOfBomM6
NumberOfBomM7 P_SlowMoMatPrMoStockFloat NumberOfBomM7
NumberOfBomM8 P_SlowMoMatPrMoStockFloat NumberOfBomM8
NumberOfBomM9 P_SlowMoMatPrMoStockFloat NumberOfBomM9
NumberOfBomM10 P_SlowMoMatPrMoStockFloat NumberOfBomM10
NumberOfBomDeltaM6M5 P_SlowMoMatPrMoStockFloat NumberOfBomDeltaM6M5
NumberOfBomDeltaM7M6 P_SlowMoMatPrMoStockFloat NumberOfBomDeltaM7M6
NumberOfBomDeltaM8M7 P_SlowMoMatPrMoStockFloat NumberOfBomDeltaM8M7
NumberOfBomDeltaM9M8 P_SlowMoMatPrMoStockFloat NumberOfBomDeltaM9M8
NumberOfBomDeltaM10M9 P_SlowMoMatPrMoStockFloat NumberOfBomDeltaM10M9
NumberOfBomM5endendasBomRatioM6M5
NumberOfBomM6endendasBomRatioM7M6
NumberOfBomM7endendasBomRatioM8M7
NumberOfBomM8endendasBomRatioM9M8
NumberOfBomM9endendasBomRatioM10M9
StockIntervalM1 0
StockIntervalM2
StockIntervalM3
@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass:#TRANSACTIONAL
@VDM.private: true
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck:#NOT_REQUIRED
//@EndUserText.label: 'Stock Delta'

define view entity P_SlowMoMatPrMoStockDelta as select from P_SlowMoMatPrMoStockFloat as rec
                                     left outer join I_Product                 as prod
                                                   on prod.Product = rec.Material    
   
                                            
{

  key rec.CalendarMonth,

  key rec.Material as Material,
  key rec.Plant as Plant,
  key rec.MaterialBaseUnit,    
  
  prod.ProductGroup as ProductGroup,
  prod.ProductType  as ProductType,
  
  
  //Stock per Month 

  rec.StockQtyM1,
  rec.StockQtyM2,
  rec.StockQtyM3,
  rec.StockQtyM4,  
  rec.StockQtyM5,
  rec.StockQtyM6,
  rec.StockQtyM7,
  rec.StockQtyM7 as target, 
  
  //Stock Delta from Month to previous Month

  rec.StockDeltaM2M1,
  rec.StockDeltaM3M2,
  rec.StockDeltaM4M3,
  rec.StockDeltaM5M4,
  rec.StockDeltaM6M5,
  
  //Ratio Stock Delta Month to previous Month devided by Stock of Pervious Month

  case when rec.StockDeltaM2M1 = 0 then 0 else case when rec.StockQtyM1 = 0 
       then 0 else rec.StockDeltaM2M1 / rec.StockQtyM1 end end as StockRatioM2M1,
  case when rec.StockDeltaM3M2 = 0 then 0 else case when rec.StockQtyM2 = 0 
       then 0 else rec.StockDeltaM3M2 / rec.StockQtyM2 end end as StockRatioM3M2,
  case when rec.StockDeltaM4M3 = 0 then 0 else case when rec.StockQtyM3 = 0 
       then 0 else rec.StockDeltaM4M3 / rec.StockQtyM3 end end as StockRatioM4M3,
  case when rec.StockDeltaM5M4 = 0 then 0 else case when rec.StockQtyM4 = 0 
       then 0 else rec.StockDeltaM5M4 / rec.StockQtyM4 end end as StockRatioM5M4,
  case when rec.StockDeltaM6M5 = 0 then 0 else case when rec.StockQtyM5 = 0 
       then 0 else rec.StockDeltaM6M5 / rec.StockQtyM5 end end as StockRatioM6M5,
    
  
  //Number of BOMs used in per Month 

  rec.NumberOfBomM5,
  rec.NumberOfBomM6,
  rec.NumberOfBomM7,
  rec.NumberOfBomM8,
  rec.NumberOfBomM9,
  rec.NumberOfBomM10,  
  
  //Number of BOMs Delta from Month to previous Month

  rec.NumberOfBomDeltaM6M5,   
  rec.NumberOfBomDeltaM7M6,  
  rec.NumberOfBomDeltaM8M7,  
  rec.NumberOfBomDeltaM9M8,  
  rec.NumberOfBomDeltaM10M9,
  
  //Ratio Number of BOMs Delta Month to previous Month devided by Number of BOMs of Pervious Month 

  case when rec.NumberOfBomDeltaM6M5 = 0 then 0 else case when rec.NumberOfBomM5 = 0 
       then 0 else rec.NumberOfBomDeltaM6M5 / rec.NumberOfBomM5 end end as BomRatioM6M5,  
  case when rec.NumberOfBomDeltaM7M6 = 0 then 0 else case when rec.NumberOfBomM6 = 0 
       then 0 else rec.NumberOfBomDeltaM7M6 / rec.NumberOfBomM6 end end as BomRatioM7M6,  
  case when rec.NumberOfBomDeltaM8M7 = 0 then 0 else case when rec.NumberOfBomM7 = 0 
       then 0 else rec.NumberOfBomDeltaM8M7 / rec.NumberOfBomM7 end end as BomRatioM8M7,  
  case when rec.NumberOfBomDeltaM9M8 = 0 then 0 else case when rec.NumberOfBomM8 = 0 
       then 0 else rec.NumberOfBomDeltaM9M8 / rec.NumberOfBomM8 end end as BomRatioM9M8,  
  case when rec.NumberOfBomDeltaM10M9 = 0 then 0 else case when rec.NumberOfBomM9 = 0 
       then 0 else rec.NumberOfBomDeltaM10M9 / rec.NumberOfBomM9 end end as BomRatioM10M9,              

  // Stock Intervall as number of consecutive previous Month without Stock Change

  0 as StockIntervalM1,
  case when rec.StockDeltaM2M1 <> 0 then 0 else 1 end as StockIntervalM2,
  case when rec.StockDeltaM3M2 <> 0 then 0 else case when rec.StockDeltaM2M1 <> 0 then 1 else 2 end end as StockIntervalM3,
  case when rec.StockDeltaM4M3 <> 0 then 0 else case when rec.StockDeltaM3M2 <> 0 then 1
                                       else case when rec.StockDeltaM2M1 <> 0 then 2 else 3 end end end as StockIntervalM4,     
  case when rec.StockDeltaM5M4 <> 0 then 0 else case when rec.StockDeltaM4M3 <> 0 then 1  
                                       else case when rec.StockDeltaM3M2 <> 0 then 2
                                       else case when rec.StockDeltaM2M1 <> 0 then 3 else 4 end end end end as StockIntervalM5, 
  case when rec.StockDeltaM6M5 <> 0 then 0 else case when rec.StockDeltaM5M4 <> 0 then 1  
                                       else case when rec.StockDeltaM4M3 <> 0 then 2
                                       else case when rec.StockDeltaM3M2 <> 0 then 3
                                       else case when rec.StockDeltaM2M1 <> 0 then 4 else 5 end end end end end as StockIntervalM6                            
}