P_RSHThisWeekAndNextWeek

DDL: P_RSHTHISWEEKANDNEXTWEEK SQL: PRSHTHISCWNEXTCW Type: view CONSUMPTION Package: RSH_CDS_WC_UTILIZATION

Return current Calendar Week and Next Calendar Week

P_RSHThisWeekAndNextWeek is a Consumption CDS View that provides data about "Return current Calendar Week and Next Calendar Week" in SAP S/4HANA. It reads from 1 data source (I_CalendarDate) and exposes 8 fields with key field DateOfCurrentWeek. Part of development package RSH_CDS_WC_UTILIZATION.

Data Sources (1)

SourceAliasJoin Type
I_CalendarDate I_CalendarDate from

Annotations (6)

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

Fields (8)

KeyFieldSource TableSource FieldDescription
KEY DateOfCurrentWeek CalendarDate
DateOfNextWeek
DateOfPreviousWeek
DateofThirdWeek
DateofFourthWeek
clientNULLasStartDateTimeOfCurrentWeek
clientNULLasEndDateTimeOfNextWeek
clientNULLasStartDateTimeOfPreviousWeek
@AbapCatalog.sqlViewName: 'PRSHTHISCWNEXTCW'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.private: true
@VDM.viewType: #CONSUMPTION
@ClientHandling.algorithm: #SESSION_VARIABLE

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

Name:                       Date of current week and next week
Specification:              This view helps to convert rows into columns in work center utilization service.
                            It is not possible to return two calendar weeks with one CDS View.
Requires:                   NA
Ensures:                    Date of current week and next week is returned
Owners:                     AN
Contributors:               PRP
Unit Test required Y/N:     Yes
Additional comments         None

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

define view P_RSHThisWeekAndNextWeek
  as select from I_CalendarDate
{

  key CalendarDate                                                as DateOfCurrentWeek,

      dats_add_days(CalendarDate, 7, 'FAIL')                      as DateOfNextWeek,
      dats_add_days(CalendarDate, -7, 'FAIL')                     as DateOfPreviousWeek,
      dats_add_days(CalendarDate, 14, 'FAIL')                     as DateofThirdWeek,
      dats_add_days(CalendarDate, 21, 'FAIL')                     as DateofFourthWeek,

      dats_tims_to_tstmp( CalendarDate , cast( '000000' as abap.tims ),
                  $session.user_timezone,$session.client,'NULL' ) as StartDateTimeOfCurrentWeek,

      dats_tims_to_tstmp( dats_add_days(CalendarDate, 7, 'FAIL') , cast( '235959' as abap.tims ),
                  $session.user_timezone,$session.client,'NULL' ) as EndDateTimeOfNextWeek,

      dats_tims_to_tstmp( dats_add_days(CalendarDate, -7, 'FAIL') , cast( '000000' as abap.tims ),
                  $session.user_timezone,$session.client,'NULL')  as StartDateTimeOfPreviousWeek
}
// Filter based on user timeone date because the data shown in OVP will be according to

// user time zone

where
  CalendarDate = $session.user_date