P_CapacityHeaderDef

DDL: P_CAPACITYHEADERDEF SQL: PCAPHDRDEF Type: view COMPOSITE

P_CapacityHeaderDef is a Composite CDS View in SAP S/4HANA. It reads from 1 data source (I_Capacity) and exposes 15 fields with key field CapacityInternalID.

Data Sources (1)

SourceAliasJoin Type
I_Capacity Capacity from

Annotations (7)

NameValueLevelField
AbapCatalog.sqlViewName PCAPHDRDEF view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.private true view
VDM.viewType #COMPOSITE view
ClientHandling.algorithm #SESSION_VARIABLE view
AbapCatalog.preserveKey true view

Fields (15)

KeyFieldSource TableSource FieldDescription
KEY CapacityInternalID I_Capacity CapacityInternalID
Plant I_Capacity Plant
FactoryCalendarendasFactoryCalendar
CapacityStartTime I_Capacity CapacityStartTime
CapacityEndTime I_Capacity CapacityEndTime
CapacityNumberOfCapacities I_Capacity CapacityNumberOfCapacities
CapacityPlanUtilizationPercent I_Capacity CapacityPlanUtilizationPercent
CapacityBreakDuration I_Capacity CapacityBreakDuration
CapacityCategoryCode I_Capacity CapacityCategoryCode
CapacityCategoryName
Capacity I_Capacity Capacity
CapacityResponsiblePlanner I_Capacity CapacityResponsiblePlanner
ShiftGroup I_Capacity ShiftGroup
CapacityActiveVersion I_Capacity CapacityActiveVersion
CapacityIsPooled I_Capacity CapacityIsPooled
@AbapCatalog.sqlViewName: 'PCAPHDRDEF'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.private: true
@VDM.viewType:#COMPOSITE
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.preserveKey:true 
//@EndUserText.label: 'Work Center Header Capacity Definition'


define view P_CapacityHeaderDef
  //      as select from I_WorkCenterCapacity as WorkCenterCapacity

  as select from I_Capacity as Capacity
  //       as select from I_WorkCenterCapAlloc as WorkCenterCapacity

  //       association [1..1] to I_WorkCenter  as _WorkCenter on  $projection.WorkCenterTypeCode   = _WorkCenter.WorkCenterTypeCode

  //                                                                      and $projection.WorkCenterInternalID = _WorkCenter.WorkCenterInternalID

  //       association [1..1] to I_Capacity   as _Capacity   on  $projection.CapacityInternalID = _Capacity.CapacityInternalID

  //       association [1..1] to I_CapacityCategory        as _CapacityCategory        on  $projection.CapacityCategoryCode = _CapacityCategory.CapacityCategoryCode


{
      // key WorkCenterCapacity.WorkCenterInternalID                              as WorkCenterInternalID,

      // key WorkCenterCapacity.WorkCenterTypeCode                                as WorkCenterTypeCode,

      // key WorkCenterCapacity.CapacityCategoryAllocation                        as CapacityCategoryAllocation,

  key Capacity.CapacityInternalID                                                                as CapacityInternalID,
      //  _WorkCenter.WorkCenter                                                   as WorkCenter,

      //  _WorkCenter.Plant                                                        as Plant,

      Capacity.Plant,
      //   case when Capacity.FactoryCalendar = ''

      //      then Capacity._Plant.FactoryCalendar

      //      else Capacity.FactoryCalendar end                       as FactoryCalendar,


      case when Capacity.FactoryCalendar = ''
         then Capacity._Plant.FactoryCalendar
         when Capacity.FactoryCalendar <> ''
          then Capacity.FactoryCalendar
         end                                                                                     as FactoryCalendar,

      //      _WorkCenter.WorkCenterResponsible                        as WorkCenterResponsible,

      //      _WorkCenter._Text[1:Language=$session.system_language].WorkCenterText as WorkCenterDesc,

      //      _WorkCenter.WorkCenterCategoryCode                       as WorkCenterCategoryCode,

      Capacity.CapacityStartTime                                                                 as CapacityStartTime,
      Capacity.CapacityEndTime                                                                   as CapacityEndTime,
      Capacity.CapacityNumberOfCapacities                                                        as CapacityNumberOfCapacities,
      Capacity.CapacityPlanUtilizationPercent                                                    as CapacityPlanUtilizationPercent,
      Capacity.CapacityBreakDuration                                                             as CapacityBreakDuration,

      Capacity.CapacityCategoryCode                                                              as CapacityCategoryCode,
      Capacity._CapacityCategory._Text[1:Language=$session.system_language].CapacityCategoryName as CapacityCategoryName,
      Capacity.Capacity                                                                          as Capacity,
      //      WorkCenterCapacity._Capacity._Text[1:Language=$session.system_language].CapacityText    as CapacityText,

      Capacity.CapacityResponsiblePlanner                                                        as CapacityResponsiblePlanner,

      //      // Pass maximum opening hours

      //      case when Capacity.CapacityEndTime > Capacity.CapacityStartTime or Capacity.CapacityStartTime = 0

      //      // Normal shift, operating duration without break

      //        then Capacity.CapacityEndTime - Capacity.CapacityStartTime

      //      // Night shift, add 24 hours

      //        else Capacity.CapacityEndTime - Capacity.CapacityStartTime + (24*3600)

      //      end                                                               as OperatingDurationWithoutBreak,


      // Pass maximum opening hours

      case when Capacity.CapacityEndTime > Capacity.CapacityStartTime or Capacity.CapacityStartTime = 0
      // Normal shift, operating duration without break

        then Capacity.CapacityEndTime - Capacity.CapacityStartTime
      // Night shift, add 24 hours

        when Capacity.CapacityEndTime <= Capacity.CapacityStartTime
         then Capacity.CapacityEndTime - Capacity.CapacityStartTime + (24*3600)
      end                                                                                        as OperatingDurationWithoutBreak,
      //    Derive the factory calendar. Fall back to factory calandar of plant,

      //    if factory calendar at work center level is not maintained


      Capacity.ShiftGroup                                                                        as ShiftGroup,
      Capacity.CapacityActiveVersion                                                             as CapacityActiveVersion,
      Capacity.CapacityIsPooled                                                                  as CapacityIsPooled
}

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