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.
@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**************************************************************************************************************/defineview P_RSHResourceKPI
withparameters
P_StartDate : syst_datum,
P_EndDate : syst_datum
asselectfrom P_RSHResource ( P_StartDate:$session.system_date, P_EndDate: $session.system_date ) as _Resource
innerjoin 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 andgroup 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
groupby
_Resource.CostCenter,
_Resource.CompanyCode
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"P_RSHRESOURCE",
"P_RSHRESOURCEUTILIZATION"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/