P_SlowMoMatPredStockDelta

DDL: P_SLOWMOMATPREDSTOCKDELTA Type: view_entity COMPOSITE Package: ODATA_MM_IM_SLONOMOMAT

Stock Delta

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

Data Sources (2)

SourceAliasJoin Type
I_Product prod left_outer
P_SlowMoMatPredStockFloat 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 (52)

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 P_SlowMoMatPredStockFloat StockQtyM1
StockQtyM2 P_SlowMoMatPredStockFloat StockQtyM2
StockQtyM3 P_SlowMoMatPredStockFloat StockQtyM3
StockQtyM4 P_SlowMoMatPredStockFloat StockQtyM4
StockQtyM5 P_SlowMoMatPredStockFloat StockQtyM5
StockQtyM6 P_SlowMoMatPredStockFloat StockQtyM6
StockQtyM7 P_SlowMoMatPredStockFloat StockQtyM7
target P_SlowMoMatPredStockFloat StockQtyM7
StockDeltaM2M1 P_SlowMoMatPredStockFloat StockDeltaM2M1
StockDeltaM3M2 P_SlowMoMatPredStockFloat StockDeltaM3M2
StockDeltaM4M3 P_SlowMoMatPredStockFloat StockDeltaM4M3
StockDeltaM5M4 P_SlowMoMatPredStockFloat StockDeltaM5M4
StockDeltaM6M5 P_SlowMoMatPredStockFloat StockDeltaM6M5
StockQtyFloatM1endendasStockRatioM2M1
StockQtyFloatM2endendasStockRatioM3M2
StockQtyFloatM3endendasStockRatioM4M3
StockQtyFloatM4endendasStockRatioM5M4
StockQtyFloatM5endendasStockRatioM6M5
NumberOfBomM5 P_SlowMoMatPredStockFloat NumberOfBomM5
NumberOfBomM6 P_SlowMoMatPredStockFloat NumberOfBomM6
NumberOfBomM7 P_SlowMoMatPredStockFloat NumberOfBomM7
NumberOfBomM8 P_SlowMoMatPredStockFloat NumberOfBomM8
NumberOfBomM9 P_SlowMoMatPredStockFloat NumberOfBomM9
NumberOfBomM10 P_SlowMoMatPredStockFloat NumberOfBomM10
NumberOfBomDeltaM6M5
NumberOfBomDeltaM7M6
NumberOfBomDeltaM8M7
NumberOfBomDeltaM9M8
NumberOfBomDeltaM10M9
NumberOfBomFloatM5endendasBomRatioM6M5
NumberOfBomFloatM6endendasBomRatioM7M6
NumberOfBomFloatM7endendasBomRatioM8M7
NumberOfBomFloatM8endendasBomRatioM9M8
NumberOfBomFloatM9endendasBomRatioM10M9
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_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 

  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.StockDeltaFloatM2M1 = 0 then 0 else case when rec.StockQtyFloatM1 = 0 
       then 0 else rec.StockDeltaFloatM2M1 / rec.StockQtyFloatM1 end end as StockRatioM2M1,
  case when rec.StockDeltaFloatM3M2 = 0 then 0 else case when rec.StockQtyFloatM2 = 0 
       then 0 else rec.StockDeltaFloatM3M2 / rec.StockQtyFloatM2 end end as StockRatioM3M2,
  case when rec.StockDeltaFloatM4M3 = 0 then 0 else case when rec.StockQtyFloatM3 = 0 
       then 0 else rec.StockDeltaFloatM4M3 / rec.StockQtyFloatM3 end end as StockRatioM4M3,
  case when rec.StockDeltaFloatM5M4 = 0 then 0 else case when rec.StockQtyFloatM4 = 0 
       then 0 else rec.StockDeltaFloatM5M4 / rec.StockQtyFloatM4 end end as StockRatioM5M4,
  case when rec.StockDeltaFloatM6M5 = 0 then 0 else case when rec.StockQtyFloatM5 = 0 
       then 0 else rec.StockDeltaFloatM6M5 / rec.StockQtyFloatM5 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

  cast(rec.NumberOfBomM6  - rec.NumberOfBomM5 as nsdm_number_of_bom_used_in preserving type) as NumberOfBomDeltaM6M5,   
  cast(rec.NumberOfBomM7  - rec.NumberOfBomM6 as nsdm_number_of_bom_used_in preserving type) as NumberOfBomDeltaM7M6,  
  cast(rec.NumberOfBomM8  - rec.NumberOfBomM7 as nsdm_number_of_bom_used_in preserving type) as NumberOfBomDeltaM8M7,  
  cast(rec.NumberOfBomM9  - rec.NumberOfBomM8 as nsdm_number_of_bom_used_in preserving type) as NumberOfBomDeltaM9M8,  
  cast(rec.NumberOfBomM10 - rec.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 rec.NumberOfBomDeltaFloatM6M5 = 0 then 0 else case when rec.NumberOfBomFloatM5 = 0 
       then 0 else rec.NumberOfBomDeltaFloatM6M5 / rec.NumberOfBomFloatM5 end end as BomRatioM6M5,  
  case when rec.NumberOfBomDeltaFloatM7M6 = 0 then 0 else case when rec.NumberOfBomFloatM6 = 0 
       then 0 else rec.NumberOfBomDeltaFloatM7M6 / rec.NumberOfBomFloatM6 end end as BomRatioM7M6,  
  case when rec.NumberOfBomDeltaFloatM8M7 = 0 then 0 else case when rec.NumberOfBomFloatM7 = 0 
       then 0 else rec.NumberOfBomDeltaFloatM8M7 / rec.NumberOfBomFloatM7 end end as BomRatioM8M7,  
  case when rec.NumberOfBomDeltaFloatM9M8 = 0 then 0 else case when rec.NumberOfBomFloatM8 = 0 
       then 0 else rec.NumberOfBomDeltaFloatM9M8 / rec.NumberOfBomFloatM8 end end as BomRatioM9M8,  
  case when rec.NumberOfBomDeltaFloatM10M9 = 0 then 0 else case when rec.NumberOfBomFloatM9 = 0 
       then 0 else rec.NumberOfBomDeltaFloatM10M9 / rec.NumberOfBomFloatM9 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                            
}