@AbapCatalog: {
sqlViewName: 'CMFGOOFRI',
compiler.compareFilter: true,
preserveKey: true
}
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Order operation for rework insertion'
@ObjectModel.usageType: {
dataClass: #MIXED,
serviceQuality: #C,
sizeCategory: #L
}
@ClientHandling.algorithm: #SESSION_VARIABLE
@UI.presentationVariant: [{sortOrder: [{by: 'Operation', direction: #ASC }]}]
@VDM.viewType: #CONSUMPTION
define view C_MfgOrdOpForReworkInsertion
as select from I_MfgOrderBasic as MfgOrderBasic
inner join I_OrderOperationBasic as OrderOperationBasic on OrderOperationBasic.OrderInternalID = MfgOrderBasic.OrderInternalID
inner join I_OperationControlProfile as OperationControlProfile on OperationControlProfile.OperationControlProfile = OrderOperationBasic.OperationControlProfile
left outer to one join I_StatusObjectStatusBasic as isDeleted on isDeleted.StatusObject = OrderOperationBasic.ObjectInternalID
and isDeleted.StatusCode = 'I0013'
and isDeleted.StatusIsInactive = '' // OperationIsDeleted
--Join data that is needed if execution is non-serialized
left outer to one join I_StatusObjectStatusBasic as isConfirmed on isConfirmed.StatusObject = OrderOperationBasic.ObjectInternalID
and isConfirmed.StatusCode = 'I0009'
and isConfirmed.StatusIsInactive = '' // OperationIsConfirmed
left outer to one join I_StatusObjectStatusBasic as isPartConf on isPartConf.StatusObject = OrderOperationBasic.ObjectInternalID
and isPartConf.StatusCode = 'I0010'
and isPartConf.StatusIsInactive = '' // OperationIsPartiallyConfirmed
--Join data that is needed if execution is serialized (SFI-based)
left outer join I_ShopFloorItem as ShopFloorItem on ShopFloorItem.ManufacturingOrder = MfgOrderBasic.ManufacturingOrder
left outer to one join C_MfgOrderOpSFIAggrgdStsCat as MfgOrderOpSFIAggrgdStsCat on MfgOrderOpSFIAggrgdStsCat.ShopFloorItem = ShopFloorItem.ShopFloorItem
and MfgOrderOpSFIAggrgdStsCat.OrderInternalID = OrderOperationBasic.OrderInternalID
and MfgOrderOpSFIAggrgdStsCat.OrderOperationInternalID = OrderOperationBasic.OrderOperationInternalID
left outer to one join I_SFIReworkOperation as SFIReworkOperation on SFIReworkOperation.ShopFloorItem = ShopFloorItem.ShopFloorItem
and SFIReworkOperation.OrderInternalID = OrderOperationBasic.OrderInternalID
and SFIReworkOperation.OrderOperationInternalID = OrderOperationBasic.OrderOperationInternalID
association [0..*] to I_SASStatusCategoryText as _Text on $projection.SASStatusCategory = _Text.SASStatusCategory
association [1..1] to I_Plant as _Plant on $projection.Plant = _Plant.Plant
association [0..1] to I_WorkCenter as _WorkCenter on $projection.WorkCenterTypeCode = _WorkCenter.WorkCenterTypeCode
and $projection.WorkCenterInternalID = _WorkCenter.WorkCenterInternalID
association [0..1] to P_OperNmbrOfProdnHolds as _ProductionHold on $projection.OrderInternalID = _ProductionHold.OrderInternalID
and $projection.OrderOperationInternalID = _ProductionHold.OrderOperationInternalID
{
key cast(coalesce(ShopFloorItem.ShopFloorItem,0) as mpe_sfi_id preserving type) as ShopFloorItem,
key OrderOperationBasic.OrderInternalID,
key OrderOperationBasic.OrderOperationInternalID,
MfgOrderBasic.ManufacturingOrderCategory,
MfgOrderBasic.ManufacturingOrderType,
MfgOrderBasic.ProductionPlant,
OrderOperationBasic.OperationControlProfile,
@UI.lineItem: [{position: 10 }]
@ObjectModel.text.element: ['OperationText']
OrderOperationBasic.Operation,
@Semantics.text:true
OrderOperationBasic.OperationText,
@UI.lineItem: [{position: 20 }]
@ObjectModel.text.element: ['PlantName']
OrderOperationBasic.Plant,
_Plant.PlantName,
OrderOperationBasic.WorkCenterTypeCode,
OrderOperationBasic.WorkCenterInternalID,
@UI.lineItem: [{position: 30 }]
_WorkCenter.WorkCenter,
@ObjectModel.text.association: '_Text'
cast(case
when MfgOrderOpSFIAggrgdStsCat.SASStatusCategory is not null then MfgOrderOpSFIAggrgdStsCat.SASStatusCategory
when isConfirmed.StatusCode is not null then 3 --Finally Confirmed mapped to Completed
when isPartConf.StatusCode is not null then 2 --Partially Confirmed mapped to In Process
else 1 --Others mapped to Initial
end as mpe_sas_status_category_type preserving type) as SASStatusCategory,
case when _ProductionHold.OrderInternalID is null then '' else 'X' end as ProductionHoldIsApplied,
// Associations
_Text,
_Plant,
_WorkCenter
}
where
isDeleted.StatusCode is null
and(
--Select all standard operations
OperationControlProfile.OperationIsReworkOperation = ''
--Select all rework operations in non-serialized mode
or ShopFloorItem.ShopFloorItem is null
--In serialized mode select rework operations only if the SFI is assigned to that rework operation
or SFIReworkOperation.ShopFloorItem is not null
)
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"C_MFGORDEROPSFIAGGRGDSTSCAT",
"I_MFGORDERBASIC",
"I_OPERATIONCONTROLPROFILE",
"I_ORDEROPERATIONBASIC",
"I_PLANT",
"I_SFIREWORKOPERATION",
"I_SHOPFLOORITEM",
"I_STATUSOBJECTSTATUSBASIC",
"I_WORKCENTER",
"P_OPERNMBROFPRODNHOLDS"
],
"ASSOCIATED":
[
"I_PLANT",
"I_SASSTATUSCATEGORYTEXT",
"I_WORKCENTER",
"P_OPERNMBROFPRODNHOLDS"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/