P_OpActyBackflushByOrigComp is a Composite CDS View in SAP S/4HANA. It reads from 3 data sources (I_OpActyComponentAssignment, I_OpActyInstanceStatus, I_ReservationItem) and exposes 9 fields with key fields Reservation, CurrentReservationItem, CurrentRecordType, CurrentOpActyNtwkInstance, CurrentOpActyNtwkElement. It has 1 association to related views.
@AbapCatalog.sqlViewName: 'PMPEORDOCOMPBCKF'
@AbapCatalog.compiler.compareFilter: true@AbapCatalog.preserveKey: true@AccessControl.authorizationCheck: #NOT_REQUIRED@ClientHandling.algorithm: #SESSION_VARIABLE@ObjectModel.usageType: {serviceQuality: #B, sizeCategory: #XL, dataClass: #TRANSACTIONAL}@VDM.viewType: #COMPOSITE@VDM.private: truedefineview P_OpActyBackflushByOrigComp
asselectfrom I_OpActyInstanceStatus as OpActyInstanceStatus
innerjoin I_OpActyComponentAssignment as OpActyComponentAssignment on OpActyComponentAssignment.OpActyNtwkInstance = OpActyInstanceStatus.OpActyNtwkInstance
and OpActyComponentAssignment.OpActyNtwkElement = OpActyInstanceStatus.OpActyNtwkElement
innerjoin I_ReservationItem as ReservationItem on ReservationItem.Reservation = OpActyComponentAssignment.Reservation
and ReservationItem.ReservationItem = OpActyComponentAssignment.ReservationItem
and ReservationItem.RecordType = OpActyComponentAssignment.RecordType
leftouter to one join I_ReservationItem as LeadingReservationItem on LeadingReservationItem.Reservation = OpActyComponentAssignment.LeadingReservation
and LeadingReservationItem.ReservationItem = OpActyComponentAssignment.LeadingReservationItem
and LeadingReservationItem.RecordType = OpActyComponentAssignment.LeadingReservationRecordType
association [1..1] to I_MfgOrder as _MfgOrder on $projection.ManufacturingOrder = _MfgOrder.ManufacturingOrder
{
--For the time being Related Reservations are alway in the same order
--> Thus, they have same ManufacturingOrder and Reservation
key ReservationItem.ReferenceOrder as ManufacturingOrder,
key OpActyComponentAssignment.Reservation,
key OpActyComponentAssignment.ReservationItem as CurrentReservationItem,
key OpActyComponentAssignment.RecordType as CurrentRecordType,
key OpActyComponentAssignment.OpActyNtwkInstance as CurrentOpActyNtwkInstance,
key OpActyComponentAssignment.OpActyNtwkElement as CurrentOpActyNtwkElement,
cast(casewhen OpActyComponentAssignment.LeadingReservation = '0000000000' then OpActyComponentAssignment.ReservationItem
else OpActyComponentAssignment.LeadingReservationItem
endas rspos preserving type ) as ReservationItem,
cast(casewhen OpActyComponentAssignment.LeadingReservation = '0000000000' then OpActyComponentAssignment.RecordType
else OpActyComponentAssignment.LeadingReservationRecordType
endas rsart preserving type ) as RecordType,
cast(casewhen OpActyComponentAssignment.LeadingReservation = '0000000000' then OpActyComponentAssignment.OpActyNtwkInstance
else OpActyComponentAssignment.LeadingOpActyNtwkInstance
endas mpe_oan_instance_id preserving type ) as OpActyNtwkInstance,
cast(casewhen OpActyComponentAssignment.LeadingReservation = '0000000000' then OpActyComponentAssignment.OpActyNtwkElement
else OpActyComponentAssignment.LeadingOpActyNtwkElement
endas mpe_oan_element_number preserving type ) as OpActyNtwkElement,
cast(case ReservationItem.DebitCreditCode
when 'S' then round(fltp_to_dec( OpActyComponentAssignment.MfgOrderComponentUsageNetQty asabap.dec(13,4) ), 3) * -1
else round(fltp_to_dec( OpActyComponentAssignment.MfgOrderComponentUsageNetQty asabap.dec(13,4) ), 3)
endas kmpmg ) as MfgOrdCompUsageNetQtyWithSign,
@Semantics.unitOfMeasure: true
ReservationItem.BaseUnit as MaterialBaseUnit,
cast(casewhen OpActyComponentAssignment.LeadingReservation = '0000000000' then ReservationItem.DebitCreditCode
else LeadingReservationItem.DebitCreditCode
endas shkzg preserving type ) as DebitCreditCode,
OpActyComponentAssignment.BOOOpBOMItemInternalID,
_MfgOrder
}
where
OpActyInstanceStatus._SASStatus.SASStatusCategory = 3 --Completed
and ReservationItem.MatlCompIsMarkedForBackflush = 'X'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_OPACTYCOMPONENTASSIGNMENT",
"I_OPACTYINSTANCESTATUS",
"I_RESERVATIONITEM",
"I_SASSTATUS"
],
"ASSOCIATED":
[
"I_MFGORDER"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/