P_RSHWCCapacityPerDayForPeriod

DDL: P_RSHWCCAPACITYPERDAYFORPERIOD SQL: PRSHWCCAPPDPER Type: view CONSUMPTION

P_RSHWCCapacityPerDayForPeriod is a Consumption CDS View in SAP S/4HANA. It reads from 2 data sources (I_CalendarDate, P_RSHWCCapWithNightsForPeriod) and exposes 21 fields with key fields CapacityInternalID, CalendarDate.

Data Sources (2)

SourceAliasJoin Type
I_CalendarDate date_series inner
P_RSHWCCapWithNightsForPeriod P_RSHWCCapWithNightsForPeriod from

Parameters (2)

NameTypeDefault
P_StartDate datum
P_EndDate datum

Annotations (6)

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

Fields (21)

KeyFieldSource TableSource FieldDescription
KEY CapacityInternalID CapacityInternalID
KEY CalendarDate CalendarDate
WorkCenterInternalID WorkCenterInternalID
WorkCenter WorkCenter
WorkCenterCategoryCode WorkCenterCategoryCode
WorkCenterTypeCode WorkCenterTypeCode
Plant Plant
WeekDay CapacityPerShift WeekDay
AvailableCapacityShift AvailableCapacityShift
CapacityStartTime CapacityStartTime
NightSplitDate NightSplitDate
AvailableCapacityIntervalDurn AvailableCapacityIntervalDurn
WorkDayRule WorkDayRule
CapacityEndTime CapacityEndTime
TotOperatingDurationInSeconds TotOperatingDurationInSeconds
OperatingDurationInSeconds OperatingDurationInSeconds
CapacityNumberOfCapacities CapacityNumberOfCapacities
CapacityPlanUtilizationPercent CapacityPlanUtilizationPercent
FactoryCalendar FactoryCalendar
YearWeek YearWeek
CapacityBreakDuration CapacityBreakDuration
@AbapCatalog.sqlViewName: 'PRSHWCCAPPDPER'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.private: true
@VDM.viewType: #CONSUMPTION
@ClientHandling.algorithm: #SESSION_VARIABLE

/*
CONTRACT**********************************************************************************************************************

Name:                       Capacity Per Day with Input Period
Specification:              This view rolls out to capacity shift to calendar days and aggregates the capacity per day.
Requires:                   NA
Ensures:                    Aggregated capacity per calendar days is returned.
Owners:                     PRP
Contributors:               
Unit Test required Y/N:     Yes
Additional comments         The view is similar to P_RSHWCCapacityPerDay. But the difference is that the current view takes   
                            an input period. Based on this input period, the interval/shift details are filtered at lower level

END OF CONTRACT***************************************************************************************************************
*/


define view P_RSHWCCapacityPerDayForPeriod
  with parameters
    P_StartDate : datum,
    P_EndDate   : datum

  as select from P_RSHWCCapWithNightsForPeriod(P_StartDate : $parameters.P_StartDate, P_EndDate : $parameters.P_EndDate) as CapacityPerShift

    inner join   I_CalendarDate            as date_series on  date_series.CalendarDate       <= ValidityEndDate  --$parameters.P_EndDate 
                                                          and date_series.CalendarDate       >= ValidityBeginDate --$parameters.P_StartDate
                                                          and (
                                                             (
                                                               AvailableCapacityIntervalDurn =  '01'
                                                             )     // 1 day shift interval duration

                                                             or(
                                                               AvailableCapacityIntervalDurn =  '07'
                                                               and // 7 day shift interval duration

                                                               date_series.WeekDay           =  CapacityPerShift.WeekDay
                                                             )
                                                           )

{

  key CapacityInternalID,

  key CalendarDate,

      WorkCenterInternalID,
      WorkCenter,
      WorkCenterCategoryCode,
      WorkCenterTypeCode,
      Plant,

      CapacityPerShift.WeekDay,

      AvailableCapacityShift,
      CapacityStartTime,
      NightSplitDate,
      AvailableCapacityIntervalDurn,
      WorkDayRule,
      //      CapacityBreakDuration,

      CapacityEndTime,
      TotOperatingDurationInSeconds,
      OperatingDurationInSeconds,
      CapacityNumberOfCapacities,
      CapacityPlanUtilizationPercent,
      FactoryCalendar,
      YearWeek,

      CapacityBreakDuration,

      case when NightSplitDate = 2
           then dats_add_days(CalendarDate, -1, 'FAIL')
           else CalendarDate
      end               as  FactoryCalendarDate

}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CALENDARDATE",
"P_RSHWCCAPWITHNIGHTSFORPERIOD"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/