P_ServiceOrderDataCube

DDL: P_SERVICEORDERDATACUBE Type: view COMPOSITE Package: CRMS4_ANALYTICS_SERVICE_ORDER

Service Order Data Cube

P_ServiceOrderDataCube is a Composite CDS View that provides data about "Service Order Data Cube" in SAP S/4HANA. It reads from 1 data source (I_ServiceDocumentEnhcd) and exposes 73 fields with key fields ServiceObjectType, ServiceOrder. It has 3 associations to related views. Part of development package CRMS4_ANALYTICS_SERVICE_ORDER.

Data Sources (1)

SourceAliasJoin Type
I_ServiceDocumentEnhcd I_ServiceDocumentEnhcd from

Associations (3)

CardinalityTargetAliasCondition
[0..1] I_CalendarDate _Period $projection.ServiceDocumentCreationDate = _Period.CalendarDate
[0..1] P_SrvcOrdDistinctConfExist _SrvcOrdItmConfExist $projection.ServiceObjectType = _SrvcOrdItmConfExist.ServiceObjectType and $projection.ServiceOrder = _SrvcOrdItmConfExist.ServiceOrder
[1..1] I_SrvcOrdConfStatus _SrvcOrdConfStatus $projection.SrvcOrdHasConfdItem = _SrvcOrdConfStatus.SrvcOrdHasConfdItem

Annotations (9)

NameValueLevelField
ClientHandling.algorithm #SESSION_VARIABLE view
AbapCatalog.sqlViewName PSERVORDDCUBE view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
VDM.viewType #COMPOSITE view
VDM.private true view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XXL view

Fields (73)

KeyFieldSource TableSource FieldDescription
KEY ServiceObjectType ServiceObjectType
KEY ServiceOrder ServiceDocument
ServiceOrderDescription ServiceDocumentDescription
ServiceOrderStatus ServiceDocumentStatus
ServiceDocumentType ServiceDocumentType
RefBusinessSolutionOrder RefBusinessSolutionOrder
RespyMgmtServiceTeam RespyMgmtServiceTeam
RespyMgmtServiceTeamDesc
TeamName _ServiceTeamHeader TeamName
ServiceDocumentTemplateType ServiceDocumentTemplateType
SoldToParty SoldToParty
ResponsibleEmployee ResponsibleEmployee
ServiceEmployee ServiceEmployee
ContactPerson ContactPerson
ServiceTeam ServiceTeam
RequestedServiceEndDate RequestedServiceEndDate
ServiceDocumentCreationDate ServiceDocumentCreationDate
ServiceDocumentPriority ServiceDocumentPriority
ServiceDocumentHasError ServiceDocumentHasError
ServiceDocNetAmount ServiceDocNetAmount
TransactionCurrency TransactionCurrency
PurchaseOrderByCustomer PurchaseOrderByCustomer
SalesOrganizationOrgUnitID SalesOrganizationOrgUnitID
SalesOfficeOrgUnitID SalesOfficeOrgUnitID
SalesGroupOrgUnitID SalesGroupOrgUnitID
ServiceOrganization ServiceOrganization
SalesOrganization SalesOrganization
DistributionChannel DistributionChannel
Division Division
SalesOffice SalesOffice
SalesGroup SalesGroup
SrvcOrdCreationQuarter _Period CalendarQuarter
SrvcOrdCreationMonth _Period CalendarMonth
SrvcOrdCreationYear _Period CalendarYear
int4asNmbrOfIncompleteServiceOrders
NumberOfIncomingServiceOrders
int4asNumberOfOpenServiceOrders
int4endasNumberOfOverdueServiceOrders
ServiceDocumentIsOpen ServiceDocumentIsOpen
ServiceReferenceObjectType _ServiceDocRefObj ServiceReferenceObjectType
SrvcRefObjIsMainObject _ServiceDocRefObj SrvcRefObjIsMainObject
ProductID _ServiceDocRefObj ProductID
SerialNumber _ServiceDocRefObj SerialNumber
Equipment _ServiceDocRefObj Equipment
FunctionalLocation _ServiceDocRefObj FunctionalLocation
_ServiceObjType _ServiceObjType
_ServiceDocumentIsOpen _ServiceDocumentIsOpen
_ServiceDocumentStatus _ServiceDocumentStatus
_SrvcDocLifecycleStatus _SrvcDocLifecycleStatus
_ServiceDocumentType _ServiceDocumentType
_ServiceDocumentPriority _ServiceDocumentPriority
_SoldToParty _SoldToParty
_RespEmployee _RespEmployee
_ServiceTeam _ServiceTeam
_ServiceEmployee _ServiceEmployee
_ContactPerson _ContactPerson
_ServiceDocHasError _ServiceDocHasError
_SrvcOrdConfStatus _SrvcOrdConfStatus
_SalesOrganizationOrgUnit _SalesOrganizationOrgUnit
_SalesOfficeOrgUnit _SalesOfficeOrgUnit
_SalesGroupOrgUnit _SalesGroupOrgUnit
_SalesOrganization _SalesOrganization
_SalesOffice _SalesOffice
_SalesGroup _SalesGroup
_DistributionChannel _DistributionChannel
_Division _Division
_SalesOrganizationOrgUnit_2 _SalesOrganizationOrgUnit_2
_SalesOfficeOrgUnit_2 _SalesOfficeOrgUnit_2
_SalesGroupOrgUnit_2 _SalesGroupOrgUnit_2
_TransactionCurrency _TransactionCurrency
_Period _Period
_ServiceDocRefObj _ServiceDocRefObj
_ServiceTeamHeader _ServiceTeamHeader
//@EndUserText.label: 'Service Order Data Cube'

@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog: {
  sqlViewName: 'PSERVORDDCUBE',
  compiler.compareFilter: true,
  preserveKey: true
}
@VDM: {
  viewType: #COMPOSITE,
  private:true
}
@AccessControl: {
  personalData.blocking: #('TRANSACTIONAL_DATA')
}

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

define view P_ServiceOrderDataCube
  as select from I_ServiceDocumentEnhcd
  
  association [0..1] to I_CalendarDate             as _Period              on  $projection.ServiceDocumentCreationDate = _Period.CalendarDate
  association [0..1] to P_SrvcOrdDistinctConfExist as _SrvcOrdItmConfExist on  $projection.ServiceObjectType = _SrvcOrdItmConfExist.ServiceObjectType
                                                                           and $projection.ServiceOrder      = _SrvcOrdItmConfExist.ServiceOrder

  association [1..1] to I_SrvcOrdConfStatus        as _SrvcOrdConfStatus   on  $projection.SrvcOrdHasConfdItem = _SrvcOrdConfStatus.SrvcOrdHasConfdItem

{
      @ObjectModel.foreignKey.association: '_ServiceObjType'
  key ServiceObjectType,
  key ServiceDocument               as ServiceOrder,
      ServiceDocumentDescription    as ServiceOrderDescription,
      @ObjectModel.foreignKey.association: '_SrvcDocLifecycleStatus'
      ServiceDocumentStatus         as ServiceOrderStatus,
      @ObjectModel.foreignKey.association: '_ServiceDocumentType'
      ServiceDocumentType,
      RefBusinessSolutionOrder,
     
      RespyMgmtServiceTeam,
      
       _ServiceTeamHeader._TeamDescription.TeamDescription as RespyMgmtServiceTeamDesc,
       
       _ServiceTeamHeader.TeamName as TeamName,

      ServiceDocumentTemplateType,

      @ObjectModel.foreignKey.association: '_SoldToParty'
      SoldToParty,
      @ObjectModel.foreignKey.association: '_RespEmployee'
      ResponsibleEmployee,
      @ObjectModel.foreignKey.association: '_ServiceEmployee'
      ServiceEmployee,
      @ObjectModel.foreignKey.association: '_ContactPerson'
      ContactPerson,
      @ObjectModel.foreignKey.association: '_ServiceTeam'
      ServiceTeam,
      
      RequestedServiceEndDate,
      ServiceDocumentCreationDate,

      @ObjectModel.foreignKey.association: '_ServiceDocumentPriority'
      ServiceDocumentPriority,

      @ObjectModel.foreignKey.association: '_ServiceDocHasError'
      ServiceDocumentHasError,

      @Semantics: { amount : {currencyCode: 'TransactionCurrency'} }
      ServiceDocNetAmount,

      @ObjectModel.foreignKey.association: '_TransactionCurrency'
      @Semantics.currencyCode:true
      TransactionCurrency,

      PurchaseOrderByCustomer,

//      @ObjectModel.foreignKey.association: '_SalesOrganizationOrgUnit'

      @ObjectModel.foreignKey.association: '_SalesOrganizationOrgUnit_2'
      SalesOrganizationOrgUnitID,

//      @ObjectModel.foreignKey.association: '_SalesOfficeOrgUnit'

      @ObjectModel.foreignKey.association: '_SalesOfficeOrgUnit_2'
      SalesOfficeOrgUnitID,

//      @ObjectModel.foreignKey.association: '_SalesGroupOrgUnit'

      @ObjectModel.foreignKey.association: '_SalesGroupOrgUnit_2'
      SalesGroupOrgUnitID,

      ServiceOrganization,

      @ObjectModel.foreignKey.association: '_SalesOrganization'
      SalesOrganization,

      @ObjectModel.foreignKey.association: '_DistributionChannel'
      DistributionChannel,

      @ObjectModel.foreignKey.association: '_Division'
      Division,

      @ObjectModel.foreignKey.association: '_SalesOffice'
      SalesOffice,

      @ObjectModel.foreignKey.association: '_SalesGroup'
      SalesGroup,

      @Semantics.calendar.quarter
      _Period.CalendarQuarter       as SrvcOrdCreationQuarter,
      @Semantics.calendar.month
      _Period.CalendarMonth         as SrvcOrdCreationMonth,
      @Semantics.calendar.year
      _Period.CalendarYear          as SrvcOrdCreationYear,

      @DefaultAggregation: #SUM
      cast( case when ServiceDocumentIsOpen = 'X' then cast (1 as abap.int4)
                 end as abap.int4 ) as NmbrOfIncompleteServiceOrders,

      @DefaultAggregation: #SUM
      cast(1 as abap.int4)          as NumberOfIncomingServiceOrders,

      @DefaultAggregation: #SUM
      cast( case when ServiceDocumentIsOpen = 'X'
              then 1
              else 0
            end as abap.int4 )      as NumberOfOpenServiceOrders,

      @DefaultAggregation: #SUM
      case when RequestedServiceEndDate < $session.system_date
                    and    ServiceDocumentIsOpen = 'X'
            then cast (1 as abap.int4)
            end                     as NumberOfOverdueServiceOrders,

      // Confirmation exists or not

      case
           when _SrvcOrdItmConfExist.ServiceConfirmation is not null and
                    ServiceDocumentIsOpen = 'X'
           then 'X'
           else ' '
        end                         as SrvcOrdHasConfdItem,

      @ObjectModel.foreignKey.association: '_ServiceDocumentIsOpen'
      ServiceDocumentIsOpen,

      _ServiceDocRefObj.ServiceReferenceObjectType,
      _ServiceDocRefObj.SrvcRefObjIsMainObject,
      _ServiceDocRefObj.ProductID,
      _ServiceDocRefObj.SerialNumber,
      _ServiceDocRefObj.Equipment,
      _ServiceDocRefObj.FunctionalLocation,


      _ServiceObjType,
      _ServiceDocumentIsOpen,
      @API.element.releaseState: #DEPRECATED
      @API.element.successor: '_SrvcDocLifecycleStatus'
      _ServiceDocumentStatus,
      _SrvcDocLifecycleStatus,
      _ServiceDocumentType,
      _ServiceDocumentPriority,
      _SoldToParty,
      _RespEmployee,
      _ServiceTeam,
      _ServiceEmployee,
      _ContactPerson,
      _ServiceDocHasError,
      _SrvcOrdConfStatus,
      _SalesOrganizationOrgUnit,
      _SalesOfficeOrgUnit,
      _SalesGroupOrgUnit,
      _SalesOrganization,
      _SalesOffice,
      _SalesGroup,
      _DistributionChannel,
      _Division,
      _SalesOrganizationOrgUnit_2,
      _SalesOfficeOrgUnit_2,
      _SalesGroupOrgUnit_2,
      _TransactionCurrency,
      _Period,
      _ServiceDocRefObj,
      _ServiceTeamHeader

}
where
      ServiceObjectType           = 'BUS2000116'
  and ServiceDocumentIsQuotation != 'X'
  and SrvcDocIsMaintServiceOrder != 'X'
  and ServiceDocumentTemplateType is initial
  and RefInHouseRepairIsExisting  is initial