P_RshDatsFirstLastDayMonths
First Date(Day) & Last Date(Day) for Date and No. of Months
P_RshDatsFirstLastDayMonths is a Composite CDS View that provides data about "First Date(Day) & Last Date(Day) for Date and No. of Months" in SAP S/4HANA. It reads from 1 data source (I_CalendarDate) and exposes 3 fields with key field firstDate. Part of development package RSH_CDS_CMN.
Data Sources (1)
| Source | Alias | Join Type |
|---|---|---|
| I_CalendarDate | I_CalendarDate | from |
Parameters (2)
| Name | Type | Default |
|---|---|---|
| P_CalendarDate | dats | |
| P_NumberOfMonths | rsh_number_of_months |
Annotations (9)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | P_RSHDATSFRSTLST | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| VDM.viewType | #COMPOSITE | view | |
| VDM.private | true | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view | |
| ObjectModel.usageType.dataClass | #CUSTOMIZING | view | |
| ObjectModel.usageType.serviceQuality | #A | view | |
| ObjectModel.usageType.sizeCategory | #S | view |
Fields (3)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | firstDate | I_CalendarDate | FirstDayOfMonthDate | |
| calendarDate | ||||
| numberOfMonths |
@AbapCatalog.sqlViewName: 'P_RSHDATSFRSTLST'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #COMPOSITE
@VDM.private: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.dataClass: #CUSTOMIZING
@ObjectModel.usageType.serviceQuality: #A
@ObjectModel.usageType.sizeCategory: #S
/*
CONTRACT**********************************************************************************************************************
Specification: This view calculates
* the first day/date of the month according to P_CalendarDate
* the last day/date of month according to ( P_CalendarDate + P_NumberOfMonths )
Requires: n/a
Ensures: Consideration of year/month overflow according to P_NumberOfMonths and other date specifications like Feb 29th etc.
Owners: JS
Contributors: JS
Unit Test required Y/N: Yes
Additional comments None
END OF CONTRACT***************************************************************************************************************
*/
define view P_RshDatsFirstLastDayMonths
with parameters
P_CalendarDate : dats,
P_NumberOfMonths : rsh_number_of_months
as select from I_CalendarDate
{
key I_CalendarDate.FirstDayOfMonthDate as firstDate,
// 'FAIL' case should never occur but if it happens, then something is really wrong and the calculation should fail then (e.g. invalid parameter values, "end of times" etc.)
dats_add_days(dats_add_months(I_CalendarDate.FirstDayOfMonthDate,
cast($parameters.P_NumberOfMonths as int4),
'FAIL'), -1, 'FAIL') as LastDate,
$parameters.P_CalendarDate as calendarDate,
$parameters.P_NumberOfMonths as numberOfMonths
}
where
I_CalendarDate.CalendarDate = $parameters.P_CalendarDate
Learn More
- What Is a CDS View in SAP S/4HANA?
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- CDS View Annotations — A Complete Guide
- CDS View Field Mapping and Associations
- Understanding the SAP S/4HANA Data Model
- CDS View Extensions and Custom Fields in SAP S/4HANA
- Released APIs and Stability Contracts in SAP S/4HANA