P_RSHCalWorkDaysTimeFrame

DDL: P_RSHCALWORKDAYSTIMEFRAME SQL: PRSHCALWDTF Type: view CONSUMPTION

P_RSHCalWorkDaysTimeFrame is a Consumption CDS View in SAP S/4HANA. It reads from 2 data sources (P_RSHCALWORKDAYS, P_RSHOperationTimeFrame) and exposes 4 fields with key fields Client, WorkDays, CalendarDate, CapacityInternalID.

Data Sources (2)

SourceAliasJoin Type
P_RSHCALWORKDAYS P_RSHCALWORKDAYS from
P_RSHOperationTimeFrame P_RSHOperationTimeFrame cross

Parameters (2)

NameTypeDefault
P_StartDate datum
P_EndDate datum

Annotations (5)

NameValueLevelField
AbapCatalog.sqlViewName PRSHCALWDTF view
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.private true view
VDM.viewType #CONSUMPTION view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (4)

KeyFieldSource TableSource FieldDescription
KEY Client isWorkDay client
KEY WorkDays isWorkDay WorkDays
KEY CalendarDate isWorkDay CalendarDate
KEY CapacityInternalID isWorkDay CapacityInternalID
@AbapCatalog.sqlViewName: 'PRSHCALWDTF'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.private: true
@VDM.viewType: #CONSUMPTION
@ClientHandling.algorithm: #SESSION_VARIABLE

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

Name:                       Calander Working Days in Time Frame 
Specification:              This view retrieves the information on whether each day is a working day(1) or not(0), as per the 
                            factory calander
Requires:                   NA
Ensures:                    Information on whether each day is a working day(1) or not(0), as per the factory calander
                            is returned. Only the days within the time range as per the underlying operations are included 
                            in the results
Owners:                     PRP
Contributors:               CK, AN
Unit Test required Y/N:     Yes
Additional comments         The below approach uses a CROSS JOIN to limit the date range that is involved.
                            The view P_RSHOperationTimeFrame also uses a CROSS JOIN.
                            This seems to be giving the best results in performance tests. Based on the feedback from
                            HANA DB team, this apporach could be improved or relooked in to

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

define view P_RSHCalWorkDaysTimeFrame

  with parameters
    P_StartDate : datum,
    P_EndDate   : datum
  
  as select from P_RSHCALWORKDAYS( P_SAPClient : $session.client ) isWorkDay 
  
     cross join P_RSHOperationTimeFrame(P_StartDate : $parameters.P_StartDate, P_EndDate : $parameters.P_EndDate) as OperationsTimeFrame
{

      key isWorkDay.client as Client,
      key isWorkDay.WorkDays as WorkDays,
      key isWorkDay.CalendarDate as CalendarDate,
      key isWorkDay.CapacityInternalID as CapacityInternalID
}

where isWorkDay.CalendarDate >= OperationsTimeFrame.OperationTImeFrameStartDate and isWorkDay.CalendarDate <= OperationsTimeFrame.OperationTImeFrameEndDate