P_SchedProdnOperReln

DDL: P_SCHEDPRODNOPERRELN SQL: PSCHOPRELN Type: view BASIC

P_SchedProdnOperReln is a Basic CDS View in SAP S/4HANA. It reads from 6 data sources and exposes 21 fields with key fields PredecessorInternalID, PredecessorActivityIntID, SuccessorInternalID, SuccessorActivityIntID, MaxTimeIntvlIsUsedForSchedg.

Data Sources (6)

SourceAliasJoin Type
P_SchedProdnPlndOrdReln MaxChangePred inner
I_CapacityRequirementItemCap PredCapReq inner
I_ProjectNetworkRelationship Rel from
plab Rel union
I_CapacityRequirementItemCap SuccCapReq inner
I_CapacityRequirementItemCap SuccCapReq inner

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PSCHOPRELN view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.private true view
VDM.viewType #BASIC view
ObjectModel.usageType.serviceQuality #A view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (21)

KeyFieldSource TableSource FieldDescription
KEY PredecessorInternalID
KEY PredecessorActivityIntID PredecessorNtwkActyIntID
KEY SuccessorInternalID
KEY SuccessorActivityIntID SuccessorNtwkActyIntID
KEY MaxTimeIntvlIsUsedForSchedg MaxTimeIntvlIsUsedForSchedg
KEY RelationshipCounter
ChangeNumberDate
OrderIDassapapoom_orderuidendasPredActID
OrderIDassapapoom_orderuidendasSuccActID
PredGroupCounter I_CapacityRequirementItemCap SuperiorOperationInternalID
plnalasPredecessorInternalID
KEY PredecessorActivityIntID plab plnkn
KEY SuccessorInternalID
KEY SuccessorActivityIntID plab knnrn
KEY MaxTimeIntvlIsUsedForSchedg plab mimax
KEY RelationshipCounter plab zaehl
ChangeNumberDate plab datuv
PredActID P_SchedProdnPlndOrdReln PredActID
SuccActID
PredGroupCounter P_SchedProdnPlndOrdReln PredGroupCounter
SuccGroupCounter I_CapacityRequirementItemCap SuperiorOperationInternalID
@AbapCatalog.sqlViewName: 'PSCHOPRELN'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.private: true
@VDM.viewType: #BASIC
@ObjectModel: {
    usageType: {serviceQuality: #A, sizeCategory: #XL, dataClass: #TRANSACTIONAL }
}
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_SchedProdnOperReln
as select from I_ProjectNetworkRelationship as Rel
inner join I_CapacityRequirementItemCap as PredCapReq on PredCapReq.OrderInternalID = Rel.PredecessorProjNtwkIntID and PredCapReq.OrderOperationInternalID = Rel.PredecessorNtwkActyIntID
inner join I_CapacityRequirementItemCap as SuccCapReq on SuccCapReq.OrderInternalID = Rel.SuccessorProjNtwkIntID and SuccCapReq.OrderOperationInternalID = Rel.SuccessorNtwkActyIntID
 {
    key cast(PredecessorProjNtwkIntID as abap.char( 10 ))  as PredecessorInternalID ,
    key PredecessorNtwkActyIntID                           as PredecessorActivityIntID,
    key cast(SuccessorProjNtwkIntID as abap.char( 10 ))    as SuccessorInternalID,
    key SuccessorNtwkActyIntID                             as SuccessorActivityIntID,
    key 
    case NetworkActivityRelationType // check Include LCNAOBARTOP for constant values

      when 'AF'
        then 0
      when 'SF'
        then 1
      when 'NF'
        then 2
      when 'EF'
        then 3
    end                                                    as LiveCacheRelationType,
    key MaxTimeIntvlIsUsedForSchedg,
    key cast('00000000' as cim_count) as RelationshipCounter,
    cast('00000000' as cim_date) as ChangeNumberDate,
        cast( unit_conversion(
              QUANTITY => NetworkActivityIntmsnDuration,
              SOURCE_UNIT => NetworkActivityIntmsnDurnUnit,
              TARGET_UNIT => cast( 'S' as abap.unit(3) ),
              ERROR_HANDLING => 'SET_TO_NULL' ) as cy_kbeasol ) as IntervalDuration,
    case PredCapReq._Order.OrderCategory
        when '40'
          then cast(concat(PredCapReq.CapacityRequirementItem, concat(PredCapReq.OrderID, '3')) as /sapapo/om_orderuid )
        when '30'
          then cast(concat(PredCapReq.CapacityRequirementItem,concat(PredCapReq.OrderID, '4')) as /sapapo/om_orderuid )
        else
          cast(PredCapReq.OrderID as /sapapo/om_orderuid )
      end as PredActID,
      
    case SuccCapReq._Order.OrderCategory
        when '40'
          then cast(concat(SuccCapReq.CapacityRequirementItem, concat(SuccCapReq.OrderID, '3')) as /sapapo/om_orderuid )
        when '30'
          then cast(concat(SuccCapReq.CapacityRequirementItem,concat(SuccCapReq.OrderID, '4')) as /sapapo/om_orderuid )
        else
          cast(SuccCapReq.OrderID as /sapapo/om_orderuid )
      end as SuccActID,
      
      PredCapReq.SuperiorOperationInternalID as PredGroupCounter,
      SuccCapReq.SuperiorOperationInternalID as SuccGroupCounter
        
}
where ObjectIsDeleted = ''
  and PredecessorProjNtwkIntID = SuccessorProjNtwkIntID and (PredCapReq._Order.OrderCategory = '40' or PredCapReq._Order.OrderCategory = '30')
  and (SuccCapReq._Order.OrderCategory = '40' or SuccCapReq._Order.OrderCategory = '30')
  
  
  union //for planned orders, pick from recipe relation table  

 select from plab as Rel
 inner join P_SchedProdnPlndOrdReln as MaxChangePred on MaxChangePred.plnnr = Rel.plnnr and MaxChangePred.plnal = Rel.plnal and MaxChangePred.plnkn = Rel.plnkn
 and MaxChangePred.plnrn = Rel.plnrn and MaxChangePred.alnrn = Rel.alnrn and MaxChangePred.knnrn = Rel.knnrn
 inner join I_CapacityRequirementItemCap as SuccCapReq on SuccCapReq.BillOfOperationsGroup = Rel.plnrn and SuccCapReq.BillOfOperations = Rel.alnrn and SuccCapReq.BillOfOperationsType = Rel.plnty
 and SuccCapReq.BOOOperationInternalID = Rel.knnrn and SuccCapReq.PlannedOrder = MaxChangePred.PlannedOrder
  {
      key concat( Rel.plnnr , Rel.plnal) as PredecessorInternalID, 
      key Rel.plnkn                  as PredecessorActivityIntID, 
      key concat(Rel.plnrn, Rel.alnrn )  as SuccessorInternalID, 
      key Rel.knnrn                  as SuccessorActivityIntID, 
      key case Rel.aobar  // check Include LCNAOBARTOP for constant values

            when 'AF'
              then 0
            when 'SF'
              then 1
            when 'NF'
              then 2
            when 'EF'
              then 3
          end                    as LiveCacheRelationType, 
      key Rel.mimax                  as MaxTimeIntvlIsUsedForSchedg, 
      key Rel.zaehl as RelationshipCounter, //to do - validities has to be considered

      Rel.datuv as ChangeNumberDate, 
      cast( unit_conversion(
                    QUANTITY => Rel.dauer,
                    SOURCE_UNIT => Rel.zeinh,
                    TARGET_UNIT => cast( 'S' as abap.unit(3) ),
                    ERROR_HANDLING => 'SET_TO_NULL' ) as cy_kbeasol ) as IntervalDuration,
      MaxChangePred.PredActID,
      
    cast(concat(SuccCapReq.CapacityRequirementItem, concat(SuccCapReq.PlannedOrder, '1')) as /sapapo/om_orderuid ) as SuccActID,
      
      MaxChangePred.PredGroupCounter,
      SuccCapReq.SuperiorOperationInternalID as SuccGroupCounter
}
where Rel.loekz = ' '
and Rel.plnnr = Rel.plnrn
and Rel.plnal = Rel.alnrn
and Rel.plnty = '2'
and Rel.datuv = MaxChangePred.MaxChangeNumberDate
and SuccCapReq.PlannedOrder is not null