P_RSHResourceCapacityKPIs

DDL: P_RSHRESOURCECAPACITYKPIS SQL: PRSHRESCAPKPIS Type: view COMPOSITE

P_RSHResourceCapacityKPIs is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (P_RSHResource, P_RSHResourceMonthlyUtilizatn) and exposes 8 fields with key fields EmploymentInternalId, YearMonth.

Data Sources (2)

SourceAliasJoin Type
P_RSHResource P_RSHResource inner
P_RSHResourceMonthlyUtilizatn P_RSHResourceMonthlyUtilizatn from

Parameters (2)

NameTypeDefault
P_StartDate syst_datum
P_EndDate syst_datum

Annotations (9)

NameValueLevelField
AbapCatalog.sqlViewName PRSHRESCAPKPIS 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 (8)

KeyFieldSource TableSource FieldDescription
KEY EmploymentInternalId P_RSHResourceMonthlyUtilizatn EmploymentInternalId
KEY YearMonth P_RSHResourceMonthlyUtilizatn YearMonth
CostCenter P_RSHResource CostCenter
EmployeeStaffedHours P_RSHResourceMonthlyUtilizatn EmployeeStaffedHours
EmployeeAvailableHours P_RSHResourceMonthlyUtilizatn EmployeeAvailableHours
int2endendasMonthlyUtilPercentage
CompanyCode P_RSHResource CompanyCode
CalendarMonth
@AbapCatalog.sqlViewName: 'PRSHRESCAPKPIS'
@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 Capacity KPIs
Specification:              Gives resource utilization info on a monthly basis between the given dates
Requires:                   Period for which the monthly capacity information is sought
Ensures:                    Monthly utilization percentage is returned for Resources for the specified period
Owners:                     PSP
Contributors:               PSP
Unit Test required Y/N:     N
Additional comments         None

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

define view P_RSHResourceCapacityKPIs
  with parameters
    P_StartDate : syst_datum,
    P_EndDate   : syst_datum
  as select from P_RSHResourceMonthlyUtilizatn( P_StartDate: $parameters.P_StartDate, P_EndDate:$parameters.P_EndDate)
  inner join P_RSHResource( P_StartDate: $parameters.P_StartDate, P_EndDate:$parameters.P_EndDate) on P_RSHResource.EmploymentInternalId = P_RSHResourceMonthlyUtilizatn.EmploymentInternalId
{
  key P_RSHResourceMonthlyUtilizatn.EmploymentInternalId,
  key P_RSHResourceMonthlyUtilizatn.YearMonth,
      P_RSHResource.CostCenter,
      P_RSHResourceMonthlyUtilizatn.EmployeeStaffedHours,
      P_RSHResourceMonthlyUtilizatn.EmployeeAvailableHours,
      //    Of course, Utilization = Staffed Hours / Available Hours!

      case
        when P_RSHResourceMonthlyUtilizatn.EmployeeAvailableHours is not null and P_RSHResourceMonthlyUtilizatn.EmployeeAvailableHours > 0.00
      //standard use-case: resource has available hours->simply divide for utilization

            then division( P_RSHResourceMonthlyUtilizatn.EmployeeStaffedHours, P_RSHResourceMonthlyUtilizatn.EmployeeAvailableHours, 2) * 100
        else
      //Resource either has no availability assigned or 0 available hours

            case
                when P_RSHResourceMonthlyUtilizatn.EmployeeStaffedHours is null or P_RSHResourceMonthlyUtilizatn.EmployeeStaffedHours = 0
      //no availability, no staffing->0 utilization

                  then cast (0 as abap.int2)
                else
      //no availability but staffings->return exception utilization rate

                  cast (999 as abap.int2)
            end
      end                                                      as MonthlyUtilPercentage,
      P_RSHResource.CompanyCode,
      substring(P_RSHResourceMonthlyUtilizatn.YearMonth, 5, 2) as CalendarMonth
}