@AbapCatalog.sqlViewName: 'ICRREFMRCTP'
@AbapCatalog.compiler.compareFilter: true
@EndUserText.label: 'Change Record Reference Object Master Recipe TP'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #TRANSACTIONAL
@ObjectModel: { semanticKey: ['BillOfOperationsType','BillOfOperationsGroup','BillOfOperationsVariant', 'BillOfOperationsMaterial', 'BillOfOperationsPlant', 'BillOfOperationsVersion', 'BillOfOperationsProfile'],
writeDraftPersistence: 'PLMCRREFMRC_D',
createEnabled : 'EXTERNAL_CALCULATION',
deleteEnabled : 'EXTERNAL_CALCULATION',
updateEnabled : 'EXTERNAL_CALCULATION'
}
@AccessControl.personalData.blocking: #REQUIRED
@ObjectModel.usageType: {serviceQuality: #C,
dataClass: #MIXED,
sizeCategory: #L}
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.preserveKey:true
define view I_ChgRecdRefMasterRecipeTP
as select distinct from I_ChgRecdRefMstrRcp as masterRecipeReference
left outer to one join I_BillOfOperations as MasterRecipe on masterRecipeReference.ChgRecRefInternalKey1 = MasterRecipe.BillOfOperationsType
and masterRecipeReference.ChgRecRefInternalKey2 = MasterRecipe.BillOfOperationsGroup
and masterRecipeReference.ChgRecRefInternalKey3 = MasterRecipe.BillOfOperationsVariant
// left outer to one join I_ProductionVersion as ProductVersion on MasterRecipeBOM.Material = ProductVersion.Material
// and MasterRecipeBOM.Plant = ProductVersion.Plant
//
// left outer to one join I_ProductionVersion as MasterRecipeMat on MasterRecipe.BillOfOperationsType = MasterRecipeMat.BillOfOperationsType
// and MasterRecipe.BillOfOperationsGroup = MasterRecipeMat.BillOfOperationsGroup
// and MasterRecipe.BillOfOperationsVariant = MasterRecipeMat.BillOfOperationsVariant
association [1..1] to I_ChangeRecordDraftTP as _ChangeRecordTP on $projection.ChangeRecordUUID = _ChangeRecordTP.ChangeRecordUUID
association [0..1] to E_ChgRecdRefMasterRecipeBsc as _MasterRecipeExtension on $projection.ChangeRecordReferenceUUID = _MasterRecipeExtension.ChangeRecordReferenceUUID
{
key masterRecipeReference.ChangeRecordReferenceUUID,
@ObjectModel.readOnly: 'EXTERNAL_CALCULATION'
case
when MasterRecipe.BillOfOperationsType is null then cast(substring( masterRecipeReference.ChangeRecordReference, 1, 1) as plnty)
else cast(MasterRecipe.BillOfOperationsType as plnty)
end as BillOfOperationsType,
@ObjectModel.readOnly: 'EXTERNAL_CALCULATION'
case
when MasterRecipe.BillOfOperationsGroup is null then cast(substring( masterRecipeReference.ChangeRecordReference, 2, 9) as plnnr)
else cast(MasterRecipe.BillOfOperationsGroup as plnnr)
end as BillOfOperationsGroup,
@ObjectModel.readOnly: 'EXTERNAL_CALCULATION'
case
when MasterRecipe.BillOfOperationsVariant is null then cast (substring( masterRecipeReference.ChangeRecordReference, 10, 11) as plnal)
else cast(MasterRecipe.BillOfOperationsVariant as plnal)
end as BillOfOperationsVariant,
@ObjectModel.readOnly: 'EXTERNAL_CALCULATION'
case
when masterRecipeReference.Material is null then cast(substring( masterRecipeReference.ChangeRecordReference, 12, 51) as matnr)
else cast(masterRecipeReference.Material as matnr) end as BillOfOperationsMaterial,
@ObjectModel.readOnly: 'EXTERNAL_CALCULATION'
case
when masterRecipeReference.Plant is null then cast(substring( masterRecipeReference.ChangeRecordReference, 52, 55) as werks_d)
else cast(masterRecipeReference.Plant as werks_d) end as BillOfOperationsPlant,
@ObjectModel.readOnly: 'EXTERNAL_CALCULATION'
case
when masterRecipeReference.ProductionVersion is null then cast(substring(masterRecipeReference.ChangeRecordReference, 56, 59) as verid)
else cast(masterRecipeReference.ProductionVersion as verid) end as BillOfOperationsVersion,
@ObjectModel.readOnly: 'EXTERNAL_CALCULATION'
case
when MasterRecipe._BillOfOperationsChangeState.BillOfOperationsProfile is null then cast(substring(masterRecipeReference.ChangeRecordReference, 60, 66) as profid_std)
else cast(MasterRecipe._BillOfOperationsChangeState.BillOfOperationsProfile as profid_std) end as BillOfOperationsProfile,
// deprecated, should not be used
cast ('00000000' as cim_count ) as BOOInternalVersionCounter,
// deprecated, should not be used
cast ('00000000' as plantext ) as BillOfOperationsDesc,
masterRecipeReference.ChangeRecordUUID,
masterRecipeReference.ChangeRecordReferenceType,
masterRecipeReference.ChangeRecordReferenceSubtype,
masterRecipeReference.ChangeRecordRefObjectUUID,
masterRecipeReference.ChangeRecordReference,
masterRecipeReference.ParentChangeRecordRefUUID,
masterRecipeReference.IsMainReference,
ChgRecdReasonForChange,
ExpdCompltnDte,
ChgRecdAuthznGrpText,
ChgRecdNmbrChgSts,
@Semantics.user.createdBy: true
@ObjectModel.readOnly: true
masterRecipeReference.CreatedByUser,
masterRecipeReference.CreationDateTime,
@Semantics.user.lastChangedBy: true
@ObjectModel.readOnly: true
masterRecipeReference.LastChangedByUser,
masterRecipeReference.LastChangeDateTime,
@ObjectModel.readOnly: 'EXTERNAL_CALCULATION'
masterRecipeReference.ChangeRecordItemRelevance,
masterRecipeReference.ChangeRecordVirtualRefInd,
@ObjectModel.readOnly: 'EXTERNAL_CALCULATION'
masterRecipeReference.ChangeRecordItemProcgStatus,
@ObjectModel.readOnly: true
masterRecipeReference.ChgRecdCurrentItemProcgStatus,
masterRecipeReference.ChangeNumber,
@ObjectModel.readOnly: true
masterRecipeReference.ChgRecdItmTgtSts,
@ObjectModel.readOnly: true
masterRecipeReference.ChgRecdItmDSgntr,
@ObjectModel.readOnly: true
masterRecipeReference.ChangeRecordLifecycleStatus,
@ObjectModel.readOnly: true
masterRecipeReference.ChangeRecordStatus,
@ObjectModel.association.type: [ #TO_COMPOSITION_PARENT, #TO_COMPOSITION_ROOT ]
_ChangeRecordTP
}
where
MasterRecipe.BillOfOperationsType = '2'
or MasterRecipe.BillOfOperationsType is null
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_BILLOFOPERATIONS",
"I_BILLOFOPERATIONSCHANGESTATE",
"I_CHGRECDREFMSTRRCP"
],
"ASSOCIATED":
[
"E_CHGRECDREFMASTERRECIPEBSC",
"I_CHANGERECORDDRAFTTP"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/