@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