@AbapCatalog.sqlViewName: 'PMPEOACOMPUNION'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType: {serviceQuality: #B, sizeCategory: #XL, dataClass: #CUSTOMIZING}
@VDM.viewType: #CONSUMPTION
@VDM.private: true
define view P_OperationActivityCompUnion
as select from I_OpActyComponentAssignment as OpActyComponentAssignment
inner join I_MfgOrderOperationComponent as MfgOrderOperationComponent on MfgOrderOperationComponent.Reservation = OpActyComponentAssignment.Reservation
and MfgOrderOperationComponent.ReservationItem = OpActyComponentAssignment.ReservationItem
and MfgOrderOperationComponent.RecordType = OpActyComponentAssignment.RecordType
inner join I_OrderOperation as OrderOperation on OrderOperation.OrderInternalID = MfgOrderOperationComponent.OrderInternalBillOfOperations
and OrderOperation.OrderOperationInternalID = MfgOrderOperationComponent.OrderIntBillOfOperationsItem
inner join I_EAMMaterialItemCategory as MaterialItemCategory on MfgOrderOperationComponent.BOMItemCategory = MaterialItemCategory.BOMItemCategory
left outer to one join I_StatusObjectStatusBasic as IsCreatedBySplit on IsCreatedBySplit.StatusObject = MfgOrderOperationComponent.ObjectInternalID
and IsCreatedBySplit.StatusCode = 'I0487'
and IsCreatedBySplit.StatusIsInactive = ''
association [0..1] to I_OpActyAssemblyByComponent as _OpActyAssemblyByComponent on $projection.Reservation = _OpActyAssemblyByComponent.Reservation
and $projection.ReservationItem = _OpActyAssemblyByComponent.ReservationItem
and $projection.RecordType = _OpActyAssemblyByComponent.RecordType
and $projection.OpActyNtwkInstance = _OpActyAssemblyByComponent.OpActyNtwkInstance
and $projection.OpActyNtwkElement = _OpActyAssemblyByComponent.OpActyNtwkElement
and $projection.Material = _OpActyAssemblyByComponent.Material
and $projection.Plant = _OpActyAssemblyByComponent.Plant
{
key OpActyComponentAssignment.OpActyNtwkInstance,
key OpActyComponentAssignment.OpActyNtwkElement,
key MfgOrderOperationComponent.Reservation,
key MfgOrderOperationComponent.ReservationItem,
key MfgOrderOperationComponent.RecordType,
key MfgOrderOperationComponent.Material,
key MfgOrderOperationComponent.Plant,
MfgOrderOperationComponent.StorageLocation,
MfgOrderOperationComponent.ProductionPlant,
OpActyComponentAssignment.AssemblySequenceNumber,
MfgOrderOperationComponent.BaseUnit,
OpActyComponentAssignment.MfgOrderComponentUsageQuantity, --PlannedQuantity
case MfgOrderOperationComponent.QuantityIsFixed
when 'X' then OpActyComponentAssignment.MfgOrderComponentUsageQuantity
else cast( OrderOperation.OpPlannedTotalQuantity * OrderOperation.OpQtyToBaseQtyNmrtr as esmng )
/ cast( OrderOperation.OpQtyToBaseQtyDnmntr as esmng )
* OpActyComponentAssignment.MfgOrderComponentUsageNetQty
end as RequiredQuantity,
_OpActyAssemblyByComponent.MaterialComponentQuantity, --ConsumedQuantity
_OpActyAssemblyByComponent.QuantityInEntryUnit,
_OpActyAssemblyByComponent.EntryUnit,
cast( MfgOrderOperationComponent.IsBulkMaterialComponent as boolean preserving type ) as IsBulkMaterialComponent,
cast( MfgOrderOperationComponent.MatlCompIsMarkedForBackflush as boolean preserving type ) as MatlCompIsMarkedForBackflush,
MfgOrderOperationComponent.GoodsMovementIsAllowed,
MfgOrderOperationComponent.MaterialComponentIsMissing,
MfgOrderOperationComponent.ReservationIsFinallyIssued,
MfgOrderOperationComponent.MatlCompDiscontinuationType,
-- Variable-Size Item Fields
MfgOrderOperationComponent.MaterialCompIsVariableSized,
MfgOrderOperationComponent.VariableSizeItemUnit,
MfgOrderOperationComponent.FormulaKey,
MfgOrderOperationComponent.VariableSizeDimension1,
MfgOrderOperationComponent.VariableSizeDimension2,
MfgOrderOperationComponent.VariableSizeDimension3,
MfgOrderOperationComponent.VariableSizeDimensionUnit,
MfgOrderOperationComponent.VariableSizeComponentQuantity,
MfgOrderOperationComponent.VariableSizeComponentUnit,
-- Related / Leading Reservations
OpActyComponentAssignment.RelatedReservation,
OpActyComponentAssignment.RelatedReservationItem,
OpActyComponentAssignment.RelatedRecordType,
OpActyComponentAssignment.RelatedOpActyNtwkInstance,
OpActyComponentAssignment.RelatedOpActyNtwkElement,
OpActyComponentAssignment.LeadingReservation,
OpActyComponentAssignment.LeadingReservationItem,
OpActyComponentAssignment.LeadingReservationRecordType,
OpActyComponentAssignment.LeadingOpActyNtwkInstance,
OpActyComponentAssignment.LeadingOpActyNtwkElement,
-- Additional data needed for corresponding association
MfgOrderOperationComponent.BillOfMaterialCategory,
MfgOrderOperationComponent.BillOfMaterial,
MfgOrderOperationComponent.BOMItem,
MfgOrderOperationComponent.BOMItemInternalChangeCount,
MfgOrderOperationComponent.BillOfMaterialInternalID,
MfgOrderOperationComponent.BillOfMaterialVariant,
MfgOrderOperationComponent.BillOfMaterialVersion,
MfgOrderOperationComponent.InheritedBOMItemNode,
MfgOrderOperationComponent.BOMItemCategory,
-- MfgOrderOperationComponent._BillOfMaterialItem.BillOfMaterialItemUUID,
-- MfgOrderOperationComponent._MfgOrderOperation.BillOfOperationsType,
-- MfgOrderOperationComponent._MfgOrderOperation.BillOfOperationsGroup,
OpActyComponentAssignment.BOOOpBOMItemInternalID,
OpActyComponentAssignment.LogicalComponent,
OpActyComponentAssignment.MfgRefStrucBOMLeafAssgmtUUID,
OpActyComponentAssignment.MfgRefStructureItemDetailUUID,
OpActyComponentAssignment.MfgRefStrucItmDetIsContextual,
OpActyComponentAssignment.MatlCompInstceAssyIsRequired
}
where
MfgOrderOperationComponent.DebitCreditCode = 'H'
and MfgOrderOperationComponent.RequiredQuantity <> 0
and IsCreatedBySplit.StatusCode is null
and MaterialItemCategory.ItemCatRequiresMaterialEntry = '+'
union all
select from I_OpActyAssemblyByComponent as Agg
{
key Agg.OpActyNtwkInstance,
key Agg.OpActyNtwkElement,
key Agg.Reservation,
key Agg.ReservationItem,
key Agg.RecordType,
key Agg.Material,
key Agg.Plant,
cast(' ' as pph_lgort preserving type) as StorageLocation,
cast(' ' as pwwrk preserving type) as ProductionPlant,
cast('0000' as mpe_rtgv_proc_seq_no preserving type) as AssemblySequenceNumber,
Agg.MaterialBaseUnit as BaseUnit,
cast(0 as esmng) as MfgOrderComponentUsageQuantity, --PlannedQuantity
Agg.RequiredQuantity,
Agg.MaterialComponentQuantity, --ConsumedQuantity
Agg.QuantityInEntryUnit,
Agg.EntryUnit,
cast('' as boolean preserving type ) as IsBulkMaterialComponent,
cast('' as boolean preserving type ) as MatlCompIsMarkedForBackflush,
cast('X' as xwaok preserving type ) as GoodsMovementIsAllowed,
cast('' as xfehl preserving type) as MaterialComponentIsMissing,
cast('' as kzear preserving type) as ReservationIsFinallyIssued,
cast('' as auslf preserving type ) as MatlCompDiscontinuationType,
-- Variable-Size Item Fields
cast('' as rohps preserving type) as MaterialCompIsVariableSized,
cast('' as vdm_roame) as VariableSizeItemUnit,
cast(' ' as rform preserving type) as FormulaKey,
cast(0 as roms1) as VariableSizeDimension1,
cast(0 as roms2) as VariableSizeDimension2,
cast(0 as roms3) as VariableSizeDimension3,
cast('' as romei) as VariableSizeDimensionUnit,
cast(0 as pph_romen) as VariableSizeComponentQuantity,
cast('' as pph_rokme) as VariableSizeComponentUnit,
-- Related / Leading Reservations
cast('0000000000' as rsnum preserving type ) as RelatedReservation,
cast('0000' as rspos preserving type ) as RelatedReservationItem,
cast('' as rsart preserving type ) as RelatedRecordType,
cast(0 as mpe_oan_instance_id ) as RelatedOpActyNtwkInstance,
cast(0 as mpe_oan_element_number ) as RelatedOpActyNtwkElement,
cast('0000000000' as rsnum preserving type ) as LeadingReservation,
cast('0000' as rspos preserving type ) as LeadingReservationItem,
cast('' as rsart preserving type ) as LeadingReservationRecordType,
cast(0 as mpe_oan_instance_id ) as LeadingOpActyNtwkInstance,
cast(0 as mpe_oan_element_number ) as LeadingOpActyNtwkElement,
cast('' as pph_stlty preserving type) as BillOfMaterialCategory,
cast(' ' as stnum preserving type) as BillOfMaterial,
cast('00000000' as pph_stlkn preserving type) as BOMItem,
cast('00000000' as cim_count preserving type) as BOMItemInternalChangeCount,
cast(' ' as stnum preserving type) as BillOfMaterialInternalID,
cast( ' ' as stalt ) as BillOfMaterialVariant,
cast( ' ' as cim_bom_versn) as BillOfMaterialVersion,
cast(' ' as kntnr) as InheritedBOMItemNode,
cast('' as pph_postp preserving type) as BOMItemCategory,
-- cast(hextobin( '00000000000000000000000000000000' ) as cs_guid preserving type) as BillOfMaterialItemUUID,
-- cast('' as plnty preserving type) as BillOfOperationsType,
-- cast('' as plnnr) as BillOfOperationsGroup,
cast('00000000' as cim_zuord preserving type) as BOOOpBOMItemInternalID,
cast(0 as mpe_log_comp_counter) as LogicalComponent,
cast(hextobin('00000000000000000000000000000000') as mpe_mrs_leaf_assignment_uuid preserving type) as MfgRefStrucBOMLeafAssgmtUUID,
cast(hextobin('00000000000000000000000000000000') as mpe_mrs_leaf_assignment_uuid preserving type) as MfgRefStructureItemDetailUUID,
cast('' as xfeld preserving type) as MfgRefStrucItmDetIsContextual,
cast('' as mpe_instce_assembly_rqd preserving type) as MatlCompInstceAssyIsRequired
}
where
Agg.Reservation = '0000000000' --Unplanned Assemblies
and MaterialComponentQuantity <> 0
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_EAMMATERIALITEMCATEGORY",
"I_MFGORDEROPERATIONCOMPONENT",
"I_OPACTYASSEMBLYBYCOMPONENT",
"I_OPACTYCOMPONENTASSIGNMENT",
"I_ORDEROPERATION",
"I_STATUSOBJECTSTATUSBASIC"
],
"ASSOCIATED":
[
"I_OPACTYASSEMBLYBYCOMPONENT"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/