C_SchedProdnProdVersDay

DDL: C_SCHEDPRODNPRODVERSDAY Type: view_entity CONSUMPTION Package: ODATA_PP_CAP_SCHEDPRODN

Production Versions In Day Bucket

C_SchedProdnProdVersDay is a Consumption CDS View that provides data about "Production Versions In Day Bucket" in SAP S/4HANA. It reads from 4 data sources (I_Capacity, I_SchedProdnOperations, I_ProductionVersion, I_WorkCenter) and exposes 44 fields with key fields SimulationSessionID, OrderID, CapacityRequirementItem, CapacityRqmtItemCapacity, OrderCategory. It has 5 associations to related views. Part of development package ODATA_PP_CAP_SCHEDPRODN.

Data Sources (4)

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

Associations (5)

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

Annotations (13)

NameValueLevelField
AccessControl.authorizationCheck #CHECK view
EndUserText.label Production Versions In Day Bucket 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
Search.searchable false view

Fields (44)

KeyFieldSource TableSource FieldDescription
KEY SimulationSessionID I_SchedProdnOperations SimulationSessionID
KEY OrderID I_SchedProdnOperations OrderID
KEY CapacityRequirementItem I_SchedProdnOperations CapacityRequirementItem
KEY CapacityRqmtItemCapacity I_SchedProdnOperations CapacityRqmtItemCapacity
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
SOSTypeDescription _SOSTypeText SOSTypeDescription
ProductionVersionText I_ProductionVersion ProductionVersionText
WorkCenterInternalID I_WorkCenter WorkCenterInternalID
WorkCenterDesc
Operation I_SchedProdnOperations Operation
OperationLatestStartDate I_SchedProdnOperations OperationLatestStartDate
OperationLatestEndDate I_SchedProdnOperations OperationLatestEndDate
OperationLatestStartTime I_SchedProdnOperations OperationLatestStartTime
OperationLatestEndTime I_SchedProdnOperations OperationLatestEndTime
LtstSchedldExecStrtDteTme I_SchedProdnOperations LtstSchedldExecStrtDteTme
LtstSchedldExecEndDteTme I_SchedProdnOperations LtstSchedldExecEndDteTme
SchedldOrdStartDteTme I_SchedProdnOperations SchedldOrdStartDteTme
SchedldOrdEndDteTme I_SchedProdnOperations SchedldOrdEndDteTme
RemainingCapReqExecutionDurn I_SchedProdnOperations RemainingCapReqExecutionDurn
OperationPlanningStatusCode I_SchedProdnOperations OperationPlanningStatusCode
WeekDayName
OperationIsDispatched
RemainingCapacityDurn
ConsumedCapacityDurn
StatusCriticality
PlanningBucketStartDateTime
PlanningBucketEndDateTime
UnitOfMeasure _Uom UnitOfMeasure
UnitOfMeasure_E _Uom UnitOfMeasure_E
OrderCategoryName _OrderCategory OrderCategoryName
BOOExplosionDate I_SchedProdnOperations BOOExplosionDate
BOMExplosionDate I_SchedProdnOperations BOMExplosionDate
PlndOrderPlannedStartDate I_SchedProdnOperations PlndOrderPlannedStartDate
PlndOrderPlannedEndDate I_SchedProdnOperations PlndOrderPlannedEndDate
OrderOperationEndDateTime
OrderOperationStartDateTime
RequirementDateTime
AddressTimeZoneendasPlantTimeZone
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Production Versions In Day Bucket'
@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
@Search.searchable: false
define view entity C_SchedProdnProdVersDay
  //as select from    I_ProductionVersion      as _prodvers

  as select from    I_ProductionVersion      as _prodvers
  //   inner join            I_BOOMaterialAssgmtChangeState as _MaterialTaskList           on  _prodvers.BillOfOperationsGroup   = _MaterialTaskList.BillOfOperationsGroup

  //                                                                                       and _MaterialTaskList.BillOfOperationsType      = _prodvers.BillOfOperationsType

  //                                                                                       and _prodvers.BillOfOperationsVariant = _MaterialTaskList.BillOfOperationsVariant

  //                                                                                       and _MaterialTaskList.IsDeleted = ''

  //      inner join            I_BOOSqncOperationAssgmtChgSt  as _OperationActivities     on  _MaterialTaskList.BillOfOperationsGroup   = _OperationActivities.BillOfOperationsGroup

  //                                                                                       and _MaterialTaskList.BillOfOperationsVariant = _OperationActivities.BillOfOperationsVariant

  //                                                                                       and _OperationActivities.IsDeleted = ''

  //                                                                                       and _OperationActivities.BillOfOperationsType = _prodvers.BillOfOperationsType

  //      inner join            I_BillOfOperationsOpBasic      as _OperationActTasks       on  _MaterialTaskList.BillOfOperationsGroup            = _OperationActTasks.BillOfOperationsGroup

  //                                                                                       and _OperationActivities.BOOSqncOpAssgmtIntVersionCntr = _OperationActTasks.BOOOpInternalVersionCounter

  //                                                                                       and _OperationActTasks.IsDeleted = ''

  //                                                                                       and _OperationActTasks.BillOfOperationsType            = _prodvers.BillOfOperationsType

    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'
  //association [1..*] to

    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
  //                                                       and _order.ProductionVersion = _prodvers.ProductionVersion

  //// association [1..1] to I_Plant as _plant on _Plant.Plant = _order.plant

  // association [0..1] to ppcfs_detail_h as _ppdsdetail on user_name = $session.user

  association [0..1] to I_UnitOfMeasure             as _Uom            on  _Uom.UnitOfMeasure = 'H'
  association [1..1] to I_CalendarDate              as _calenderdate   on  _calenderdate.CalendarDate >= _prodvers.ValidityStartDate
                                                                       and _calenderdate.CalendarDate <= _prodvers.ValidityEndDate
  association [0..1] to C_SchedProdnOrderCategoryVH as _OrderCategory  on  $projection.OrderCategory = _OrderCategory.OrderCategory
  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.CapacityRequirementItem,
  key _order.CapacityRqmtItemCapacity,
  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'
      }
      @ObjectModel: { filter:{ transformedBy: 'ABAP:CL_PPSCH_PRODDAY_FILTER_EXIT'}}
  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,
 //      _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,

       @ObjectModel: { filter:{ transformedBy: 'ABAP:CL_PPSCH_PRODDAY_FILTER_EXIT'}}
      _order.Operation,
      _order.OperationLatestStartDate,
      _order.OperationLatestEndDate,
      _order.OperationLatestStartTime,
      _order.OperationLatestEndTime,
      _order.LtstSchedldExecStrtDteTme,
      _order.LtstSchedldExecEndDteTme,
      _order.SchedldOrdStartDteTme,
      _order.SchedldOrdEndDteTme,
      @Semantics.quantity.unitOfMeasure: 'UnitOfMeasure'
      _order.RemainingCapReqExecutionDurn,
      _order.OperationPlanningStatusCode,
      _calenderdate._WeekDay._Text[1:Language=$session.system_language].WeekDayName as WeekDayName,
      //      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

      @ObjectModel: {virtualElement: true, virtualElementCalculatedBy: 'ABAP:CL_PPSCH_PROPOSAL_DAY_VIRT_ELE', readOnly: true}
      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,

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

      @ObjectModel.readOnly: true
      _Uom.UnitOfMeasure_E,

      @Semantics.text: true
      _OrderCategory.OrderCategoryName,
      _order.BOOExplosionDate,
      _order.BOMExplosionDate,
      _order.PlndOrderPlannedStartDate,
      _order.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
       @ObjectModel: { filter:{ transformedBy: 'ABAP:CL_PPSCH_PRODDAY_FILTER_EXIT'}}
       @Semantics.timeZoneReference: 'PlantTimeZone'
       cast('000000000000000' as timestamp)          as OrderOperationStartDateTime,
       
       @UI.hidden: true
       @ObjectModel: { filter:{ transformedBy: 'ABAP:CL_PPSCH_PRODDAY_FILTER_EXIT'}}
       cast('000000000000000' as timestamp)           as RequirementDateTime,
       
       @Semantics.timeZone: true
//       case 

//       when _WorkCenter._Plant._Address.AddressTimeZone is null  or _WorkCenter._Plant._Address.AddressTimeZone is initial

//       then abap_system_timezone($session.client, 'NULL')

//       when _WorkCenter._Plant._Address.AddressTimeZone is not null

//       then _WorkCenter._Plant._Address.AddressTimeZone

//       end as PlantTimeZone 


       case 
       when _WorkCenter._Plant._StandardOrganizationAddress.AddressTimeZone is null  or _WorkCenter._Plant._StandardOrganizationAddress.AddressTimeZone is initial
       then abap_system_timezone($session.client, 'NULL')
       when _WorkCenter._Plant._StandardOrganizationAddress.AddressTimeZone is not null
       then _WorkCenter._Plant._StandardOrganizationAddress.AddressTimeZone 
       end as PlantTimeZone 
       
//      @ObjectModel: {virtualElement: true, virtualElementCalculatedBy: 'ABAP:Z_TEST_OBJ_NAV_POC', readOnly: true }

//    cast('22' as char2) as DescPoc

      
}
where
     _order.MainProductionLine                          = _order.MainWorkCenter
  and  _order.Operation != ''
  and  _order.StatusCode != 'I0009'
  and(
       _order.OperationIsPhase                            = '0'
    or _order.OperationIsPhase                            = '1'
  )
  and  _order.OrderOperationIsFirstInSqnc = 'X'
  and
          _prodvers.ProductionLine != ' '
  //Already this condition is there in I_SchedWorklistOperation

  //  and  _order.ProductionLine = _order.WorkCenter

  and(
    (
          _order.OrderCategory        =  '1'
      and _order.PlndOrderPlannedStartDate   >= _prodvers.ValidityStartDate
      and _order.PlndOrderPlannedEndDate     <= _prodvers.ValidityEndDate
    )
    or(
          _order.OrderCategory        =  '10'
      and _prodvers.ValidityStartDate <= _order.BOOExplosionDate
      and _order.BOOExplosionDate            <= _prodvers.ValidityEndDate
      and _prodvers.ValidityStartDate <= _order.BOMExplosionDate
      and _order.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 = ' ')
  )
//  and ((OrderID = '000001077951' 

// and  _prodvers.ProductionLine = 'WC_FA_3'

// and _calenderdate.CalendarDate = '20201207') 

// or 

//(//OrderID = '000002851823' and

// OrderID = '000001078183' and

//   _prodvers.ProductionLine = 'TEST_CAP' and _calenderdate.CalendarDate = '20201207')

//   )

//