P_MRPProdDemandAggregation

DDL: P_MRPPRODDEMANDAGGREGATION SQL: PMRPPRODDEMAGGR Type: view COMPOSITE Package: ODATA_PP_MRP

Production Demand Aggregation

P_MRPProdDemandAggregation is a Composite CDS View that provides data about "Production Demand Aggregation" in SAP S/4HANA. It reads from 3 data sources (I_MRPPlanningSegment, I_MRPReservation, I_MaterialShortageDefinition) and exposes 11 fields with key fields MRPPlanningSegmentType, MRPPlanningSegment, MaterialShortageProfile, MaterialShortageProfileCount, SourceMRPElement. Part of development package ODATA_PP_MRP.

Data Sources (3)

SourceAliasJoin Type
I_MRPPlanningSegment MRPPlanningSegment from
I_MRPReservation OrderOperationComponent inner
I_MaterialShortageDefinition ShortageDefinition left_outer

Annotations (9)

NameValueLevelField
AbapCatalog.sqlViewName PMRPPRODDEMAGGR view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
AccessControl.personalData.blocking #NOT_REQUIRED view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.dataClass #MIXED view
VDM.private true view
VDM.viewType #COMPOSITE view

Fields (11)

KeyFieldSource TableSource FieldDescription
KEY MRPPlanningSegmentType I_MRPPlanningSegment MRPPlanningSegmentType
KEY MRPPlanningSegment I_MRPPlanningSegment MRPPlanningSegment
KEY MaterialShortageProfile I_MaterialShortageDefinition MaterialShortageProfile
KEY MaterialShortageProfileCount I_MaterialShortageDefinition MaterialShortageProfileCount
KEY SourceMRPElement CacheSupDemItem SourceMRPElement
KEY SourceMRPElementCategory CacheSupDemItem SourceMRPElementCategory
MaximumDelayInDays
MaximumDelayInWorkdays
MaximumDelayedQuantity
MaximumUncoveredQuantity
NumberOfUncoveredDemandItems
@AbapCatalog.sqlViewName: 'PMRPPRODDEMAGGR'
@AbapCatalog.compiler.compareFilter: true
@AccessControl: {authorizationCheck: #NOT_REQUIRED,
                personalData.blocking: #NOT_REQUIRED
}
@ObjectModel: {
    usageType: {serviceQuality: #C, sizeCategory: #XXL, dataClass: #MIXED }
}
@VDM.private: true
@VDM.viewType: #COMPOSITE

define view P_MRPProdDemandAggregation
  as select from    I_MRPPlanningSegment         as MRPPlanningSegment

    left outer join I_MaterialShortageDefinition as ShortageDefinition      on  MRPPlanningSegment.MaterialShortageProfile       = ShortageDefinition.MaterialShortageProfile
                                                                            and ShortageDefinition.HasMfgOrderComponentCheckRule = 'X'

    left outer join(
                    I_CacheSupplyDemandItem      as CacheSupDemItem
      // Exclude By Product Items from the aggregation

        inner join  I_MRPReservation             as OrderOperationComponent on  CacheSupDemItem.MRPElement              =  OrderOperationComponent.Reservation
                                                                            and CacheSupDemItem.MRPElementItem          =  OrderOperationComponent.MRPElementItem
                                                                            and OrderOperationComponent.DebitCreditCode <> 'S'
    )
    on  CacheSupDemItem.MRPPlanningSegmentType      = MRPPlanningSegment.MRPPlanningSegmentType
    and CacheSupDemItem.MRPPlanningSegment          = MRPPlanningSegment.MRPPlanningSegment
    and CacheSupDemItem.MaterialShortageProfile     = ShortageDefinition.MaterialShortageProfile
    and CacheSupDemItem.NumberOfShortages           = ShortageDefinition.MaterialShortageProfileCount
    and CacheSupDemItem.MRPPlant                    = MRPPlanningSegment.MRPPlant
    and CacheSupDemItem.Material                    = MRPPlanningSegment.Material
    and CacheSupDemItem.MRPArea                     = MRPPlanningSegment.MRPArea
    and (
       CacheSupDemItem.MRPElementCategory           = 'SB'
       or CacheSupDemItem.MRPElementCategory        = 'SM'
       or CacheSupDemItem.MRPElementCategory        = 'SU'
       or CacheSupDemItem.MRPElementCategory        = 'AR'

     )
    and (
       CacheSupDemItem.SourceMRPElementCategory     = 'BR'
       or CacheSupDemItem.SourceMRPElementCategory  = 'FE'
       or CacheSupDemItem.SourceMRPElementCategory  = 'IH'
       or CacheSupDemItem.SourceMRPElementCategory  = 'NE'
     )
    and (
       CacheSupDemItem.MRPElementUncoveredQuantity  > 0
       or CacheSupDemItem.MRPElementDelayedQuantity > 0
     )

{
  key MRPPlanningSegment.MRPPlanningSegmentType,
  key MRPPlanningSegment.MRPPlanningSegment,
  key ShortageDefinition.MaterialShortageProfile,
  key ShortageDefinition.MaterialShortageProfileCount,
  key CacheSupDemItem.SourceMRPElement,
  key CacheSupDemItem.SourceMRPElementCategory,
      max(CacheSupDemItem.MaximumDelayInDays)          as MaximumDelayInDays,
      max(CacheSupDemItem.MaximumDelayInWorkdays)      as MaximumDelayInWorkdays,
      max(CacheSupDemItem.MRPElementDelayedQuantity)   as MaximumDelayedQuantity,
      max(CacheSupDemItem.MRPElementUncoveredQuantity) as MaximumUncoveredQuantity,
      count(*)                                         as NumberOfUncoveredDemandItems
}
group by
  MRPPlanningSegment.MRPPlanningSegmentType,
  MRPPlanningSegment.MRPPlanningSegment,
  ShortageDefinition.MaterialShortageProfile,
  ShortageDefinition.MaterialShortageProfileCount,
  CacheSupDemItem.SourceMRPElementCategory,
  CacheSupDemItem.SourceMRPElement;