CDS标准视图:PM通知单 I_LocationAnalysisCube

  • 视图名称:PM通知单 I_LocationAnalysisCube
  • 视图类型:分析
  • 视图代码:
点击查看代码
@EndUserText.label: 'Location Analysis - Cube'
@VDM.viewType: #COMPOSITE
@AbapCatalog.sqlViewName: 'ILOCANALYSISCUBE'
@AccessControl.authorizationCheck: #CHECK
@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.ignorePropagatedAnnotations: true
@AbapCatalog.compiler.compareFilter: true

@Analytics: {
  dataCategory: #CUBE,
  dataExtraction: {
    enabled: true,
    delta.byElement: {
      name: 'LastChangeDateTime'
    }
  }
}

@Metadata.allowExtensions:true

@ObjectModel: {
  usageType: {
    dataClass: #MIXED,
    serviceQuality: #D,
    sizeCategory: #XL
  }
}

@ObjectModel.supportedCapabilities:[ #ANALYTICAL_PROVIDER ]
@ObjectModel.modelingPattern: #ANALYTICAL_CUBE

@AccessControl.personalData.blocking: #NOT_REQUIRED
// with this CDS view only partial details of CS notification would be visible, CS is only in compatibility mode and no further details would be made available
define view I_LocationAnalysisCube
  as select from I_MaintNotificationTechObj
  association [0..1] to I_WorkCenterBySemanticKey      as _MainWorkCenterBySemanticKey  on  $projection.MainWorkCenter      = _MainWorkCenterBySemanticKey.WorkCenter
                                                                                        and $projection.MainWorkCenterPlant = _MainWorkCenterBySemanticKey.Plant
  association [0..1] to I_WorkCenterBySemanticKey      as _WorkCenterBySemanticKey      on  $projection.workcenter      = _WorkCenterBySemanticKey.WorkCenter
                                                                                        and $projection.WorkCenterPlant = _WorkCenterBySemanticKey.Plant
  association [0..*] to I_EquipmentData                as _EquipmentData                on  _EquipmentData.Equipment = $projection.Equipment
  association [0..1] to I_FunctionalLocationData       as _FunctionalLocationData       on  _FunctionalLocationData.FunctionalLocation = $projection.FunctionalLocation
  association [0..1] to P_MaintNotifTaskCount          as _MaintNotifTaskCount          on  _MaintNotifTaskCount.MaintenanceNotification = $projection.MaintenanceNotification
  association [0..1] to P_MaintNotifSuccssflTaskCount  as _MaintNotifSuccssflTaskCount  on  _MaintNotifSuccssflTaskCount.MaintenanceNotification = $projection.MaintenanceNotification
  association [0..1] to P_MaintNotifOutStdgReldTaskCnt as _MaintNotifOutStdgReldTaskCnt on  _MaintNotifOutStdgReldTaskCnt.MaintenanceNotification = $projection.MaintenanceNotification
   -- Extensions, do not expose as association:
  association [0..1] to E_PMNotifMaintenanceData  as _NotifMaintenanceDataExtension on _NotifMaintenanceDataExtension.MaintenanceNotification = $projection.MaintenanceNotification

{
      @ObjectModel.text.element:  [ 'NotificationText' ]
  key I_MaintNotificationTechObj.MaintenanceNotification,

      @Semantics.text: true
      I_MaintNotificationTechObj.NotificationText,

      @ObjectModel.foreignKey.association: '_MaintenancePlant'
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment.MaintenancePlant,

      @ObjectModel.foreignKey.association: '_PlantSection'
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment.PlantSection,

      @ObjectModel.foreignKey.association: '_PMNotificationType'
      I_MaintNotificationTechObj.NotificationType,
      @ObjectModel.foreignKey.association: '_PMNotificationPhase'
      I_MaintNotificationTechObj.NotifProcessingPhase,

      @ObjectModel.foreignKey.association: '_MaintenancePlanPlant'
      I_MaintNotificationTechObj._PMNotifMaintenanceData.MaintenancePlanningPlant,

      @ObjectModel.foreignKey.association: '_PMNotificationPriority'
      I_MaintNotificationTechObj.MaintPriority,
      @ObjectModel.foreignKey.association: '_PMNotificationPriorityType'
      I_MaintNotificationTechObj.MaintPriorityType,

      I_MaintNotificationTechObj.NotificationOrigin,
      @ObjectModel.foreignKey.association: '_IsDeleted'
      I_MaintNotificationTechObj.IsDeleted,

      @ObjectModel.foreignKey.association: '_BusinessArea'
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment.BusinessArea,
      I_MaintNotificationTechObj._PMNotifMaintenanceData.Assembly,
      @ObjectModel.foreignKey.association: '_MaintenancePlannerGroup'
      I_MaintNotificationTechObj._PMNotifMaintenanceData.MaintenancePlannerGroup,
      @ObjectModel.foreignKey.association: '_MaintenanceObjectIsDown'
      I_MaintNotificationTechObj._PMNotifMaintenanceData.MaintenanceObjectIsDown,

      @ObjectModel.foreignKey.association: '_MainWorkCenterBySemanticKey'
      cast( I_MaintNotificationTechObj._MainWorkCenter.WorkCenter as gewrk preserving type  )                                                                             as MainWorkCenter,
      @ObjectModel.foreignKey.association: '_MainWorkCenterPlant'
      cast( I_MaintNotificationTechObj._MainWorkCenter.Plant as wergw preserving type  )                                                                                  as MainWorkCenterPlant,
      @ObjectModel.foreignKey.association: '_WorkCenterBySemanticKey'
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment._WorkCenter.WorkCenter,
      @ObjectModel.foreignKey.association: '_WorkCenterPlant'
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment._WorkCenter.Plant                                                                     as WorkCenterPlant,

      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment.AssetLocation,
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment.AssetRoom,
      @ObjectModel.foreignKey.association: '_ABCIndicator'
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment.ABCIndicator,
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment.MaintObjectFreeDefinedAttrib,
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment.CostCenter,
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment.ControllingArea,
      @ObjectModel.foreignKey.association: '_CompanyCode'
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment.CompanyCode,
      @ObjectModel.foreignKey.association: '_WBSElementBasicData'
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment.WBSElementInternalID,
      cast( I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment._WBSElementBasicData.WBSElement as ps_posid preserving type )       as WBSElement,


      // Dates
      @Semantics.systemDate.createdAt: true
      I_MaintNotificationTechObj.CreationDate,
      @Semantics.systemTime.createdAt: true
      I_MaintNotificationTechObj.CreationTime,
      @Semantics.systemDate.lastChangedAt: true
      I_MaintNotificationTechObj.LastChangeDate,
      @Semantics.businessDate.createdAt: true
      I_MaintNotificationTechObj.NotificationCreationDate,
      I_MaintNotificationTechObj.NotificationCreationTime,
      I_MaintNotificationTechObj.NotificationCompletionDate,
      I_MaintNotificationTechObj.CompletionTime,
      @Semantics.businessDate.at: true
      I_MaintNotificationTechObj.NotificationReferenceDate,
      I_MaintNotificationTechObj.RequiredStartDate,
      I_MaintNotificationTechObj.RequiredStartTime,
      I_MaintNotificationTechObj.RequiredEndDate,
      I_MaintNotificationTechObj.RequiredEndTime,
      I_MaintNotificationTechObj._PMNotifMaintenanceData.MalfunctionStartDate,
      I_MaintNotificationTechObj._PMNotifMaintenanceData.MalfunctionStartTime,
      I_MaintNotificationTechObj._PMNotifMaintenanceData.MalfunctionEndDate,
      I_MaintNotificationTechObj._PMNotifMaintenanceData.MalfunctionEndTime,

      // Timestamps
      @Semantics.systemDateTime.lastChangedAt: true
      I_MaintNotificationTechObj.LastChangeDateTime,

      // Users
      @Semantics.user.createdBy: true
      I_MaintNotificationTechObj.CreatedByUser,
      @Semantics.user.lastChangedBy: true
      I_MaintNotificationTechObj.LastChangedByUser,
      I_MaintNotificationTechObj.ReportedByUser,

      /****************************************************************************************************
      * Technical Object
      ****************************************************************************************************/

      // Alternative labeling for Functional Locations is supported
      I_MaintNotificationTechObj._TechnicalObject.TechnicalObjectLabel,

      //@ObjectModel.foreignKey.association: '_TechnicalObject'
      //I_MaintNotificationTechObj.TechnicalObject,
      @ObjectModel.foreignKey.association: '_TechObjIsEquipOrFuncnlLoc'
      I_MaintNotificationTechObj.TechObjIsEquipOrFuncnlLoc,
      @ObjectModel.foreignKey.association: '_TechnicalObjectType'
      I_MaintNotificationTechObj._TechnicalObject.TechnicalObjectType,
      I_MaintNotificationTechObj._TechnicalObject.AssetManufacturerName,
      I_MaintNotificationTechObj._TechnicalObject.ManufacturerPartTypeName,
      I_MaintNotificationTechObj._TechnicalObject.AuthorizationGroup,
      @ObjectModel.foreignKey.association: '_ManufacturerCountry'
      I_MaintNotificationTechObj._TechnicalObject.ManufacturerCountry,
      @Semantics.calendar.year: true
      cast( I_MaintNotificationTechObj._TechnicalObject.ConstructionYear as eam_techobj_construction_year )                                                               as ConstructionYear,

      cast( I_MaintNotificationTechObj._TechnicalObject.ConstructionMonth as eam_techobj_construction_month )                                                             as ConstructionMonth,
      @ObjectModel.foreignKey.association: '_EquipmentData'
      I_MaintNotificationTechObj.Equipment,
      @ObjectModel.foreignKey.association: '_FunctionalLocationData'
      I_MaintNotificationTechObj.FunctionalLocation,
      @ObjectModel.foreignKey.association: '_TechnicalObjectCodeCatalog'
      I_MaintNotificationTechObj._TechnicalObject.CatalogProfile,

      //LinearAssetManagementData
      cast( cast( I_MaintNotificationTechObj._LinearAssetManagementData.LinearDataStartPoint as abap.dec(11, 3) ) as eaml_start_point )                                       as LinearDataStartPoint,
      cast( cast( I_MaintNotificationTechObj._LinearAssetManagementData.LinearDataEndPoint as abap.dec(11, 3) ) as eaml_end_point )                                           as LinearDataEndPoint,

      @Semantics.quantity.unitOfMeasure: 'LinearDataUnitOfMeasure'
      I_MaintNotificationTechObj._LinearAssetManagementData.LinearDataLength,
      @ObjectModel.foreignKey.association: '_LinearDataUnitOfMeasure'
      I_MaintNotificationTechObj._LinearAssetManagementData.LinearDataUnitOfMeasure,


      /****************************************************************************************************
      * Measures
      ****************************************************************************************************/
      @DefaultAggregation: #SUM
      cast( 1 as smofn )                                                                                                                                                  as NumberOfCreatedMaintNotifs,

      @DefaultAggregation: #SUM
      cast( case when I_MaintNotificationTechObj._PMNotifMaintenanceData.MaintenanceObjectIsDown = 'X' then 1
      else 0 end as sgmsaus )                                                                                                                                             as NumberOfReportedBreakdowns,

      @DefaultAggregation: #SUM
      cast( case when I_MaintNotificationTechObj.MaintenanceOrder != '' then 1
      else 0 end as iaofn )                                                                                                                                               as NumberOfCreatedMaintOrders,

      @DefaultAggregation: #SUM
      cast( case when I_MaintNotificationTechObj.IsCompleted = 'X' then 1
      else 0 end as smmab )                                                                                                                                               as NumberOfCompletedMaintNotif,

      @DefaultAggregation: #SUM
      cast( case when I_MaintNotificationTechObj.IsDeleted = 'X' then 1
      else 0 end as eam_deleted_notifications )                                                                                                                           as NmbrOfDeltdMaintNotifications,

      @DefaultAggregation: #SUM
      cast( case when I_MaintNotificationTechObj.IsDeleted = 'X' or I_MaintNotificationTechObj.IsCompleted = 'X' then 0
      else 1 end as eam_open_notifications )                                                                                                                              as NmbrOfOpenMaintNotifications,

      //Downtime Duration in Hour
      @DefaultAggregation: #SUM
//     @Semantics.quantity.unitOfMeasure: 'MaintObjDowntimeDurationUnit'
      cast(unit_conversion(
        quantity => I_MaintNotificationTechObj.MaintObjectDowntimeDuration,
        source_unit => cast('S' as maueh),
        target_unit => cast('STD' as maueh),
        error_handling=> 'SET_TO_NULL'
      ) as auszt )                                                                                                                                                        as MaintObjectDowntimeDuration,
      //Hour
      @Semantics.unitOfMeasure: true
      cast('STD' as maueh)                                                                                                                                                as MaintObjDowntimeDurationUnit,

      //Total Lead Time of Notifications
      @DefaultAggregation: #SUM
//      @Semantics.quantity.unitOfMeasure: 'LeadTimeUnit'
      cast(division(TSTMP_SECONDS_BETWEEN (
        (dats_tims_to_tstmp(NotificationCreationDate, NotificationCreationTime, abap_system_timezone( $session.client,'NULL' ), $session.client, 'NULL' ) ),
        (dats_tims_to_tstmp(NotificationCompletionDate, CompletionTime, abap_system_timezone( $session.client,'NULL' ), $session.client, 'NULL' ) ),
         'NULL' ), 86400, 11 ) as qnsumdlzt )                                                                                                                             as TotalLeadTimeOfMaintNotif,
      //Day
      @Semantics.unitOfMeasure: true
      cast('TAG' as qeinhtag)                                                                                                                                             as LeadTimeUnit,

      //Number of Notifications with Status Outstanding
      @DefaultAggregation: #SUM
      cast(case when I_MaintNotificationTechObj.IsDeleted = '' and NotificationCompletionDate = '00000000' then 1
      else 0 end as qzhlmofn )                                                                                                                                            as NrOfOutstandingMaintNotif,

      //Number of Notifications Completed on Schedule
      @DefaultAggregation: #SUM
      cast(case when I_MaintNotificationTechObj.IsDeleted = ''  then
              case when NotificationCompletionDate != '00000000' and RequiredEndDate != '00000000' then
                      case when NotificationCompletionDate < RequiredEndDate then 1
                           when NotificationCompletionDate = RequiredEndDate then
                              case when CompletionTime < RequiredEndTime then 1
                                   else 0 end
                           else 0 end
                   when NotificationCompletionDate != '00000000' and RequiredEndDate = '00000000' then 1
                   else 0 end
              else 0 end as qzhlerl_te )                                                                                                                                  as NrOfMaintNotifCmpltdOnSched,

      //Number of Tasks
      @DefaultAggregation: #SUM
      cast(_MaintNotifTaskCount.NumberOfMaintNotifTasks as qzhlmass )                                                                                                     as NumberOfMaintNotifTasks,

      //Number of Tasks with Status Successful
      @DefaultAggregation: #SUM
      cast(_MaintNotifSuccssflTaskCount.NrOfMaintNotifSuccssflTasks as qzhlmerf )                                                                                         as NrOfMaintNotifSuccssflTasks,

      //Number of Tasks with Status "Outstanding" or "Released" (Active Tasks)
      @DefaultAggregation: #SUM
      cast(_MaintNotifOutStdgReldTaskCnt.NrOfMaintNotifActiveTasks as qzhlmaof )                                                                                          as NrOfMaintNotifActiveTasks,

      //Associations
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment._MaintenancePlant,
      I_MaintNotificationTechObj._PMNotifMaintenanceData._MaintenancePlanningPlant,
      I_MaintNotificationTechObj._PMNotifMaintenanceData._MaintenancePlanPlant,
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment._PlantSection,
      I_MaintNotificationTechObj._IsDeleted,
      I_MaintNotificationTechObj._PMNotificationPhase,
      I_MaintNotificationTechObj._PMNotificationType,
      I_MaintNotificationTechObj._PMNotificationPriority,
      I_MaintNotificationTechObj._PMNotificationPriorityType,
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment._BusinessArea,
      I_MaintNotificationTechObj._PMNotifMaintenanceData._MaintenancePlannerGroup,
      I_MaintNotificationTechObj._PMNotifMaintenanceData._MaintenanceObjectIsDown,
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment._ABCIndicator,
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment._CompanyCode,
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment._WBSElementBasicData,
      I_MaintNotificationTechObj._LinearAssetManagementData._LinearDataUnitOfMeasure,
      I_MaintNotificationTechObj._MainWorkCenter._Plant                                                           as _MainWorkCenterPlant,
      I_MaintNotificationTechObj._PMNotifMaintenanceData._LocationAccountAssignment._WorkCenter._Plant            as _WorkCenterPlant,
      //_TechnicalObject,
      I_MaintNotificationTechObj._TechObjIsEquipOrFuncnlLoc,
      I_MaintNotificationTechObj._TechnicalObject._TechnicalObjectType,
      I_MaintNotificationTechObj._TechnicalObject._ManufacturerCountry,
      --I_MaintNotificationTechObj._Equipment,
      --I_MaintNotificationTechObj._FunctionalLocation,
      I_MaintNotificationTechObj._TechnicalObject._TechnicalObjectCodeCatalog,

      _EquipmentData,
      _FunctionalLocationData,
      _MainWorkCenterBySemanticKey,
      _WorkCenterBySemanticKey
}
  • 事务代码:IQS3

  • 视图结构:

字段名称 设备名称
通知 MAINTENANCENOTIFICATION
描述 NOTIFICATIONTEXT
维护工厂 MAINTENANCEPLANT
厂区 PLANTSECTION
通知类型 NOTIFICATIONTYPE
通知阶段 NOTIFPROCESSINGPHASE
计划工厂 MAINTENANCEPLANNINGPLANT
优先级 MAINTPRIORITY
优先级类型 MAINTPRIORITYTYPE
通知来源 NOTIFICATIONORIGIN
已删除 ISDELETED
业务范围 BUSINESSAREA
装配 ASSEMBLY
计划人员组 MAINTENANCEPLANNERGROUP
细分 MAINTENANCEOBJECTISDOWN
主工作中心 MAINWORKCENTER
工厂工作中心 MAINWORKCENTERPLANT
工作中心 WORKCENTER
工厂 WORKCENTERPLANT
位置 ASSETLOCATION
房间 ASSETROOM
ABC 标识 ABCINDICATOR
分类字段 MAINTOBJECTFREEDEFINEDATTRIB
成本中心 COSTCENTER
成本控制范围 CONTROLLINGAREA
公司代码 COMPANYCODE
WBS 要素 WBSELEMENTINTERNALID
WBS 要素 WBSELEMENT
创建日期 CREATIONDATE
创建时间 CREATIONTIME
更改日期 LASTCHANGEDATE
通知日期 NOTIFICATIONCREATIONDATE
通知时间 NOTIFICATIONCREATIONTIME
完成日期 NOTIFICATIONCOMPLETIONDATE
完成时间 COMPLETIONTIME
参考日期 NOTIFICATIONREFERENCEDATE
要求的起始日期 REQUIREDSTARTDATE
要求的开始时间 REQUIREDSTARTTIME
要求的结束日期 REQUIREDENDDATE
要求的结束时间 REQUIREDENDTIME
故障开始 MALFUNCTIONSTARTDATE
故障开始(时间) MALFUNCTIONSTARTTIME
故障结束 MALFUNCTIONENDDATE
故障结束 MALFUNCTIONENDTIME
时戳 LASTCHANGEDATETIME
创建人 CREATEDBYUSER
更改人 LASTCHANGEDBYUSER
报告人 REPORTEDBYUSER
技术对象 TECHNICALOBJECTLABEL
技术对象类型 TECHOBJISEQUIPORFUNCNLLOC
对象类型 TECHNICALOBJECTTYPE
制造商 ASSETMANUFACTURERNAME
型号 MANUFACTURERPARTTYPENAME
授权组 AUTHORIZATIONGROUP
制造国家/地区 MANUFACTURERCOUNTRY
制造年份 CONSTRUCTIONYEAR
制造月份 CONSTRUCTIONMONTH
设备 EQUIPMENT
功能位置 FUNCTIONALLOCATION
类别参数文件 CATALOGPROFILE
起点 LINEARDATASTARTPOINT
终点 LINEARDATAENDPOINT
LINEARDATALENGTH
计量单位 LINEARDATAUNITOFMEASURE
创建的通知 NUMBEROFCREATEDMAINTNOTIFS
明细报告 NUMBEROFREPORTEDBREAKDOWNS
订单被生成 NUMBEROFCREATEDMAINTORDERS
完成的通知 NUMBEROFCOMPLETEDMAINTNOTIF
已删除的通知 NMBROFDELTDMAINTNOTIFICATIONS
未清通知 NMBROFOPENMAINTNOTIFICATIONS
停机期间 MAINTOBJECTDOWNTIMEDURATION
单位 MAINTOBJDOWNTIMEDURATIONUNIT
总提前期 TOTALLEADTIMEOFMAINTNOTIF
LEADTIMEUNIT
未清通知 NROFOUTSTANDINGMAINTNOTIF
日程安排 NROFMAINTNOTIFCMPLTDONSCHED
全部的任务号码 NUMBEROFMAINTNOTIFTASKS
任务成功 NROFMAINTNOTIFSUCCSSFLTASKS
任务末结 NROFMAINTNOTIFACTIVETASKS

posted @ 2024-12-30 13:39  观兴  阅读(2)  评论(0编辑  收藏  举报