P_DEMANDDRIVENCALCVALUES

CDS View

Calculated Values for DD MRP

P_DEMANDDRIVENCALCVALUES is a CDS View in S/4HANA. Calculated Values for DD MRP. It contains 52 fields. 3 CDS views read from this table.

CDS Views using this table (3)

ViewTypeJoinVDMDescription
C_BufBelowReorderPtIndCht view from CONSUMPTION Replenishment Planning Card
C_BufBelowSftyStkIndCht view from CONSUMPTION Replenishment Execution Card
C_DemandDrivenReplnmt view from CONSUMPTION Demand Driven Replenishment

Fields (52)

KeyField CDS FieldsUsed in Views
KEY Material Material 1
KEY MRPArea MRPArea 2
KEY Plant Plant 3
BaseUnitofMeasure BaseUnitofMeasure,ItemUoM 1
BOMUsageCode BOMUsageCode 1
BOMUsageValue BOMUsageValue 1
ConsumptionCode ConsumptionCode 1
Currency Currency 1
DecoupledLeadTime DecoupledLeadTime 1
ExpeditedDateTime ExpeditedDateTime 1
ExpeditedOnHandStockStatus ExpeditedOnHandStockStatus 1
ExpeditedQuantity ExpeditedQuantity 1
ExpeditedStatus ExpeditedStatus 1
FirstBelowSFTFromTodayInDays FirstBelowSFTFromTodayInDays 1
FirstBelowSFTProjtdSFTPct FirstBelowSFTProjtdSFTPct 1
FirstBelowSFTProjtdSFTQty FirstBelowSFTProjtdSFTQty 1
FirstBelowSFTProjtdStkQty FirstBelowSFTProjtdStkQty 1
FirstBelowSFTThldLvlQty FirstBelowSFTThldLvlQty 1
FirstBelowThldFromTodayInDays FirstBelowThldFromTodayInDays 1
FirstBelowThldProjtdSFTPct FirstBelowThldProjtdSFTPct 1
FirstBelowThldProjtdSFTQty FirstBelowThldProjtdSFTQty 1
FirstBelowThldProjtdStkQty FirstBelowThldProjtdStkQty 1
FirstBelowThldThldLvlQty FirstBelowThldThldLvlQty 1
FirstStkOutFromTodayInDays FirstStkOutFromTodayInDays 1
FirstStkOutProjtdSFTPct FirstStkOutProjtdSFTPct 1
FirstStkOutProjtdSFTQty FirstStkOutProjtdSFTQty 1
FirstStkOutProjtdStkQty FirstStkOutProjtdStkQty 1
IndividualLeadTime IndividualLeadTime 1
MaterialBaseUnit MaterialBaseUnit 1
MaterialGroup MaterialGroup 1
MaterialPlanningPriority MaterialPlanningPriority 1
MaterialPlanningPriorityStatus MaterialPlanningPriorityStatus 1
MRPController MRPController 3
MRPGroup MRPGroup 1
MRPType MRPType 1
OnHandStockStatus OnHandStockStatus 1
OrderPlanningStatusText OrderPlanningStatusText 1
ProcurementType ProcurementType 1
ProductConsumptionAmount ProductConsumptionAmount 1
ProjectedStockOutStatus ProjectedStockOutStatus 1
PurOrdCrtnIsAllowed PurOrdCrtnIsAllowed 1
ReplenishmentLeadTimeCode ReplenishmentLeadTimeCode 1
ReplenishmentLeadTimeValue ReplenishmentLeadTimeValue 1
SafetyStockAlertIsPresent SafetyStockAlertIsPresent 1
SFTAlertMicroChartZoneValue SFTAlertMicroChartZoneValue 1
StkOutAlertMicroChartZoneValue StkOutAlertMicroChartZoneValue 1
StockOutAlertIsPresent StockOutAlertIsPresent 1
SupplyCheckIsAllowed SupplyCheckIsAllowed 1
ThldAlertMicroChartZoneValue ThldAlertMicroChartZoneValue 1
ThresholdAlertIsPresent ThresholdAlertIsPresent 1
VariabilityCode VariabilityCode 1
VariabilityQuantity VariabilityQuantity 1
@AbapCatalog.sqlViewName: 'PDDCALCVAL'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #CONSUMPTION
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.private: true
@EndUserText.label: 'Calculated Values for DD MRP'
define view P_DemandDrivenCalcValues
  as select from I_DemandDrivenMaterial as pph_ddl_mat

  association [1..1] to I_DemandDrivenProduct         as pph_prod                     on  $projection.Material = pph_prod.Material
                                                                                      and $projection.Plant    = pph_prod.Plant
                                                                                      and $projection.MRPArea  = pph_prod.MRPArea
  //  association [0..1] to P_NetFlowPosition             as netFlowPosition              on  $projection.Material = netFlowPosition.Material

  //                                                                                      and $projection.Plant    = netFlowPosition.Plant

  //                                                                                      and $projection.MRPArea  = netFlowPosition.MRPArea


  association [0..1] to I_ExpeditedProduct            as _ExpeditedProduct            on  $projection.Material = _ExpeditedProduct.Material
                                                                                      and $projection.Plant    = _ExpeditedProduct.Plant
                                                                                      and $projection.MRPArea  = _ExpeditedProduct.MRPArea

  association [1..1] to P_FirstStockOutValues         as _FirstStockOutVal            on  $projection.Material = _FirstStockOutVal.Material
                                                                                      and $projection.Plant    = _FirstStockOutVal.Plant
                                                                                      and $projection.MRPArea  = _FirstStockOutVal.MRPArea

  association [0..1] to I_ConsumptionText             as _ConsumptionText             on  $projection.ConsumptionCode = _ConsumptionText.ConsumptionCode
                                                                                      and _ConsumptionText.Language   = $session.system_language
  association [0..1] to I_VariabilityText             as _VarText                     on  $projection.VariabilityCode = _VarText.VariabilityCode
                                                                                      and _VarText.Language           = $session.system_language
  association [0..1] to I_ReplenishmentLeadTimeText   as _ReplnmtText                 on  $projection.ReplenishmentLeadTimeCode = _ReplnmtText.ReplenishmentLeadTimeCode
                                                                                      and _ReplnmtText.Language                 = $session.system_language
  association [0..1] to I_BOMUsageText                as _BOMUsgText                  on  $projection.BOMUsageCode = _BOMUsgText.BOMUsageCode
                                                                                      and _BOMUsgText.Language     = $session.system_language
  association [0..1] to I_ProcurementTypeText         as _ProcmtText                  on  $projection.ProcurementType = _ProcmtText.ProcurementType
                                                                                      and _ProcmtText.Language        = $session.system_language
  association [0..1] to I_OnHandStockStatusText       as _OnHandStockStatusText       on  $projection.OnHandStockStatus   = _OnHandStockStatusText.OnHandStockStatusCode
                                                                                      and _OnHandStockStatusText.Language = $session.system_language
  association [0..1] to I_ProdPlngPrioStatusText      as _ProdPlngPrioStatusText      on  $projection.MaterialPlanningPriorityStatus = _ProdPlngPrioStatusText.ProdPlaningPriorityStatusCode
                                                                                      and _ProdPlngPrioStatusText.Language           = $session.system_language
  association [0..1] to I_DemandDrivenPlanningStatus  as _PlanningStatus              on  $projection.Material   = _PlanningStatus.Material
                                                                                      and $projection.Plant      = _PlanningStatus.Plant
                                                                                      and _PlanningStatus.UserID = $session.user
  association [0..1] to I_ProdPlngActionStatusText    as _ProdPlngActionStatusText    on  $projection.OrderPlanningStatusText = _ProdPlngActionStatusText.ProdPlanningActionStatusCode
                                                                                      and _ProdPlngActionStatusText.Language  = $session.system_language
  association [0..1] to I_ProjectedStockOutStatusText as _ProjectedStockOutStatusText on  $projection.projectedstockoutstatus   = _ProjectedStockOutStatusText.ProjectedStockOutStatus
                                                                                      and _ProjectedStockOutStatusText.Language = $session.system_language
{
  key pph_ddl_mat.Plant,
  key pph_ddl_mat.Material,
  key pph_ddl_mat.MRPArea,
      pph_ddl_mat.BaseUnitofMeasure,
      pph_ddl_mat.MaterialBaseUnit,
      pph_ddl_mat.MRPController,
      pph_ddl_mat.MaterialGroup,
      pph_ddl_mat.MRPType,
      pph_ddl_mat.MRPGroup,
      coalesce(pph_prod.DecoupledLeadTime,0)           as DecoupledLeadTime,

      pph_prod._ConsumptionText.ConsumptionDescription as ConsumptionDescription,

      pph_prod._ReplnmtText.ReplenishmentLeadTimeDesc  as ReplenishmentLeadTimeDesc,

      pph_prod._BOMUsgText.BOMUsageDescription         as BOMUsageDescription,

      pph_prod._VarText.VariabilityDescription         as VariabilityDescription,

      coalesce(pph_prod.ConsumptionCode,'')            as ConsumptionCode,

      //      @Semantics.amount.currencyCode: 'Currency'

      //      pph_prod.ConsumptionValue                        as ProductConsumptionAmount,

      @Semantics.amount.currencyCode: 'Currency'
      pph_prod.ProductConsumptionAmount,
      @Semantics.currencyCode: true
      pph_prod.Currency,

      coalesce(pph_prod.ReplenishmentLeadTimeCode,'')  as ReplenishmentLeadTimeCode,
      pph_prod.ReplenishmentLeadTimeValue,

      coalesce(pph_prod.BOMUsageCode,'')               as BOMUsageCode,
      pph_prod.BOMUsageValue,

      coalesce(pph_prod.VariabilityCode,'')            as VariabilityCode,
      pph_prod.VariabilityQuantity,

      coalesce(pph_prod.ProcurementType,'')            as ProcurementType,

      pph_ddl_mat.MaterialSafetyStockQty,
      pph_ddl_mat.MaterialSafetyStockTodayQty,
      pph_ddl_mat.MaterialMaxStockLevelQuantity,
      pph_ddl_mat.ReorderThresholdQuantity,
      pph_ddl_mat.ThresholdPercentage,
      _FirstStockOutVal.QualifiedDemandQuantity,
      _FirstStockOutVal.NetFlowPositionQuantity,
      _FirstStockOutVal.OnHandStockQuantity,
      _FirstStockOutVal.OpenSupplyQuantity,

      case
      when pph_ddl_mat.MaterialSafetyStockTodayQty != 0
      then  division(_FirstStockOutVal.OnHandStockQuantity , pph_ddl_mat.MaterialSafetyStockTodayQty,2)  * 100
      else  fltp_to_dec( 999999.00 as abap.dec( 8, 2 ) )  end                                                        as OnHandBufferStatusQuantity,

      case
      when pph_ddl_mat.MaterialMaxStockLevelQuantity != 0
      then division(_FirstStockOutVal.NetFlowPositionQuantity , pph_ddl_mat.MaterialMaxStockLevelQuantity,2)  * 100
      else fltp_to_dec( 999999.00 as abap.dec( 8, 2 ) ) end                                                          as MaterialPlanningPriority,

      case
      when _FirstStockOutVal.NetFlowPositionQuantity < pph_ddl_mat.ReorderThresholdQuantity
      then cast(pph_ddl_mat.MaterialMaxStockLevelQuantity - _FirstStockOutVal.NetFlowPositionQuantity   as  abap.dec(31, 3))
      else 0 end                                       as ProposedQuantity,

      case
      when _FirstStockOutVal.NetFlowPositionQuantity > pph_ddl_mat.MaterialMaxStockLevelQuantity then 4

      when _FirstStockOutVal.NetFlowPositionQuantity <= pph_ddl_mat.MaterialMaxStockLevelQuantity
      and _FirstStockOutVal.NetFlowPositionQuantity >= pph_ddl_mat.ReorderThresholdQuantity then 3

      when _FirstStockOutVal.NetFlowPositionQuantity < pph_ddl_mat.ReorderThresholdQuantity
      and _FirstStockOutVal.NetFlowPositionQuantity >= pph_ddl_mat.MaterialSafetyStockQty then 2

      when _FirstStockOutVal.NetFlowPositionQuantity < pph_ddl_mat.MaterialSafetyStockQty
      and _FirstStockOutVal.NetFlowPositionQuantity >0 then 1

      when _FirstStockOutVal.NetFlowPositionQuantity <=0 and _FirstStockOutVal.QualifiedDemandQuantity > 0 then 0

      else 1
      end                                              as MaterialPlanningPriorityStatus,

      case
      //Top of Green for the OnHand Buffer is equal to Top of Yellow(ReorderThresholdQty) for Planning Priority

      when _FirstStockOutVal.OnHandStockQuantity > pph_ddl_mat.ReorderThresholdQuantity then 4

      when _FirstStockOutVal.OnHandStockQuantity <= pph_ddl_mat.ReorderThresholdQuantity
      and _FirstStockOutVal.OnHandStockQuantity >= pph_ddl_mat.MaterialSafetyStockQty then 3

      //Top of Yellow for the OnHand Buffer is equal to Top of Red(SafetyStock) for Planning Priority

      when _FirstStockOutVal.OnHandStockQuantity < pph_ddl_mat.MaterialSafetyStockQty
      and _FirstStockOutVal.OnHandStockQuantity >= pph_ddl_mat.ThresholdPercentage then 2

      //Top of Red for the OnHand Buffer is equal to 50% of Top of Red(SafetyStock) for Planning Priority

      when _FirstStockOutVal.OnHandStockQuantity < pph_ddl_mat.ThresholdPercentage
      and _FirstStockOutVal.OnHandStockQuantity >0 then 1

      when _FirstStockOutVal.OnHandStockQuantity <=0  and _FirstStockOutVal.QualifiedDemandQuantity > 0 then 0

      else 1
      end                                              as OnHandStockStatus,


      case

      when _FirstStockOutVal.NetFlowPositionQuantity > pph_ddl_mat.ReorderThresholdQuantity then 0

      when _FirstStockOutVal.NetFlowPositionQuantity <= pph_ddl_mat.ReorderThresholdQuantity
      and _FirstStockOutVal.NetFlowPositionQuantity > pph_ddl_mat.MaterialSafetyStockQty then 0


      when _FirstStockOutVal.NetFlowPositionQuantity <= pph_ddl_mat.MaterialSafetyStockQty
      and _FirstStockOutVal.NetFlowPositionQuantity > pph_ddl_mat.ThresholdPercentage then 1


      when _FirstStockOutVal.NetFlowPositionQuantity <= pph_ddl_mat.ThresholdPercentage
      and _FirstStockOutVal.NetFlowPositionQuantity >0 then 1

      when _FirstStockOutVal.NetFlowPositionQuantity <=0 then 1
      else 1
      end                                              as PurOrdCrtnIsAllowed,

      case
      when _FirstStockOutVal.OpenSupplyQuantity > 0 then 1
      else 0
      end                                              as SupplyCheckIsAllowed,

      case
      when _FirstStockOutVal.StockOutAlertIsPresent != 'X'
      then -1
      when _FirstStockOutVal.FirstStkOutFromTodayInDays = 0
      then 0
      when _FirstStockOutVal.FirstStkOutFromTodayInDays = ceil(coalesce(pph_prod.DecoupledLeadTime,0))
      then 6
      when _FirstStockOutVal.FirstStkOutFromTodayInDays < ceil(0.2 * cast(coalesce(pph_prod.DecoupledLeadTime,0) as abap.fltp))
      then 1
      when _FirstStockOutVal.FirstStkOutFromTodayInDays < ceil(0.4 * cast(coalesce(pph_prod.DecoupledLeadTime,0) as abap.fltp))
      then 2
      when _FirstStockOutVal.FirstStkOutFromTodayInDays < ceil(0.6 * cast(coalesce(pph_prod.DecoupledLeadTime,0) as abap.fltp))
      then 3
      when _FirstStockOutVal.FirstStkOutFromTodayInDays < ceil(0.8 * cast(coalesce(pph_prod.DecoupledLeadTime,0) as abap.fltp))
      then 4
      when _FirstStockOutVal.FirstStkOutFromTodayInDays < ceil(coalesce(pph_prod.DecoupledLeadTime,0))
      then 5
      else -1
      end                                              as StkOutAlertMicroChartZoneValue,

      case
      when _FirstStockOutVal.ThresholdAlertIsPresent != 'X'
      then -1
      when _FirstStockOutVal.FirstBelowThldFromTodayInDays = 0
      then 0
      when _FirstStockOutVal.FirstBelowThldFromTodayInDays = ceil(coalesce(pph_prod.DecoupledLeadTime,0))
      then 6
      when _FirstStockOutVal.FirstBelowThldFromTodayInDays < ceil(0.2 * cast(coalesce(pph_prod.DecoupledLeadTime,0) as abap.fltp))
      then 1
      when _FirstStockOutVal.FirstBelowThldFromTodayInDays < ceil(0.4 * cast(coalesce(pph_prod.DecoupledLeadTime,0) as abap.fltp))
      then 2
      when _FirstStockOutVal.FirstBelowThldFromTodayInDays < ceil(0.6 * cast(coalesce(pph_prod.DecoupledLeadTime,0) as abap.fltp))
      then 3
      when _FirstStockOutVal.FirstBelowThldFromTodayInDays < ceil(0.8 * cast(coalesce(pph_prod.DecoupledLeadTime,0) as abap.fltp))
      then 4
      when _FirstStockOutVal.FirstBelowThldFromTodayInDays < ceil(coalesce(pph_prod.DecoupledLeadTime,0))
      then 5
      else -1
      end                                              as ThldAlertMicroChartZoneValue,

      case
      when _FirstStockOutVal.SafetyStockAlertIsPresent != 'X'
      then -1
      when _FirstStockOutVal.FirstBelowSFTFromTodayInDays = 0
      then 0
      when _FirstStockOutVal.FirstBelowSFTFromTodayInDays = ceil(coalesce(pph_prod.DecoupledLeadTime,0))
      then 6
      when _FirstStockOutVal.FirstBelowSFTFromTodayInDays < ceil(0.2 * cast(coalesce(pph_prod.DecoupledLeadTime,0) as abap.fltp))
      then 1
      when _FirstStockOutVal.FirstBelowSFTFromTodayInDays < ceil(0.4 * cast(coalesce(pph_prod.DecoupledLeadTime,0) as abap.fltp))
      then 2
      when _FirstStockOutVal.FirstBelowSFTFromTodayInDays < ceil(0.6 * cast(coalesce(pph_prod.DecoupledLeadTime,0) as abap.fltp))
      then 3
      when _FirstStockOutVal.FirstBelowSFTFromTodayInDays < ceil(0.8 * cast(coalesce(pph_prod.DecoupledLeadTime,0) as abap.fltp))
      then 4
      when _FirstStockOutVal.FirstBelowSFTFromTodayInDays < ceil(coalesce(pph_prod.DecoupledLeadTime,0))
      then 5
      else -1
      end                                              as SFTAlertMicroChartZoneValue,

      @UI.hidden: true
      @Consumption.filter.hidden: true
      case when _ExpeditedProduct.ExpeditedDateTime!=0 then 1
      else 0 end                                       as ExpeditedStatus,
      _ExpeditedProduct.ExpeditedDateTime,
      _ExpeditedProduct.ExpeditedOnHandStockStatus,
      _ExpeditedProduct.ExpeditedQuantity,

      // Projected stock alert values

      _FirstStockOutVal.StockOutAlertIsPresent,
      _FirstStockOutVal.FirstStkOutDate,
      _FirstStockOutVal.FirstStkOutProjtdStkQty,
      _FirstStockOutVal.FirstStkOutProjtdSFTQty,
      _FirstStockOutVal.FirstStkOutProjtdSFTPct,
      _FirstStockOutVal.FirstStkOutFromTodayInDays,
      _FirstStockOutVal.ThresholdAlertIsPresent,
      _FirstStockOutVal.FirstBelowThldDate,
      _FirstStockOutVal.FirstBelowThldProjtdStkQty,
      _FirstStockOutVal.FirstBelowThldThldLvlQty,
      _FirstStockOutVal.FirstBelowThldProjtdSFTQty,
      _FirstStockOutVal.FirstBelowThldProjtdSFTPct,
      _FirstStockOutVal.FirstBelowThldFromTodayInDays,
      _FirstStockOutVal.SafetyStockAlertIsPresent,
      _FirstStockOutVal.FirstBelowSFTDate,
      _FirstStockOutVal.FirstBelowSFTProjtdStkQty,
      _FirstStockOutVal.FirstBelowSFTThldLvlQty,
      _FirstStockOutVal.FirstBelowSFTProjtdSFTQty,
      _FirstStockOutVal.FirstBelowSFTProjtdSFTPct,
      _FirstStockOutVal.FirstBelowSFTFromTodayInDays,
      _FirstStockOutVal.ProjectedStockOutStatus,
      pph_prod.PastHorizonDLTMultiplierValue,
      pph_prod.FutureHrznDLTMultiplierValue,

      _ConsumptionText,
      _VarText,
      _ReplnmtText,
      _BOMUsgText,
      _ProcmtText,
      _OnHandStockStatusText,
      _ProdPlngPrioStatusText,
      _ProjectedStockOutStatusText,
      coalesce(pph_prod.IndividualLeadTime,0)          as IndividualLeadTime,
      case when _PlanningStatus.OrderPlanningStatusText = 'Q' then 1
        else
          case when (_FirstStockOutVal.NetFlowPositionQuantity < pph_ddl_mat.ReorderThresholdQuantity) and (pph_ddl_mat.MaterialMaxStockLevelQuantity > _FirstStockOutVal.NetFlowPositionQuantity)
          then 0
          else 2
          end
        end                                            as OrderPlanningStatusText,
      _ProdPlngActionStatusText

}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_BOMUSAGETEXT",
"I_CONSUMPTIONTEXT",
"I_DEMANDDRIVENMATERIAL",
"I_DEMANDDRIVENPLANNINGSTATUS",
"I_DEMANDDRIVENPRODUCT",
"I_EXPEDITEDPRODUCT",
"I_REPLENISHMENTLEADTIMETEXT",
"I_VARIABILITYTEXT",
"P_FIRSTSTOCKOUTVALUES"
],
"ASSOCIATED":
[
"I_BOMUSAGETEXT",
"I_CONSUMPTIONTEXT",
"I_DEMANDDRIVENPLANNINGSTATUS",
"I_DEMANDDRIVENPRODUCT",
"I_EXPEDITEDPRODUCT",
"I_ONHANDSTOCKSTATUSTEXT",
"I_PROCUREMENTTYPETEXT",
"I_PRODPLNGACTIONSTATUSTEXT",
"I_PRODPLNGPRIOSTATUSTEXT",
"I_PROJECTEDSTOCKOUTSTATUSTEXT",
"I_REPLENISHMENTLEADTIMETEXT",
"I_VARIABILITYTEXT",
"P_FIRSTSTOCKOUTVALUES"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/