P_RSHSuitableRequests

DDL: P_RSHSUITABLEREQUESTS SQL: PRSHSUITABLEREQS Type: view COMPOSITE Package: RSH_CDS_MATCH

Suitable Requests

P_RSHSuitableRequests is a Composite CDS View that provides data about "Suitable Requests" in SAP S/4HANA. It reads from 5 data sources (P_RSHAvailMatchMonthly, P_RSHRequestSkillMatching, P_RSHResource, P_RSHResourceAvailabilityMatch, P_RSHResourceRoles) and exposes 34 fields with key field ResourceDemandUUID. Part of development package RSH_CDS_MATCH.

Data Sources (5)

SourceAliasJoin Type
P_RSHAvailMatchMonthly _MonAvail left_outer
P_RSHRequestSkillMatching P_RSHRequestSkillMatching left_outer
P_RSHResource P_RSHResource inner
P_RSHResourceAvailabilityMatch P_RSHResourceAvailabilityMatch from
P_RSHResourceRoles Roles left_outer

Parameters (4)

NameTypeDefault
P_ResourceSkillTerm rsh_ps_required_skill_term
P_StartDate syst_datum
P_EndDate syst_datum
P_EmploymentInternalID persno

Annotations (9)

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

Fields (34)

KeyFieldSource TableSource FieldDescription
KEY ResourceDemandUUID ResourceAvailability ResourceDemandUUID
EngagementProjectUUID EngagementProjectUUID
EngagementProject EngagementProject
WorkPackageUUID WorkPackageUUID
WorkItem WorkItem
ServiceOrganization ServiceOrganization
EngagementProjectResource ResourceAvailability EngagementProjectResource
EmployeeRequestIsStaffed EmployeeRequestIsStaffed
StartDate ResourceAvailability StartDate
EndDate ResourceAvailability EndDate
EmployeeRequestDuration ResourceAvailability EmployeeRequestDuration
EmployeeRequestOpenDuration ResourceAvailability EmployeeRequestOpenDuration
UnitOfMeasure ResourceAvailability UnitOfMeasure
EmployeeRequestStatus EmployeeRequestStatus
WorkPackageName WorkPackageName
ProjectVisibility ProjectVisibility
CostCenter Resource CostCenter
CompanyCode Resource CompanyCode
EmployeeRequestRolesLatestDate P_RSHResourceRoles EndDate
IfDeliveryOrgunitisspecifiedintherole
IfnoDeliveryOrgUnitissuppliedonRolelevel
EmployeeRequestDelivOrg EmployeeRequestDelivOrg
EmployeeRequestHdrSrvOrg EmployeeRequestHdrSrvOrg
EngagementProjectResourceType ResourceAvailability EngagementProjectResourceType
_Skilltags _Skilltags
_Role _Role
_Project _Project
EmploymentInternalID Resource EmploymentInternalID
AuthorizationGroup Resource AuthorizationGroup
IsBusinessPurposeCompleted Resource IsBusinessPurposeCompleted
IsBusPrpsCmpltdCustomer IsBusPrpsCmpltdCustomer
CustomerAuthznGrp CustomerAuthznGrp
IsBusPrpsCmpltdProjectManager IsBusPrpsCmpltdProjectManager
ProjectManagerAuthznGrp ProjectManagerAuthznGrp
@AbapCatalog.sqlViewName: 'PRSHSUITABLEREQS'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #XL
@VDM.private: true
@VDM.viewType: #COMPOSITE
@ClientHandling.algorithm: #SESSION_VARIABLE

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

Name:                       Suitable Requests

Specification:              The view calculates the availability match, skill match, org match and role match

Requires:                   Due and overdue period in weeks, Start and End date, Today - to get the requests in a period
                            Skills - Skill(s) of the resource against which the skill matching is performed and a skill score
                            is determined

Ensures:                    Returns Suitable Requests

Owners:                     PSP
Contributors:               PSP
Unit Test required Y/N:     Y
Additional comments         None

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

define view P_RSHSuitableRequests
  with parameters
    P_ResourceSkillTerm           : rsh_ps_required_skill_term,
    P_StartDate                   : syst_datum,
    P_EndDate                     : syst_datum,
    P_EmploymentInternalID        : persno
  as select from    P_RSHResourceAvailabilityMatch( P_EmploymentInternalID: $parameters.P_EmploymentInternalID ) as ResourceAvailability
   
    inner join P_RSHResource( P_StartDate: $parameters.P_StartDate, P_EndDate: $parameters.P_EndDate) as Resource on Resource.EmploymentInternalID = $parameters.P_EmploymentInternalID                                   
   
    left outer join P_RSHRequestSkillMatching(P_ResourceSkillTerm: $parameters.P_ResourceSkillTerm, P_SAPClient: $session.client )  on P_RSHRequestSkillMatching.ResourceDemandUUID = ResourceAvailability.ResourceDemandUUID

  /* For the Role Match indicator */
    left outer join P_RSHResourceRoles                                                                                                                     as Roles on(
      Resource.EmploymentInternalID = Roles.EmploymentInternalID
      and Roles.EngagementProjectResource       = ResourceAvailability.EngagementProjectResource
    )
    
    
    left outer join P_RSHAvailMatchMonthly as _MonAvail on  _MonAvail.EmploymentInternalID = Resource.EmploymentInternalID
                                                            and _MonAvail.ResourceDemandUUID   = ResourceAvailability.ResourceDemandUUID
   {


  key ResourceAvailability.ResourceDemandUUID,

      EngagementProjectUUID,
      EngagementProject,
      WorkPackageUUID,
      WorkItem,
      ServiceOrganization,
      ResourceAvailability.EngagementProjectResource,
      EmployeeRequestIsStaffed,


      ResourceAvailability.StartDate,
      ResourceAvailability.EndDate,
      ResourceAvailability.EmployeeRequestDuration,
      ResourceAvailability.EmployeeRequestOpenDuration,
      ResourceAvailability.UnitOfMeasure,

      EmployeeRequestStatus,
      WorkPackageName,
      ProjectVisibility,

      Resource.CostCenter,
      Resource.CompanyCode,

      -- if no skill match is returned, skill match is 0 if request asked for a skill, or 100 if not
      case when ResourceAvailability._Skilltags.PlanSkillTagUUID is null
        then coalesce(RequestSkillMatchScore, 100)
        else coalesce(RequestSkillMatchScore, 0)
      end                                              as EmployeeRequestMatchSkills,
      
--------> Total Availability Match
      case when EmployeeRequestMatchAvail > 100
        then 100
        else EmployeeRequestMatchAvail
      end                                              as EmployeeRequestMatchAvail,

      case when Roles.EngagementProjectResource is null
        then ''
        else 'X'
      end                                              as EmployeeRequestRolesInd,
      
---> Monthly Availability Match
      case
       when _MonAvail.RequestOpenDuration > 0 and _MonAvail.FulfilledHours > 0 
         then division( _MonAvail.FulfilledHours , _MonAvail.RequestOpenDuration , 2 ) * 100
       when _MonAvail.RequestOpenDuration <= 0 and _MonAvail.FulfilledHours >= 0 
         then 100
       when _MonAvail.RequestOpenDuration > 0 and _MonAvail.FulfilledHours <= 0
         then 0
      end             as   AvailabilityMatchMonthly,     

      Roles.EndDate                                    as EmployeeRequestRolesLatestDate,


      -- Check on Delivery Org Unit. If Delivery Org unit is specified in the role, then check if this matches to resource org unit.
      -- If no Delivery Org Unit is supplied on Role level, then Indicator is always true.
      case
        when EmployeeRequestDelivOrg is null
           or EmployeeRequestDelivOrg = ''
          then 'X'
        when EmployeeRequestDelivOrg = _serviceorg.EngagementProjectServiceOrg
           then 'X'
        else
            ''
      end                                              as EmployeeRequestServiceOrgInd,


      EmployeeRequestDelivOrg,
      EmployeeRequestHdrSrvOrg, 
      ResourceAvailability.EngagementProjectResourceType,

      /* Associations */
      _Skilltags,
      _Role,
      _Project,

      Resource.EmploymentInternalID,
      
      Resource.AuthorizationGroup,
      Resource.IsBusinessPurposeCompleted,
    
      IsBusPrpsCmpltdCustomer,
      CustomerAuthznGrp,

      IsBusPrpsCmpltdProjectManager,
      ProjectManagerAuthznGrp
}