P_SlowMoMatPredStockDelta

DDL: P_SLOWMOMATPREDSTOCKDELTA SQL: PSLOWMOMATSDELTA Type: view COMPOSITE

P_SlowMoMatPredStockDelta is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (I_Product, P_SlowMoMatPredStockFloat) and exposes 42 fields with key fields CalendarMonth, Material, Plant, StockIdentifyingBatch, SpecialStockIdfgSupplier.

Data Sources (2)

SourceAliasJoin Type
I_Product prod left_outer
P_SlowMoMatPredStockFloat rec from

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PSLOWMOMATSDELTA 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 (42)

KeyFieldSource TableSource FieldDescription
KEY CalendarMonth P_SlowMoMatPredStockFloat CalendarMonth
KEY Material P_SlowMoMatPredStockFloat Material
KEY Plant P_SlowMoMatPredStockFloat Plant
KEY StockIdentifyingBatch P_SlowMoMatPredStockFloat StockIdentifyingBatch
KEY SpecialStockIdfgSupplier P_SlowMoMatPredStockFloat SpecialStockIdfgSupplier
KEY SpecialStockIdfgSalesOrder P_SlowMoMatPredStockFloat SpecialStockIdfgSalesOrder
KEY SpecialStockIdfgSalesOrderItem P_SlowMoMatPredStockFloat SpecialStockIdfgSalesOrderItem
KEY SpecialStockIdfgWBSElement P_SlowMoMatPredStockFloat SpecialStockIdfgWBSElement
KEY SpecialStockIdfgCustomer P_SlowMoMatPredStockFloat SpecialStockIdfgCustomer
KEY SpecialStockIdfgStockOwner P_SlowMoMatPredStockFloat SpecialStockIdfgStockOwner
KEY InventorySpecialStockType P_SlowMoMatPredStockFloat InventorySpecialStockType
KEY InventoryStockType P_SlowMoMatPredStockFloat InventoryStockType
KEY MaterialBaseUnit P_SlowMoMatPredStockFloat 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
NumberOfBomDeltaM7M6
NumberOfBomDeltaM8M7
NumberOfBomDeltaM9M8
NumberOfBomDeltaM10M9
StockIntervalM1 0
StockIntervalM2
StockIntervalM3
@AbapCatalog.sqlViewName: 'PSLOWMOMATSDELTA'
@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_SlowMoMatPredStockDelta as select from P_SlowMoMatPredStockFloat 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.StockIdentifyingBatch,
  key rec.SpecialStockIdfgSupplier,
  key rec.SpecialStockIdfgSalesOrder,
  key rec.SpecialStockIdfgSalesOrderItem,
  key rec.SpecialStockIdfgWBSElement,
  key rec.SpecialStockIdfgCustomer,
  key rec.SpecialStockIdfgStockOwner,
  key rec.InventorySpecialStockType,
  key rec.InventoryStockType,
  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 StockDeltaFloatM2M1 = 0 then 0 else case when StockQtyFloatM1 = 0 
       then 0 else StockDeltaFloatM2M1 / StockQtyFloatM1 end end as StockRatioM2M1,
  case when StockDeltaFloatM3M2 = 0 then 0 else case when StockQtyFloatM2 = 0 
       then 0 else StockDeltaFloatM3M2 / StockQtyFloatM2 end end as StockRatioM3M2,
  case when StockDeltaFloatM4M3 = 0 then 0 else case when StockQtyFloatM3 = 0 
       then 0 else StockDeltaFloatM4M3 / StockQtyFloatM3 end end as StockRatioM4M3,
  case when StockDeltaFloatM5M4 = 0 then 0 else case when StockQtyFloatM4 = 0 
       then 0 else StockDeltaFloatM5M4 / StockQtyFloatM4 end end as StockRatioM5M4,
  case when StockDeltaFloatM6M5 = 0 then 0 else case when StockQtyFloatM5 = 0 
       then 0 else StockDeltaFloatM6M5 / StockQtyFloatM5 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

  cast(NumberOfBomM6  - NumberOfBomM5 as nsdm_number_of_bom_used_in preserving type) as NumberOfBomDeltaM6M5,   
  cast(NumberOfBomM7  - NumberOfBomM6 as nsdm_number_of_bom_used_in preserving type) as NumberOfBomDeltaM7M6,  
  cast(NumberOfBomM8  - NumberOfBomM7 as nsdm_number_of_bom_used_in preserving type) as NumberOfBomDeltaM8M7,  
  cast(NumberOfBomM9  - NumberOfBomM8 as nsdm_number_of_bom_used_in preserving type) as NumberOfBomDeltaM9M8,  
  cast(NumberOfBomM10 - NumberOfBomM9 as nsdm_number_of_bom_used_in preserving type) as NumberOfBomDeltaM10M9,
  
  //Ratio Number of BOMs Delta Month to previous Month devided by Number of BOMs of Pervious Month 

  case when NumberOfBomDeltaFloatM6M5 = 0 then 0 else case when NumberOfBomFloatM5 = 0 
       then 0 else NumberOfBomDeltaFloatM6M5 / NumberOfBomFloatM5 end end as BomRatioM6M5,  
  case when NumberOfBomDeltaFloatM7M6 = 0 then 0 else case when NumberOfBomFloatM6 = 0 
       then 0 else NumberOfBomDeltaFloatM7M6 / NumberOfBomFloatM6 end end as BomRatioM7M6,  
  case when NumberOfBomDeltaFloatM8M7 = 0 then 0 else case when NumberOfBomFloatM7 = 0 
       then 0 else NumberOfBomDeltaFloatM8M7 / NumberOfBomFloatM7 end end as BomRatioM8M7,  
  case when NumberOfBomDeltaFloatM9M8 = 0 then 0 else case when NumberOfBomFloatM8 = 0 
       then 0 else NumberOfBomDeltaFloatM9M8 / NumberOfBomFloatM8 end end as BomRatioM9M8,  
  case when NumberOfBomDeltaFloatM10M9 = 0 then 0 else case when NumberOfBomFloatM9 = 0 
       then 0 else NumberOfBomDeltaFloatM10M9 / NumberOfBomFloatM9 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                            
}