P_MRPProdDemandAggregation

DDL: P_MRPPRODDEMANDAGGREGATION SQL: PMRPPRODDEMAGGR Type: view COMPOSITE

P_MRPProdDemandAggregation is a Composite CDS View in SAP S/4HANA. It reads from 3 data sources (I_CacheSupplyDemandItem, I_MRPPlanningSegment, I_MaterialShortageDefinition) and exposes 11 fields with key fields MRPPlanningSegmentType, MRPPlanningSegment, MaterialShortageProfile, MaterialShortageProfileCount, SourceMRPElement.

Data Sources (3)

SourceAliasJoin Type
I_CacheSupplyDemandItem CacheSupDemItem left_outer
I_MRPPlanningSegment MRPPlanningSegment from
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 I_CacheSupplyDemandItem SourceMRPElement
KEY SourceMRPElementCategory I_CacheSupplyDemandItem 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    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;