C_SchedProdnProdVersShift

DDL: C_SCHEDPRODNPRODVERSSHIFT SQL: CSHPDPRDVRSFT Type: view CONSUMPTION

Production versions in shift bucket

C_SchedProdnProdVersShift is a Consumption CDS View that provides data about "Production versions in shift bucket" in SAP S/4HANA. It reads from 4 data sources (I_Capacity, I_SchedProdnOperations, I_ProductionVersion, I_WorkCenter) and exposes 37 fields with key fields SimulationSessionID, OrderID, CapacityRqmtItemCapacity, CapacityRequirementItem, OrderCategory. It has 4 associations to related views.

Data Sources (4)

SourceAliasJoin Type
I_Capacity _Capacity inner
I_SchedProdnOperations _order left_outer
I_ProductionVersion _prodvers from
I_WorkCenter _WorkCenter inner

Associations (4)

CardinalityTargetAliasCondition
[0..1] I_UnitOfMeasure _Uom _Uom.UnitOfMeasure = 'H'
[1..*] I_CalendarDate _calenderdate _calenderdate.CalendarDate >= _prodvers.ValidityStartDate and _calenderdate.CalendarDate <= _prodvers.ValidityEndDate
[0..*] I_WorkCenterText _WorkCenterText $projection.WorkCenterInternalID = _WorkCenterText.WorkCenterInternalID
[1..1] I_SOSTypeText _SOSTypeText _SOSTypeText.SOSType = 'VERID' and _SOSTypeText.Language = $session.system_language

Annotations (17)

NameValueLevelField
AbapCatalog.sqlViewName CSHPDPRDVRSFT view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #CHECK view
EndUserText.label Production versions in shift bucket view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.viewType #CONSUMPTION view
UI.headerInfo.description.type #STANDARD view
UI.headerInfo.description.value Operationseqno view
UI.headerInfo.title.type #STANDARD view
UI.headerInfo.title.value OrderID view
UI.headerInfo.typeName Available Time Buckets view
UI.headerInfo.typeNamePlural Available Time Buckets view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.serviceQuality #D view
AbapCatalog.preserveKey true view
Search.searchable false view

Fields (37)

KeyFieldSource TableSource FieldDescription
KEY SimulationSessionID I_SchedProdnOperations SimulationSessionID
KEY OrderID I_SchedProdnOperations OrderID
KEY CapacityRqmtItemCapacity I_SchedProdnOperations CapacityRqmtItemCapacity
KEY CapacityRequirementItem I_SchedProdnOperations CapacityRequirementItem
KEY OrderCategory I_SchedProdnOperations OrderCategory
KEY CapacityRequirement I_SchedProdnOperations CapacityRequirement
KEY Product I_ProductionVersion Material
KEY Plant I_ProductionVersion Plant
KEY ProductionVersion I_ProductionVersion ProductionVersion
KEY WorkCenter I_ProductionVersion ProductionLine
KEY CalendarDate _calenderdate CalendarDate
KEY ShiftNumber 0
SOSTypeDescription _SOSTypeText SOSTypeDescription
ProductionVersionText I_ProductionVersion ProductionVersionText
WorkCenterInternalID I_WorkCenter WorkCenterInternalID
WorkCenterDesc
LtstSchedldExecStrtDteTme I_SchedProdnOperations LtstSchedldExecStrtDteTme
LtstSchedldExecEndDteTme I_SchedProdnOperations LtstSchedldExecEndDteTme
OperationPlanningStatusCode I_SchedProdnOperations OperationPlanningStatusCode
WeekDay _calenderdate WeekDay
OperationIsDispatched
RemainingCapacityDurn
ConsumedCapacityDurn
StatusCriticality
PlanningBucketStartDateTime
PlanningBucketEndDateTime
UnitOfMeasure _Uom UnitOfMeasure
UnitOfMeasure_E _Uom UnitOfMeasure_E
BOOExplosionDate BOOExplosionDate
BOMExplosionDate BOMExplosionDate
PlndOrderPlannedStartDate PlndOrderPlannedStartDate
PlndOrderPlannedEndDate PlndOrderPlannedEndDate
OrderOperationEndDateTime
OrderOperationStartDateTime
RequirementDateTime
Operation
AddressTimeZoneendasPlantTimeZone
@AbapCatalog.sqlViewName: 'CSHPDPRDVRSFT'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Production versions in shift bucket'
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.viewType: #CONSUMPTION
@UI.headerInfo: {
    description: { type: #STANDARD, value: 'Operationseqno' },
    title: { type: #STANDARD, value: 'OrderID' },
    typeName: 'Available Time Buckets',
    typeNamePlural: 'Available Time Buckets' }
@ObjectModel.usageType.dataClass:#TRANSACTIONAL
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #D
@AbapCatalog.preserveKey: true
@Search.searchable: false
define view C_SchedProdnProdVersShift as select from I_ProductionVersion      as _prodvers
    inner join      I_WorkCenter             as _WorkCenter on  _WorkCenter.WorkCenterIsToBeDeleted = ''
                                                            and _WorkCenter.WorkCenter              = _prodvers.ProductionLine
                                                            and _WorkCenter.Plant                   = _prodvers.Plant
                                                            and _WorkCenter.WorkCenterTypeCode      = 'A'
    inner join      I_Capacity               as _Capacity   on  _WorkCenter.CapacityInternalID = _Capacity.CapacityInternalID
                                                            and _Capacity.CapacityIsFinite     = 'X'
   left outer join I_SchedProdnOperations as _order      on  _order.Product = _prodvers.Material
                                                            and _order.Plant    = _prodvers.Plant
                                                            
    left outer to one join I_WrkCtrUtilznPrsnlzn as _prsnlzn on _prsnlzn.UserName = $session.user
    
    left outer to one join I_CapPlngWrkCtrGrpRespyArea as _wrkgrpaor on _wrkgrpaor.WorkCenterInternalID = _WorkCenter.WorkCenterInternalID
                                                               and _wrkgrpaor.Plant = _prodvers.Plant
                                                               and _wrkgrpaor.UserID = $session.user
    association [0..1] to I_UnitOfMeasure             as _Uom            on  _Uom.UnitOfMeasure = 'H'
    association [1..*] to I_CalendarDate              as _calenderdate   on  _calenderdate.CalendarDate >= _prodvers.ValidityStartDate
                                                                        and _calenderdate.CalendarDate <= _prodvers.ValidityEndDate
    association [0..*] to I_WorkCenterText            as _WorkCenterText on  $projection.WorkCenterInternalID = _WorkCenterText.WorkCenterInternalID
    association [1..1] to I_SOSTypeText               as _SOSTypeText    on  _SOSTypeText.SOSType  = 'VERID'
                                                                        and _SOSTypeText.Language = $session.system_language
{
  key _order.SimulationSessionID,
  key _order.OrderID,
  key _order.CapacityRqmtItemCapacity,
  key _order.CapacityRequirementItem,
  key _order.OrderCategory,
  key _order.CapacityRequirement,
  @ObjectModel: { filter:{ transformedBy: 'ABAP:CL_PPSCH_PRODDAY_FILTER_EXIT'}}
  key _prodvers.Material                                                                                  as   Product,
  @ObjectModel: { filter:{ transformedBy: 'ABAP:CL_PPSCH_PRODDAY_FILTER_EXIT'}}
  key _prodvers.Plant                                                                                     as   Plant,
      @EndUserText: {
         label:     'Source Of Supply',
         quickInfo: 'Source Of Supply'
      }
  key _prodvers.ProductionVersion                                                                         as   ProductionVersion,
      @EndUserText: {
         label:     'Work Center',
         quickInfo: 'Work Center'
      }
      @ObjectModel: { filter:{ transformedBy: 'ABAP:CL_PPSCH_PRODDAY_FILTER_EXIT'}}
  key _prodvers.ProductionLine                                                                            as   WorkCenter,
  key _calenderdate.CalendarDate,
  @EndUserText: {
         label:     'Shift Number',
         quickInfo: 'Shift Number'
      }
  key 0 as ShiftNumber,
 //      _prodvers.Material as Product,                      

      _SOSTypeText.SOSTypeDescription,
      @EndUserText: {
         label:     'Assign',
         quickInfo: 'Assign'
      }
      cast ( case when _order.ProductionVersion = _prodvers.ProductionVersion
      then cast ('X' as flag)
      end  as flag preserving type )                                                                      as   ProductionVersionIsAssigned,
      _prodvers.ProductionVersionText                                                                     as   ProductionVersionText,
      _WorkCenter.WorkCenterInternalID                                                                    as   WorkCenterInternalID,
      _WorkCenterText[1:Language=$session.system_language].WorkCenterText                                 as   WorkCenterDesc,
     /* _order.Operation,
      _order.OperationLatestStartDate,
      _order.OperationLatestEndDate,
      _order.OperationLatestStartTime,
      _order.OperationLatestEndTime,*/
      _order.LtstSchedldExecStrtDteTme,
      _order.LtstSchedldExecEndDteTme,
      /*_order.SchedldOrdStartDteTme,
      _order.SchedldOrdEndDteTme,*/
      /*@Semantics.quantity.unitOfMeasure: 'UnitOfMeasure'
      RemainingCapReqExecutionDurn,*/
      _order.OperationPlanningStatusCode,
      _calenderdate.WeekDay,
      //      cast( case when _order.OperationPlanningStatusCode = 'DSPT' and _order.ProductionVersion = _prodvers.ProductionVersion and

      //       ( _order.OperationLatestStartDate <= _calenderdate.CalendarDate and _calenderdate.CalendarDate <= _order.OperationLatestEndDate )

      //       then cast ('X' as flag)

      //       end

      
      cast('' as flag preserving type )                                                                   as   OperationIsDispatched,

      @Semantics.quantity.unitOfMeasure: 'UnitOfMeasure'
     // @ObjectModel: {virtualElement: true, virtualElementCalculatedBy: 'ABAP:CL_PPSCH_PROPOSAL_DAY_VIRT_ELE', readOnly: true}

      fltp_to_dec(0.00 as pph_cfs_sch_remaining_cap)                                                      as   RemainingCapacityDurn,

      @Semantics.quantity.unitOfMeasure: 'UnitOfMeasure'
      //@ObjectModel: {virtualElement: true, virtualElementCalculatedBy: 'ABAP:CL_PPSCH_PROPOSAL_DAY_VIRT_ELE', readOnly: true}

      fltp_to_dec(0.00 as pph_cfs_sch_consumed_cap)                                                       as   ConsumedCapacityDurn,

      //@ObjectModel: {virtualElement: true, virtualElementCalculatedBy: 'ABAP:CL_PPSCH_PROPOSAL_DAY_VIRT_ELE', readOnly: true}

      cast(0 as pph_cfs_sch_criticality_status)                                                           as   StatusCriticality,

      //@ObjectModel: {virtualElement: true, virtualElementCalculatedBy: 'ABAP:CL_PPSCH_PROPOSAL_DAY_VIRT_ELE', readOnly: true}

      @Semantics.timeZoneReference: 'PlantTimeZone'
      cast(0 as pph_cfs_sch_bucket_starttmstmp)                                                           as   PlanningBucketStartDateTime,
     // @ObjectModel: {virtualElement: true, virtualElementCalculatedBy: 'ABAP:CL_PPSCH_PROPOSAL_DAY_VIRT_ELE', readOnly: true}

     @Semantics.timeZoneReference: 'PlantTimeZone'
      cast(0 as pph_cfs_sch_bucket_end_tmstmp)                                                            as   PlanningBucketEndDateTime,

      @Semantics.unitOfMeasure: true
      @ObjectModel.readOnly: true
      @ObjectModel: { text.element: ['UnitOfMeasure_E'] }
      _Uom.UnitOfMeasure,

      @ObjectModel.readOnly: true
      _Uom.UnitOfMeasure_E,
      
      BOOExplosionDate,
      BOMExplosionDate,
      PlndOrderPlannedStartDate,
      PlndOrderPlannedEndDate,
        @UI.hidden: true
        @Semantics.timeZoneReference: 'PlantTimeZone'
      @ObjectModel: { filter:{ transformedBy: 'ABAP:CL_PPSCH_PRODDAY_FILTER_EXIT'}}
       cast('000000000000000' as timestamp)          as OrderOperationEndDateTime,

        @UI.hidden: true
        @Semantics.timeZoneReference: 'PlantTimeZone'
      @ObjectModel: { filter:{ transformedBy: 'ABAP:CL_PPSCH_PRODDAY_FILTER_EXIT'}}
       cast('000000000000000' as timestamp)          as OrderOperationStartDateTime,
       
       @UI.hidden: true
      @ObjectModel: { filter:{ transformedBy: 'ABAP:CL_PPSCH_PRODDAY_FILTER_EXIT'}}
       cast('000000000000000' as timestamp)           as RequirementDateTime,
       @UI.hidden: true
      @ObjectModel: { filter:{ transformedBy: 'ABAP:CL_PPSCH_PRODDAY_FILTER_EXIT'}}
       cast('' as vornr) as Operation,
       
       @Semantics.timeZone: true
       case 
       when _WorkCenter._Plant._OrganizationAddress[1: AddressRepresentationCode = '' ].AddressTimeZone is null  or _WorkCenter._Plant._OrganizationAddress[1: AddressRepresentationCode = '' ].AddressTimeZone is initial
       then abap_system_timezone($session.client, 'NULL')
       when _WorkCenter._Plant._OrganizationAddress[1: AddressRepresentationCode = '' ].AddressTimeZone is not null
       then _WorkCenter._Plant._OrganizationAddress[1: AddressRepresentationCode = '' ].AddressTimeZone
       end as PlantTimeZone
      
}
where
     MainProductionLine                          = MainWorkCenter
  and  Operation != ''
  and  StatusCode != 'I0009'
  and(
       OperationIsPhase                            = '0'
    or OperationIsPhase                            = '1'
  )
  and  OrderOperationIsFirstInSqnc = 'X'
  and
          _prodvers.ProductionLine != ' '
  //Already this condition is there in I_SchedWorklistOperation

  //  and  _order.ProductionLine = _order.WorkCenter

  and(
    (
          _order.OrderCategory        =  '1'
      and PlndOrderPlannedStartDate   >= _prodvers.ValidityStartDate
      and PlndOrderPlannedEndDate     <= _prodvers.ValidityEndDate
    )
    or(
          _order.OrderCategory        =  '10'
      and _prodvers.ValidityStartDate <= BOOExplosionDate
      and BOOExplosionDate            <= _prodvers.ValidityEndDate
      and _prodvers.ValidityStartDate <= BOMExplosionDate
      and BOMExplosionDate            <= _prodvers.ValidityEndDate
    )
    or    _order.OrderCategory        =  '40'
  )
  and(
    (_WorkCenter.WorkCenterInternalID = _wrkgrpaor.WorkCenterInternalID and _prodvers.Plant = _wrkgrpaor.Plant and _prsnlzn.WorkCenterGroupRespyAreaIsRqd = 'X')
    or (_prsnlzn.PlantMRPCtrlrRespyAreaIsRqd = 'X')
      or ( _prsnlzn.PlantMRPCtrlrRespyAreaIsRqd = ' ' and _prsnlzn.WorkCenterGroupRespyAreaIsRqd = ' ')
  )