P_RSHResourceKPI

DDL: P_RSHRESOURCEKPI SQL: PRSHRESOURCEKPI Type: view COMPOSITE

P_RSHResourceKPI is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (P_RSHResourceUtilization, P_RSHResource) and exposes 5 fields with key fields CostCenter, CompanyCode.

Data Sources (2)

SourceAliasJoin Type
P_RSHResourceUtilization _Utilization inner
P_RSHResource P_RSHResource from

Parameters (2)

NameTypeDefault
P_StartDate syst_datum
P_EndDate syst_datum

Annotations (9)

NameValueLevelField
AbapCatalog.sqlViewName PRSHRESOURCEKPI view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #CHECK view
VDM.viewType #COMPOSITE view
VDM.private true view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.sizeCategory #XL view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (5)

KeyFieldSource TableSource FieldDescription
KEY CostCenter _Resource CostCenter
KEY CompanyCode _Resource CompanyCode
EmployeeAvailableHours
EmployeeStaffedHours
NumberOfEmployees
@AbapCatalog.sqlViewName: 'PRSHRESOURCEKPI'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@VDM.viewType: #COMPOSITE
@VDM.private: true
@ObjectModel.usageType.serviceQuality: #X
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.sizeCategory: #XL
@ClientHandling.algorithm: #SESSION_VARIABLE

/*CONTRACT*******************************************************************************************************************

Name:                       Resource KPI
Specification:              Gives total number of availability, staffed hours and total number of resources in a given period
Requires:                   Set of dates for which the above information is sought
Ensures:                    Total number of resources, total staffed and total availability information is returned
Owners:                     PSP
Contributors:               PSP
Unit Test required Y/N:     Yes - uses summation
Additional comments         None

END OF CONTRACT**************************************************************************************************************/

define view P_RSHResourceKPI
  with parameters
    P_StartDate : syst_datum,
    P_EndDate   : syst_datum
  as select from P_RSHResource ( P_StartDate:$session.system_date, P_EndDate: $session.system_date ) as _Resource
    inner join   P_RSHResourceUtilization                                                            as _Utilization on _Utilization.EmploymentInternalID = _Resource.EmploymentInternalID
{
  key _Resource.CostCenter,
  key _Resource.CompanyCode,
      // Resource utilization has Availability and Staffed hours information on a daily basis.

      // Here, we sum them up and group only by the cost center and companycode.

      sum (_Utilization.EmployeeAvailableHours)           as EmployeeAvailableHours,
      sum (_Utilization.EmployeeStaffedHours)             as EmployeeStaffedHours,
      count( distinct _Utilization.EmploymentInternalID ) as NumberOfEmployees

}
where
 _Utilization.CalendarDate between $parameters.P_StartDate and $parameters.P_EndDate
group by
  _Resource.CostCenter,
  _Resource.CompanyCode
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"P_RSHRESOURCE",
"P_RSHRESOURCEUTILIZATION"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/