P_SlowMoMatPrMoStockDelta

DDL: P_SLOWMOMATPRMOSTOCKDELTA SQL: PSLOWMOMATSTDELT Type: view COMPOSITE

P_SlowMoMatPrMoStockDelta is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (I_Product, P_SlowMoMatPrMoStockFloat) and exposes 33 fields with key fields CalendarMonth, Material, Plant, MaterialBaseUnit.

Data Sources (2)

SourceAliasJoin Type
I_Product prod left_outer
P_SlowMoMatPrMoStockFloat rec from

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PSLOWMOMATSTDELT view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.private true view
VDM.viewType #COMPOSITE view
AccessControl.authorizationCheck #NOT_REQUIRED view

Fields (33)

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 StockQtyM1
StockQtyM2 StockQtyM2
StockQtyM3 StockQtyM3
StockQtyM4 StockQtyM4
StockQtyM5 StockQtyM5
StockQtyM6 StockQtyM6
StockQtyM7 StockQtyM7
target StockQtyM7
StockDeltaM2M1 StockDeltaM2M1
StockDeltaM3M2 StockDeltaM3M2
StockDeltaM4M3 StockDeltaM4M3
StockDeltaM5M4 StockDeltaM5M4
StockDeltaM6M5 StockDeltaM6M5
NumberOfBomM5 NumberOfBomM5
NumberOfBomM6 NumberOfBomM6
NumberOfBomM7 NumberOfBomM7
NumberOfBomM8 NumberOfBomM8
NumberOfBomM9 NumberOfBomM9
NumberOfBomM10 NumberOfBomM10
NumberOfBomDeltaM6M5 NumberOfBomDeltaM6M5
NumberOfBomDeltaM7M6 NumberOfBomDeltaM7M6
NumberOfBomDeltaM8M7 NumberOfBomDeltaM8M7
NumberOfBomDeltaM9M8 NumberOfBomDeltaM9M8
NumberOfBomDeltaM10M9 NumberOfBomDeltaM10M9
StockIntervalM1 0
StockIntervalM2
StockIntervalM3
@AbapCatalog.sqlViewName: 'PSLOWMOMATSTDELT'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass:#TRANSACTIONAL
@ClientHandling.algorithm: #SESSION_VARIABLE

@VDM.private: true
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck:#NOT_REQUIRED
//@EndUserText.label: 'Stock Delta'

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

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

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

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

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

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

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

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

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