P_StockLevelMngNumFields

DDL: P_STOCKLEVELMNGNUMFIELDS SQL: PSTCKLVLMNGNUM Type: view CONSUMPTION

P_StockLevelMngNumFields is a Consumption CDS View in SAP S/4HANA. It reads from 1 data source (P_StockLevelMngCalcFields) and exposes 60 fields with key fields MRPArea, Material, Plant, ProposalStartDate, ProposalVersion. It has 1 association to related views.

Data Sources (1)

SourceAliasJoin Type
P_StockLevelMngCalcFields _CalFields from

Associations (1)

CardinalityTargetAliasCondition
[1..1] I_DifferenceInDaysText _DifferenceInDaysText _DifferenceInDaysText.DifferenceInDays = _CalFields.DifferenceInDaysDesc and _DifferenceInDaysText.Language = $session.system_language

Annotations (6)

NameValueLevelField
AbapCatalog.sqlViewName PSTCKLVLMNGNUM view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.private true view
VDM.viewType #CONSUMPTION view

Fields (60)

KeyFieldSource TableSource FieldDescription
KEY MRPArea MRPArea
KEY Material Material
KEY Plant Plant
KEY ProposalStartDate P_StockLevelMngCalcFields ProposalStartDate
KEY ProposalVersion P_StockLevelMngCalcFields ProposalVersion
AvgDailyUsageHorizonEndDate
AvgDailyUsageHorizonStartDate
BufLvlProposalHorizonStartDate
AvgDailyUsageDifference
LeadTimeDifference
VariabilityFactorDifference
LeadTimeFactorDifference
AvgDailyUsageDeviationRate
VariabilityFactorDeviationRate
LeadTimeDeviationRate
LeadTimeFactorDeviationRate
CurrentRedZone CurrentRedZone
CurrentYellowZone CurrentYellowZone
CurrentGreenZone CurrentGreenZone
ProposedRedZone ProposedRedZone
ProposedYellowZone ProposedYellowZone
ProposedGreenZone ProposedGreenZone
RedZoneDifference RedZoneDifference
YellowZoneDifference YellowZoneDifference
GreenZoneDifference GreenZoneDifference
MaxStockDifference
CurrentLeadTime P_StockLevelMngCalcFields CurrentLeadTime
BufferLevelStartDate P_StockLevelMngCalcFields BufferLevelStartDate
CurrentAverageDailyUsage P_StockLevelMngCalcFields CurrentAvgDailyUsage
CurrentLeadTimeFactor P_StockLevelMngCalcFields CurrentLeadTimeFactor
CurrentVariabilityFactor P_StockLevelMngCalcFields CurrentVariabilityFactor
ProposalEndDate P_StockLevelMngCalcFields ProposalEndDate
ProposedAverageDailyUsage P_StockLevelMngCalcFields ProposedAverageDailyUsage
ProposedLeadTime P_StockLevelMngCalcFields ProposedLeadTime
ProposedLeadTimeFactor P_StockLevelMngCalcFields ProposedLeadTimeFactor
ProposedVariabilityFactor P_StockLevelMngCalcFields ProposedVariabilityFactor
StockLevelProposalID P_StockLevelMngCalcFields StockLevelProposalID
StockLevelProposalStatus P_StockLevelMngCalcFields StockLevelProposalStatus
AvgDailyUsageUnit P_StockLevelMngCalcFields AvgDailyUsageUnit
ProposedMaterialBufferProfile P_StockLevelMngCalcFields ProposedMaterialBufferProfile
ProposedMatlBufferProfileText P_StockLevelMngCalcFields ProposedMatlBufferProfileText
ProcurementTypeDescription P_StockLevelMngCalcFields ProcurementTypeDescription
VariabilityDescription P_StockLevelMngCalcFields VariabilityDescription
ReplenishmentLeadTimeDesc P_StockLevelMngCalcFields ReplenishmentLeadTimeDesc
DifferenceInDaysDesc P_StockLevelMngCalcFields DifferenceInDaysDesc
UnitOfMeasure
ActualUnitOfMeasure
HorizonDaysInPast
MatlPrpslAdjmtFctrIsApplied P_StockLevelMngCalcFields MatlPrpslAdjmtFctrIsApplied
VariabilityQuantity P_StockLevelMngCalcFields VariabilityQuantity
VariabilityUnit P_StockLevelMngCalcFields VariabilityUnit
ReplenishmentLeadTimeValue P_StockLevelMngCalcFields ReplenishmentLeadTimeValue
ProposedMatlVariabilityCode P_StockLevelMngCalcFields ProposedMatlVariabilityCode
ProposedMatlVariabilityQty P_StockLevelMngCalcFields ProposedMatlVariabilityQty
ProposedMatlVariabilityUnit P_StockLevelMngCalcFields ProposedMatlVariabilityUnit
ProposedMatlLeadTimeCode P_StockLevelMngCalcFields ProposedMatlLeadTimeCode
ProposedMatlLeadTime P_StockLevelMngCalcFields ProposedMatlLeadTime
CurrentMatlLeadTimeCode P_StockLevelMngCalcFields CurrentMatlLeadTimeCode
CurrentMatlVariabilityCode P_StockLevelMngCalcFields CurrentMatlVariabilityCode
_StockActual _StockActual
@AbapCatalog.sqlViewName: 'PSTCKLVLMNGNUM'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE

@VDM.private: true
@VDM.viewType:#CONSUMPTION
define view P_StockLevelMngNumFields
  as select from P_StockLevelMngCalcFields as _CalFields

  association [1..1] to I_DifferenceInDaysText as _DifferenceInDaysText on  _DifferenceInDaysText.DifferenceInDays = _CalFields.DifferenceInDaysDesc
                                                                        and _DifferenceInDaysText.Language         = $session.system_language




{
   
  
  key  MRPArea,
  key  Material,
  key  Plant,
  key  _CalFields.ProposalStartDate,
  key  _CalFields.ProposalVersion,


       dats_add_days(_CalFields.ProposalStartDate, -1*1, 'NULL')                                                                                                                                                                                                                                               as  AvgDailyUsageHorizonEndDate,
       dats_add_days(_CalFields.ProposalStartDate,-1*(_CalFields.HorizonDaysInPast + 1), 'NULL')                                                                                                                                                                                                               as  AvgDailyUsageHorizonStartDate,


       DATS_ADD_DAYS( cast(_CalFields.ProposalStartDate as dats) ,(-1 * cast(_CalFields.TotalNoOfDays as abap.int4)),'NULL')                                                                                                                                                                                   as  BufLvlProposalHorizonStartDate,

       cast(cast(division(AvgDailyUsageDifference, 1, 3) as abap.quan(13,3)) as     pph_avgdailyusagedifference  preserving type )                                                                                                                                                                             as  AvgDailyUsageDifference,
       cast(cast(division(LeadTimeDifference, 1, 2)   as abap.dec(7,2))      as pph_leadtimedifference    preserving type )                                                                                                                                                                                    as  LeadTimeDifference,
       division(VariabilityFactorDifference, 1, 2)                                                                                                                                                                                                                                                             as  VariabilityFactorDifference,
       division(LeadTimeFactorDifference,1,2)                                                                                                                                                                                                                                                                  as  LeadTimeFactorDifference,
       cast(fltp_to_dec(AvgDailyUsageDeviationRate as abap.dec( 12, 2 ))     as pph_avgdailyusagedeviationrate  preserving type )                                                                                                                                                                              as  AvgDailyUsageDeviationRate,
       fltp_to_dec(VariabilityFactorDeviationRate as abap.dec( 12, 2 ))                                                                                                                                                                                                                                        as  VariabilityFactorDeviationRate,
       fltp_to_dec(LeadTimeDeviationRate as abap.dec( 12, 2 ))                                                                                                                                                                                                                                                 as  LeadTimeDeviationRate,
       cast(fltp_to_dec(LeadTimeFactorDeviationRate as abap.dec( 12, 2 ))   as pph_leadtimedeviationrate preserving type )                                                                                                                                                                                     as  LeadTimeFactorDeviationRate,


       CurrentRedZone,
       CurrentYellowZone,
       CurrentGreenZone,



       ProposedRedZone                                                                                                                                                                                                                                                                                         as  ProposedRedZone,
       ProposedYellowZone                                                                                                                                                                                                                                                                                      as  ProposedYellowZone,
       ProposedGreenZone                                                                                                                                                                                                                                                                                       as  ProposedGreenZone,





       RedZoneDifference                                                                                                                                                                                                                                                                                       as  RedZoneDifference,
       YellowZoneDifference                                                                                                                                                                                                                                                                                    as  YellowZoneDifference,
       GreenZoneDifference                                                                                                                                                                                                                                                                                     as  GreenZoneDifference,
       cast(cast(_CalFields.MaxStockDifference as abap.quan(13,3)) as pph_maxstockdifference preserving type)                                                                                                                                                                                                  as  MaxStockDifference,

       cast( cast(
        case
         when _CalFields.MaterialMaxStockLevelQuantity is  null or   _CalFields.MaterialMaxStockLevelQuantity = 0
          then
            case
            when _CalFields.MatlProposedMaxStock <> 0
            then fltp_to_dec(99999.99 as abap.dec(12,2))
            else 0
            end
          else
           division(((cast(_CalFields.MatlProposedMaxStock - _CalFields.MaterialMaxStockLevelQuantity   as abap.dec(12,2))  )*100),_CalFields.MaterialMaxStockLevelQuantity,2)
         end   as abap.dec(12,2))     as pph_maxstockdeviationrate preserving type   )
                                                                                                                                                                                                                                                                                                               as  MaxStockDeviationRate,

       _CalFields.CurrentLeadTime,
       _CalFields.BufferLevelStartDate,
       _CalFields.CurrentAvgDailyUsage                                                                                                                                                                                                                                                                         as  CurrentAverageDailyUsage,
       _CalFields.CurrentLeadTimeFactor,
       _CalFields.CurrentVariabilityFactor,

       _CalFields.ProposalEndDate,
       _CalFields.ProposedAverageDailyUsage,
       _CalFields.ProposedLeadTime,
       _CalFields.ProposedLeadTimeFactor,
       _CalFields.ProposedVariabilityFactor,
       _CalFields.StockLevelProposalID,
       _CalFields.StockLevelProposalStatus,
       _CalFields.AvgDailyUsageUnit,
       _CalFields.ProposedMaterialBufferProfile,
       _CalFields.ProposedMatlBufferProfileText,
       _CalFields.ProcurementTypeDescription,
       _CalFields.VariabilityDescription,
       _CalFields.ReplenishmentLeadTimeDesc,

       _CalFields.DifferenceInDaysDesc,



       case
       when _CalFields.DifferenceInDays = 0 or _CalFields.DifferenceInDays = 1
       then _DifferenceInDaysText.DifferenceInDaysDesc
       else
       concat_with_space(cast(_CalFields.DifferenceInDays as abap.sstring( 12 )), _DifferenceInDaysText.DifferenceInDaysDesc, 2)
       end                                                                                                                                                                                                                                                                                                     as  DifferenceInDays,


       case when _CalFields.MatlProposedMaxStock  > _CalFields.MaterialMaxStockLevelQuantity
       then
       case when _CalFields.MatlProposedMaxStock <> 0
       then division(_CalFields.CurrentRedZone,_CalFields.MatlProposedMaxStock,3)*100
       else 0
       end
       else
       case when _CalFields.MaterialMaxStockLevelQuantity <> 0
       then  division(_CalFields.CurrentRedZone,_CalFields.MaterialMaxStockLevelQuantity,3)*100
       else 0
       end
       end                                                                                                                                                                                                                                                                                                     as  NormalizedCurrentRedZone,

       case when _CalFields.MatlProposedMaxStock  > _CalFields.MaterialMaxStockLevelQuantity
       then
       case when _CalFields.MatlProposedMaxStock <> 0
       then division(_CalFields.CurrentYellowZone,_CalFields.MatlProposedMaxStock,3)*100
       else 0
       end
       else
       case when _CalFields.MaterialMaxStockLevelQuantity <> 0
       then division(_CalFields.CurrentYellowZone,_CalFields.MaterialMaxStockLevelQuantity,3)*100
       else 0
       end
       end                                                                                                                                                                                                                                                                                                     as  NormalizedCurrentYellowZone,

       case when _CalFields.MatlProposedMaxStock  > _CalFields.MaterialMaxStockLevelQuantity
       then
       case when _CalFields.MatlProposedMaxStock <> 0
       then division(_CalFields.CurrentGreenZone,_CalFields.MatlProposedMaxStock,3)*100
       else 0
       end
       else
       case when _CalFields.MaterialMaxStockLevelQuantity <> 0
       then  division(_CalFields.CurrentGreenZone,_CalFields.MaterialMaxStockLevelQuantity,3)*100
       else 0
       end
       end                                                                                                                                                                                                                                                                                                     as  NormalizedCurrentGreenZone,


       case when _CalFields.MatlProposedMaxStock  < _CalFields.MaterialMaxStockLevelQuantity
       then
       case when _CalFields.MaterialMaxStockLevelQuantity <> 0
       then division(_CalFields.ProposedRedZone,_CalFields.MaterialMaxStockLevelQuantity,3)*100
       else 0
       end
       else
       case when _CalFields.MatlProposedMaxStock <> 0
       then  division(_CalFields.ProposedRedZone,_CalFields.MatlProposedMaxStock,3)*100
       else 0
       end
       end                                                                                                                                                                                                                                                                                                     as  NormalizedProposedRedZone,

       case when _CalFields.MatlProposedMaxStock  < _CalFields.MaterialMaxStockLevelQuantity
       then
       case when _CalFields.MaterialMaxStockLevelQuantity <> 0
       then division(_CalFields.ProposedYellowZone,_CalFields.MaterialMaxStockLevelQuantity,3)*100
       else 0
       end
       else
       case when _CalFields.MatlProposedMaxStock <> 0
       then   division(_CalFields.ProposedYellowZone,_CalFields.MatlProposedMaxStock,3)*100
       else 0
       end
       end                                                                                                                                                                                                                                                                                                     as  NormalizedProposedYellowZone,

       case when _CalFields.MatlProposedMaxStock  < _CalFields.MaterialMaxStockLevelQuantity
       then
       case when _CalFields.MaterialMaxStockLevelQuantity <> 0
       then division(_CalFields.ProposedGreenZone,_CalFields.MaterialMaxStockLevelQuantity,3)*100
       else 0
       end
       else
       case when _CalFields.MatlProposedMaxStock <> 0
       then   division(_CalFields.ProposedGreenZone,_CalFields.MatlProposedMaxStock,3)*100
       else 0
       end
       end                                                                                                                                                                                                                                                                                                     as  NormalizedProposedGreenZone,

       cast ('%' as meins)                                                                                                                                                                                                                                                                                     as  UnitOfMeasure,
       cast('TAG' as msehi )                                                                                                                                                                                                                                                                                   as  ActualUnitOfMeasure,


       dats_days_between(_CalFields.ProposalStartDate, cast($session.system_date as sydatum) )   + cast(_CalFields.HorizonDaysInPast  as abap.int4)                                                                                                                                                            as  HorizonDaysInPast,

       _CalFields.MatlPrpslAdjmtFctrIsApplied,



       // Values of Indicators


       _CalFields.VariabilityQuantity,
       _CalFields.VariabilityUnit,
       _CalFields.ReplenishmentLeadTimeValue,
       _CalFields.ProposedMatlVariabilityCode,
       _CalFields.ProposedMatlVariabilityQty,
       _CalFields.ProposedMatlVariabilityUnit,
       _CalFields.ProposedMatlLeadTimeCode,
       _CalFields.ProposedMatlLeadTime,
       _CalFields.CurrentMatlLeadTimeCode,
       _CalFields.CurrentMatlVariabilityCode,






       _StockActual



}
where
  _CalFields.ProposalEndDate = '99991231'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_DIFFERENCEINDAYSTEXT",
"P_STOCKLEVELMNGCALCFIELDS"
],
"ASSOCIATED":
[
"I_DIFFERENCEINDAYSTEXT",
"P_TIMEDEPENDENTSTOCKBUFFER"
],
"BASE":
[
"P_STOCKLEVELMNGCALCFIELDS"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/