P_WORKCENTERSHIFTDEFINITION

CDS View

P_WORKCENTERSHIFTDEFINITION is a CDS View in S/4HANA. It contains 1 fields. 3 CDS views read from this table.

CDS Views using this table (3)

ViewTypeJoinVDMDescription
P_WorkCenterCapacityDefinition view left_outer COMPOSITE
P_WorkCenterCapacityShiftCalc view left_outer COMPOSITE
P_WrkCtrCapShftDef view from COMPOSITE

Fields (1)

KeyField CDS FieldsUsed in Views
ShiftDefinition ShiftDefinition 1
@AbapCatalog.sqlViewName: 'PWORKCTRSHIFTDEF'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.private: true
@VDM.viewType: #COMPOSITE
@ClientHandling.algorithm: #SESSION_VARIABLE
//@EndUserText.label: 'Work Center Shift Definition'


define view P_WorkCenterShiftDefinition
  as select from I_ShiftDefinition

{
  key ShiftDefinition,
  key ShiftGrouping,
  key ShiftEndDate,

      case when ShiftStartTime = ' ' and ShiftEndTime = ' '
         then cast ( '000000' as abap.tims )
          when ShiftStartTime >= '000000' and ShiftEndTime = ' ' then
          cast ( '240000' as abap.tims )
         else
          ShiftEndTime end                                                                                    as ShiftEndTime,


      //    Shift definition can have start time and end time as blank in the customizing.

      //    Special cases are added to avoid casting of blank values causing issues.

      //    Determine the seconds between midnight and the shift end time

      case when ShiftStartTime = ' ' and ShiftEndTime = ' ' then 000000
           when ShiftStartTime >= '000000' and ShiftEndTime = ' ' then 86400
           when ShiftEndTime = '240000' then 86400
           else cast( cast( substring(ShiftEndTime, 1, 2) as abap.numc(2) ) as abap.int4 ) * 3600 +
                cast( cast( substring(ShiftEndTime, 3, 2) as abap.numc(2) ) as abap.int4 ) * 60   +
                cast( cast( substring(ShiftEndTime, 5, 2) as abap.numc(2) ) as abap.int4 )
      end                                                                                                     as CapacityEndTimeID,

      ShiftStartDate,

      case when ShiftStartTime = ' ' and ShiftEndTime = ' '
      then cast ('000000' as abap.tims )
       when ShiftStartTime = ' ' and ShiftEndTime >= '000000' then
       cast ( '000000' as abap.tims )
      else
      ShiftStartTime end                                                                                      as ShiftStartTime,

      //Determine the seconds between midnight and the shift start time

      case  when ShiftStartTime = ' ' and ShiftEndTime = ' ' then 000000
            when ShiftStartTime = ' ' and ShiftEndTime >= '000000' then 000000
            when ShiftStartTime = '240000' then 86400
           else cast( cast( substring(ShiftStartTime, 1, 2) as abap.numc(2) ) as abap.int4 ) * 3600 +
                cast( cast( substring(ShiftStartTime, 3, 2) as abap.numc(2) ) as abap.int4 ) * 60   +
                cast( cast( substring(ShiftStartTime, 5, 2) as abap.numc(2) ) as abap.int4 )
      end                                                                                                     as CapacityStartTimeID,

      case when ( ShiftStartTime = '' and ShiftEndTime = '' ) or ( ShiftStartTime = '000000' and ShiftEndTime = '000000' )
      then 0
      else
      OperatingDurationInSeconds end                                                                          as OperatingDurationInSeconds,

      ValidityEndDate,

      case when ( ShiftStartTime = '' and ShiftEndTime = '' ) or ( ShiftStartTime = '000000' and ShiftEndTime = '000000' )
      then 0
      else
      sum(_WorkBreakSchedule._WorkBreak[1: WorkBreakSchedule = WorkBreakSchedule].BreakDurationInSeconds) end as BreakDurationInSeconds


}
group by
  ShiftDefinition,
  ShiftEndDate,
  ShiftEndTime,
  ShiftGrouping,
  ShiftStartDate,
  ShiftStartTime,
  //CapacityEndTimeID,

  //CapacityStartTimeID,

  OperatingDurationInSeconds,
  ValidityEndDate
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_SHIFTDEFINITION",
"I_WORKBREAK",
"I_WORKBREAKSCHEDULE"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/