@EndUserText.label: 'Maintenance Notification Item'
--@Analytics: { dataCategory: #DIMENSION }
@VDM.viewType: #BASIC
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #NOT_REQUIRED
@AbapCatalog.sqlViewName: 'IMAINTNOTIFITEM'
@ObjectModel.representativeKey: 'MaintenanceNotificationItem'
@ObjectModel.semanticKey: [ 'MaintenanceNotificationItem','MaintenanceNotification' ]
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@ObjectModel.usageType.serviceQuality: #A
@ObjectModel.usageType.sizeCategory: #L
define view I_MaintenanceNotificationItem as select from qmfe
association[1..1] to I_MaintenanceNotification as _MaintenanceNotification on $projection.MaintenanceNotification = _MaintenanceNotification.MaintenanceNotification
association[0..*] to I_MaintenanceNotificationCause as _MaintenanceNotificationCause on _MaintenanceNotificationCause.MaintenanceNotification = $projection.MaintenanceNotification
and $projection.MaintenanceNotificationItem = _MaintenanceNotificationCause.MaintenanceNotificationItem
association[0..*] to I_MaintNotificationActivity as _MaintNotificationActivity on _MaintNotificationActivity.MaintenanceNotification = $projection.MaintenanceNotification
and $projection.MaintenanceNotificationItem = _MaintNotificationActivity.MaintenanceNotificationItem
association[0..*] to I_MaintenanceNotificationTask as _MaintenanceNotificationTask on $projection.MaintenanceNotification = _MaintenanceNotificationTask.MaintenanceNotification
and $projection.MaintenanceNotificationItem = _MaintenanceNotificationTask.MaintenanceNotificationItem
association[0..1] to I_Indicator as _IsDeleted on $projection.IsDeleted = _IsDeleted.IndicatorValue
//Damage Coding
association[0..1] to I_Inspectioncatalog as _MaintNotifDamageCodeCatalog on $projection.MaintNotifDamageCodeCatalog = _MaintNotifDamageCodeCatalog.InspectionCatalog
association[0..1] to I_InspectionCodeGroup as _MaintNotifDamageCodeGroup on $projection.MaintNotifDamageCodeGroup = _MaintNotifDamageCodeGroup.InspectionCodeGroup and
$projection.MaintNotifDamageCodeCatalog = _MaintNotifDamageCodeGroup.InspectionCatalog
association[0..1] to I_InspectionCode as _MaintNotificationDamageCode on $projection.MaintNotificationDamageCode = _MaintNotificationDamageCode.InspectionCode and
$projection.MaintNotifDamageCodeCatalog = _MaintNotificationDamageCode.InspectionCatalog and $projection.MaintNotifDamageCodeGroup = _MaintNotificationDamageCode.InspectionCodeGroup
//Object Part Coding
association[0..1] to I_Inspectioncatalog as _MaintNotifObjPrtCodeCatalog on $projection.MaintNotifObjPrtCodeCatalog = _MaintNotifObjPrtCodeCatalog.InspectionCatalog
association[0..1] to I_InspectionCodeGroup as _MaintNotifObjPrtCodeGroup on $projection.MaintNotifObjPrtCodeGroup = _MaintNotifObjPrtCodeGroup.InspectionCodeGroup and
$projection.MaintNotifObjPrtCodeCatalog = _MaintNotifObjPrtCodeGroup.InspectionCatalog
association[0..1] to I_InspectionCode as _MaintNotifObjPrtCode on $projection.MaintNotifObjPrtCode = _MaintNotifObjPrtCode.InspectionCode and
$projection.MaintNotifObjPrtCodeCatalog = _MaintNotifObjPrtCode.InspectionCatalog and $projection.MaintNotifObjPrtCodeGroup = _MaintNotifObjPrtCode.InspectionCodeGroup
association [0..1] to I_Material as _Assembly on $projection.Assembly = _Assembly.Material
association [0..1] to I_DefectClass as _DefectClass on $projection.DefectClass = _DefectClass.DefectClass
{
key qmfe.fenum as MaintenanceNotificationItem,
@ObjectModel.foreignKey.association: '_MaintenanceNotification'
key qmfe.qmnum as MaintenanceNotification,
@Semantics.text: true
qmfe.fetxt as MaintNotifItemText,
@ObjectModel.foreignKey.association: '_MaintNotifDamageCodeCatalog'
cast( qmfe.fekat as eam_damage_code_catalog ) as MaintNotifDamageCodeCatalog,
@ObjectModel.foreignKey.association: '_MaintNotificationDamageCode'
cast( qmfe.fecod as eam_damage_code ) as MaintNotificationDamageCode,
@ObjectModel.foreignKey.association: '_MaintNotifDamageCodeGroup'
cast( qmfe.fegrp as eam_damage_code_group ) as MaintNotifDamageCodeGroup,
@ObjectModel.foreignKey.association: '_MaintNotifObjPrtCode'
cast( qmfe.oteil as eam_object_part_code ) as MaintNotifObjPrtCode,
@ObjectModel.foreignKey.association: '_MaintNotifObjPrtCodeGroup'
cast( qmfe.otgrp as eam_object_part_code_group ) as MaintNotifObjPrtCodeGroup,
@ObjectModel.foreignKey.association: '_MaintNotifObjPrtCodeCatalog'
cast( qmfe.otkat as eam_object_part_code_catalog ) as MaintNotifObjPrtCodeCatalog,
@ObjectModel.foreignKey.association: '_DefectClass'
qmfe.feqklas as DefectClass,
@ObjectModel.foreignKey.association: '_Assembly'
qmfe.bautl as Assembly,
qmfe.anzfehler as NumberOfDefects,
concat(qmfe.qmnum, qmfe.fenum) as ObjectKey,
@Semantics.systemDateTime.lastChangedAt: true
qmfe.changeddatetime as LastChangeDateTime,
@ObjectModel.foreignKey.association: '_IsDeleted'
qmfe.kzloesch as IsDeleted,
//Addition for Timezone\
//Addition for Timezone
case qmfe.erzeit when '240000'
then dats_add_days(qmfe.erdat,1,'NULL')
else qmfe.erdat
end as CreationDate,
@Semantics.time: true
case qmfe.erzeit when '240000'
then '000000'
else qmfe.erzeit
end as CreationTime,
case qmfe.aezeit when '240000'
then dats_add_days(qmfe.aedat,1,'NULL')
else qmfe.aedat
end as LastChangeDate,
@Semantics.time: true
case qmfe.aezeit when '240000'
then '000000'
else qmfe.aezeit
end as LastChangeTime,
// qmfe.erdat as CreationDate,
// qmfe.erzeit as CreationTime,
// qmfe.aedat as LastChangeDate,
// qmfe.aezeit as LastChangeTime,
//Associations
_MaintenanceNotification,
_MaintNotifDamageCodeCatalog,
_MaintNotifDamageCodeGroup,
_MaintNotificationDamageCode,
_MaintNotifObjPrtCodeCatalog,
_MaintNotifObjPrtCodeGroup,
_MaintNotifObjPrtCode,
_MaintenanceNotificationCause,
_MaintNotificationActivity,
_MaintenanceNotificationTask,
_IsDeleted,
_Assembly,
_DefectClass
}
where
// Only show PM & CS relevant Items
_MaintenanceNotification.NotificationOrigin = '01' or // General Maintenance Notification
_MaintenanceNotification.NotificationOrigin = '02' or // Malfunction Report
_MaintenanceNotification.NotificationOrigin = '03' or // Activity Report
_MaintenanceNotification.NotificationOrigin = '04' or // Problem notification
_MaintenanceNotification.NotificationOrigin = '05' or // Activity report (service)
_MaintenanceNotification.NotificationOrigin = '06' // General notification (service)