P_WRKCTRCAPOPWRKDAYS

CDS View

P_WRKCTRCAPOPWRKDAYS is a CDS View in S/4HANA. 2 CDS views read from this table.

CDS Views using this table (2)

ViewTypeJoinVDMDescription
P_WorkCenterOpDistrPct view from COMPOSITE
P_WrkCtrOpShiftLoadDistr view from COMPOSITE
@AbapCatalog.sqlViewName: 'PWCCAPOPWRKDAYS'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #COMPOSITE
@VDM: {
  private: true
}
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_WrkCtrCapOpWrkDays
  with parameters
    P_StartDate : datum,
    P_EndDate   : datum,
    P_HorizonFlag: char1
  as select from P_WorkCenterCapShiftOp(P_StartDate : $parameters.P_StartDate,
                                            P_EndDate : $parameters.P_EndDate,
                                            P_HorizonFlag:$parameters.P_HorizonFlag) as OperationCapacityPerShift

    inner join   P_WrkCtrAllWrkDayTableFunction(p_sapclient:$session.client,          
                                                      P_fromdate : $parameters.P_StartDate, 
                                                      P_todate : $parameters.P_EndDate,
                                                      P_HorizonFlag: $parameters.P_HorizonFlag) as WorkDays
                                                on  WorkDays.CapacityInternalID   = OperationCapacityPerShift.CapacityInternalID
                                                and WorkDays.CalendarDate       = OperationCapacityPerShift.CalendarDate
{
        key OperationCapacityPerShift.WorkCenterInternalID,
        key OperationCapacityPerShift.WorkCenterTypeCode,
        key OperationCapacityPerShift.CapacityCategoryAllocation,
        key OperationCapacityPerShift.CapacityInternalID,
        key OperationCapacityPerShift.WeekDay,
        key OperationCapacityPerShift.ValidityEndDate,
        key OperationCapacityPerShift.CapacityActiveVersion,
        key OperationCapacityPerShift.AvailableCapacityShift,
        key OperationCapacityPerShift.CapacityRequirement,
        //key OperationCapacityPerShift.Material,

        //key OperationCapacityPerShift.OrderID as OrderID,

        key OperationCapacityPerShift.Operation as Operation,
        key WorkDays.CalendarDate,
        OperationCapacityPerShift.ShiftName,
 //       OperationCapacityPerShift.CapacityRequirement,

        OperationCapacityPerShift.Material,
//        OperationCapacityPerShift.Operation as Operation,

        OperationCapacityPerShift.OrderID as OrderID,
        OperationCapacityPerShift.Plant,
        OperationCapacityPerShift.MRPController, 
        OperationCapacityPerShift.WorkCenter,
        OperationCapacityPerShift.FactoryCalendar,
        WorkDays.CalendarWeek as CalendarWeek,
        WorkDays.CalendarMonth as CalendarMonth,
        WorkDays.CalendarYear as CalendarYear,
        OperationCapacityPerShift.WorkCenterResponsible,
//        OperationCapacityPerShift.WorkCenterDesc,

        OperationCapacityPerShift.WorkCenterCategoryCode,
        OperationCapacityPerShift.FactoryCalendarDate,
//         case when ( ( OperationCapacityPerShift.OpLtstSchedldExecStrtTme <> OperationCapacityPerShift.CapacityStartTime)

//                     and ( OperationCapacityPerShift.OperationLatestStartDate = WorkDays.CalendarDate )

//                     and ( OperationCapacityPerShift.OpLtstSchedldExecStrtTme between OperationCapacityPerShift.CapacityStartTime and OperationCapacityPerShift.CapacityEndTime ) )

//                 then (cast(OperationCapacityPerShift.OpLtstSchedldExecStrtTme as abap.fltp) / cast(3600 as abap.fltp))

//               else

//                    (cast(OperationCapacityPerShift.CapacityStartTime as abap.fltp)/ cast(3600 as abap.fltp))

//         end as OrderExecutionShiftStartTime,

//         case when ( ( OperationCapacityPerShift.OpLtstSchedldExecEndTme <> OperationCapacityPerShift.CapacityEndTime)

//                        and ( OperationCapacityPerShift.OperationLatestEndDate = WorkDays.CalendarDate )

//                        and ( OperationCapacityPerShift.OpLtstSchedldExecEndTme between OperationCapacityPerShift.CapacityStartTime and OperationCapacityPerShift.CapacityEndTime ) )

//                     then (cast(OperationCapacityPerShift.OpLtstSchedldExecEndTme as abap.fltp) / cast(3600 as abap.fltp))            

//                 else

//                    (cast(OperationCapacityPerShift.CapacityEndTime as abap.fltp)/ cast(3600 as abap.fltp))

//         end as OrderExecutionShiftEndTime,

            
//          case when NightSplitDate = 2

//           then DATS_ADD_DAYS(date_series.CalendarDate, -1, 'FAIL')

//           else date_series.CalendarDate

//      end as  FactoryCalendarDate,

      
      case
      when WorkDays.WorkDays = 0 and OperationCapacityPerShift.WorkDayRule = '' or
               OperationCapacityPerShift.WorkDayRule = '0' or
               OperationCapacityPerShift.CapacityEndTime = OperationCapacityPerShift.CapacityStartTime or
               OperationCapacityPerShift.TotOperatingDurationInSeconds = 0
          then 0
      else 
         OperationCapacityPerShift.CalCapacityInParallel
      end  as  CalCapacityInParallel,  
      case
      when WorkDays.WorkDays = 0 and OperationCapacityPerShift.WorkDayRule = '' or
               OperationCapacityPerShift.WorkDayRule = '0' or
               OperationCapacityPerShift.CapacityEndTime = OperationCapacityPerShift.CapacityStartTime or
               OperationCapacityPerShift.TotOperatingDurationInSeconds = 0
          then 0
      else 
         ceil(OperationCapacityPerShift.CalCapacityInParallel)
      end  as  CeiledCalCapInParellel,  
      case
      when WorkDays.WorkDays = 0 and OperationCapacityPerShift.WorkDayRule = '' or
               OperationCapacityPerShift.WorkDayRule = '0' or
               OperationCapacityPerShift.CapacityEndTime = OperationCapacityPerShift.CapacityStartTime or
               OperationCapacityPerShift.TotOperatingDurationInSeconds = 0
          then 0
      else 
         OperationCapacityPerShift.TotOperatingDurationInSeconds
      end  as TotOperatingDurationInSeconds,
       
          cast(OperationCapacityPerShift.CapacityStartTime as abap.fltp) / cast(3600 as abap.fltp) as CapacityStartTime,
          cast(OperationCapacityPerShift.CapacityEndTime as abap.fltp)/ cast(3600 as abap.fltp) as CapacityEndTime,  
          
          case when OperationCapacityPerShift.OperationLatestStartDate = WorkDays.CalendarDate
           then 'X' end    as  isStartDay,

          case when OperationCapacityPerShift.OperationLatestEndDate = WorkDays.CalendarDate
           then 'X' end   as  isEndDay,

//          OperationCapacityPerShift.OperatingDurationInSeconds,


          OperationCapacityPerShift.NightSplitDate,
          OperationCapacityPerShift.AvailableCapacityIntervalDurn,
          //OperationCapacityPerShift.WeekDay,

          OperationCapacityPerShift.WorkDayRule,
          
          OperationCapacityPerShift.CapacityRequirementOrigin,
          OperationCapacityPerShift.CapacityRequirementUnit,
          OperationCapacityPerShift.OrderInternalID,        
          
          OperationCapacityPerShift.OrderType,
          OperationCapacityPerShift.OrderCategory,
          OperationCapacityPerShift.ProductionVersion,
          OperationCapacityPerShift.OrderPlannedTotalQty,
          OperationCapacityPerShift.BaseUnit,
//          OperationCapacityPerShift.OperationPlanningStatusText,

          OperationCapacityPerShift.OperationPlanningStatusCode,
          OperationCapacityPerShift.OperationLatestStartDate,
          OperationCapacityPerShift.OperationLatestStartTime,
          OperationCapacityPerShift.OperationLatestEndDate,
          OperationCapacityPerShift.OperationLatestEndTime, 
          OperationCapacityPerShift.OpLtstSchedldExecStrtTme,
          OperationCapacityPerShift.OpLtstSchedldExecEndTme,
          OperationCapacityPerShift.OpLtstSchedldProcgStrtDte,
          OperationCapacityPerShift.OpLtstSchedldProcgStrtTme,
          OperationCapacityPerShift.OpLtstSchedldTrdwnStrtDte,
          OperationCapacityPerShift.OpLtstSchedldTrdwnStrtTme,
          OperationCapacityPerShift.RemainingCapReqOpSegSetupDurn,
          OperationCapacityPerShift.RemainingCapReqOpSegProcgDurn,
          OperationCapacityPerShift.RemainingCapReqOpSegTrdwnDurn,
          OperationCapacityPerShift.RequirementHours,
          OperationCapacityPerShift.TotRequirementInSeconds,
//          OperationCapacityPerShift.OrderStatusText,

          OperationCapacityPerShift.OrderStatusCode,
          OperationCapacityPerShift.OrderFirmingStatusCode  
}
//where OperationCapacityPerShift.CalendarDate between $parameters.P_StartDate and $parameters.P_EndDate

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