P_MfgOrderOriglComponentAssy is a Composite CDS View in SAP S/4HANA. It reads from 3 data sources (I_MfgOrderComponentAssembly, I_OpActyComponentAssignment, I_ReservationItem) and exposes 23 fields with key fields AssemblyDocument, AssemblyDocumentItem. It has 2 associations to related views.
@AbapCatalog.sqlViewName: 'PMPEORIGCOMPASSY'
@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_MfgOrderOriglComponentAssy
asselectfrom I_MfgOrderComponentAssembly as MfgOrderComponentAssembly
innerjoin I_OpActyComponentAssignment as OpActyComponentAssignment on OpActyComponentAssignment.Reservation = MfgOrderComponentAssembly.Reservation
and OpActyComponentAssignment.ReservationItem = MfgOrderComponentAssembly.ReservationItem
and OpActyComponentAssignment.RecordType = MfgOrderComponentAssembly.RecordType
and OpActyComponentAssignment.OpActyNtwkInstance = MfgOrderComponentAssembly.OpActyNtwkInstance
and OpActyComponentAssignment.OpActyNtwkElement = MfgOrderComponentAssembly.OpActyNtwkElement
innerjoin I_ReservationItem as ReservationItem on ReservationItem.Reservation = MfgOrderComponentAssembly.Reservation
and ReservationItem.ReservationItem = MfgOrderComponentAssembly.ReservationItem
and ReservationItem.RecordType = MfgOrderComponentAssembly.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
association [0..1] to I_DebitCreditCode as _DebitCreditCode on $projection.DebitCreditCode = _DebitCreditCode.DebitCreditCode
{
//MfgOrderComponentAssembly
key MfgOrderComponentAssembly.AssemblyDocument,
key MfgOrderComponentAssembly.AssemblyDocumentItem,
--For the time being Related Reservations are alway in the same order
--> Thus, they have same ManufacturingOrder and Reservation
ReservationItem.ReferenceOrder as ManufacturingOrder,
MfgOrderComponentAssembly.Reservation,
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,
MfgOrderComponentAssembly.AssemblyShopFloorItem,
MfgOrderComponentAssembly.ShopFloorItem,
MfgOrderComponentAssembly.Batch,
MfgOrderComponentAssembly.Material,
@Semantics.quantity.unitOfMeasure: 'MaterialBaseUnit'
case ReservationItem.DebitCreditCode
when 'S' then MfgOrderComponentAssembly.MaterialComponentQuantity * -1
else MfgOrderComponentAssembly.MaterialComponentQuantity
endas MaterialComponentQuantity,
@Semantics.unitOfMeasure: true
MfgOrderComponentAssembly.MaterialBaseUnit,
cast(casewhen OpActyComponentAssignment.LeadingReservation = '0000000000' then ReservationItem.DebitCreditCode
else LeadingReservationItem.DebitCreditCode
endas shkzg preserving type ) as DebitCreditCode,
MfgOrderComponentAssembly.CreationDateTime,
MfgOrderComponentAssembly.CreatedByUser,
MfgOrderComponentAssembly.Plant,
MfgOrderComponentAssembly.StorageLocation,
OpActyComponentAssignment.BOOOpBOMItemInternalID,
_MfgOrder,
MfgOrderComponentAssembly._Material,
MfgOrderComponentAssembly._MaterialBaseUnit,
MfgOrderComponentAssembly._ParentShopFloorItem,
MfgOrderComponentAssembly._Plant,
MfgOrderComponentAssembly._Reservation,
MfgOrderComponentAssembly._ShopFloorItem,
MfgOrderComponentAssembly._StorageLocation,
_DebitCreditCode
}
where
ReservationItem.MatlCompIsMarkedForBackflush = ''
and OpActyComponentAssignment.MatlCompInstceAssyIsRequired = ''