P_MaterialStockPeriods
Periods for all possible period types
P_MaterialStockPeriods is a Composite CDS View that provides data about "Periods for all possible period types" in SAP S/4HANA. It reads from 12 data sources and exposes 25 fields with key fields PeriodType, FiscalYearVariant, YearPeriod, FiscalYearVariant, YearPeriod. Part of development package MM_IM_VDM_STOCK.
Data Sources (12)
| Source | Alias | Join Type |
|---|---|---|
| I_CalendarDate | cd | inner |
| I_CalendarDate | cd | inner |
| I_CalendarDate | cd | inner |
| I_CalendarDate | cd | inner |
| I_CalendarDate | cd | inner |
| I_FiscalCalendarDate | fc | from |
| P_MaterialStockFYVariant | fv | inner |
| I_SAPClient | sc | union_all |
| I_SAPClient | sc | union_all |
| I_SAPClient | sc | union_all |
| I_SAPClient | sc | union_all |
| I_SAPClient | sc | union_all |
Parameters (2)
| Name | Type | Default |
|---|---|---|
| P_StartDate | vdm_v_start_date | |
| P_EndDate | vdm_v_end_date |
Annotations (7)
| Name | Value | Level | Field |
|---|---|---|---|
| Metadata.ignorePropagatedAnnotations | true | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| ObjectModel.usageType.sizeCategory | #M | view | |
| ObjectModel.usageType.serviceQuality | #D | view | |
| ObjectModel.usageType.dataClass | #TRANSACTIONAL | view | |
| VDM.private | true | view | |
| VDM.viewType | #COMPOSITE | view |
Fields (25)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | PeriodType | |||
| KEY | FiscalYearVariant | I_FiscalCalendarDate | FiscalYearVariant | |
| KEY | YearPeriod | I_FiscalCalendarDate | FiscalYearPeriod | |
| StartDate | I_FiscalCalendarDate | FiscalPeriodStartDate | ||
| LogicalSystemkeyYasPeriodType | ||||
| KEY | FiscalYearVariant | |||
| KEY | YearPeriod | |||
| StartDate | ||||
| LogicalSystemkeyQasPeriodType | ||||
| KEY | FiscalYearVariant | |||
| KEY | YearPeriod | |||
| StartDate | ||||
| LogicalSystemkeyMasPeriodType | ||||
| KEY | FiscalYearVariant | |||
| KEY | YearPeriod | |||
| StartDate | ||||
| LogicalSystemkeyWasPeriodType | ||||
| KEY | FiscalYearVariant | |||
| KEY | YearPeriod | |||
| StartDate | ||||
| LogicalSystemkeyDasPeriodType | ||||
| KEY | FiscalYearVariant | |||
| KEY | YearPeriod | |||
| StartDate | ||||
| EndDate |
@Metadata.ignorePropagatedAnnotations: true
@AccessControl.authorizationCheck:#NOT_REQUIRED
@ObjectModel.usageType.sizeCategory: #M
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass:#TRANSACTIONAL
@VDM.private: true
@VDM.viewType: #COMPOSITE
define view entity P_MaterialStockPeriods
with parameters
P_StartDate : vdm_v_start_date,
P_EndDate : vdm_v_end_date
as
// Fiscal Year Period
select from I_FiscalCalendarDate as fc
inner join P_MaterialStockFYVariant as fv on fc.FiscalYearVariant = fv.FiscalYearVariant
{
key 'F' as PeriodType,
key fc.FiscalYearVariant as FiscalYearVariant,
key fc.FiscalYearPeriod as YearPeriod,
fc.FiscalPeriodStartDate as StartDate,
fc.FiscalPeriodEndDate as EndDate
}
where
fc.FiscalPeriodEndDate >= $parameters.P_StartDate
and fc.FiscalPeriodStartDate <= $parameters.P_EndDate
group by
fc.FiscalYearVariant,
fc.FiscalYearPeriod,
fc.FiscalPeriodStartDate,
fc.FiscalPeriodEndDate
union all
// Calendar Year
select from I_SAPClient as sc
inner join I_CalendarDate as cd on sc.LogicalSystem = ''
or sc.LogicalSystem <> '' //dummy "on" condition
{
key 'Y' as PeriodType,
key ' ' as FiscalYearVariant,
key concat(cd.CalendarYear, '000') as YearPeriod,
min(cd.CalendarDate) as StartDate,
max(cd.CalendarDate) as EndDate
}
where
cd.CalendarDate >= $parameters.P_StartDate
and cd.CalendarDate <= $parameters.P_EndDate
group by
cd.CalendarYear
union all
// Calendar Quarter
select from I_SAPClient as sc
inner join I_CalendarDate as cd on sc.LogicalSystem = ''
or sc.LogicalSystem <> '' //dummy "on" condition
{
key 'Q' as PeriodType,
key ' ' as FiscalYearVariant,
key concat(cd.CalendarYear, concat('00', cd.CalendarQuarter)) as YearPeriod,
min(cd.CalendarDate) as StartDate,
max(cd.CalendarDate) as EndDate
}
where
cd.CalendarDate >= $parameters.P_StartDate
and cd.CalendarDate <= $parameters.P_EndDate
group by
cd.CalendarYear,
cd.CalendarQuarter
union all
// Calendar Month
select from I_SAPClient as sc
inner join I_CalendarDate as cd on sc.LogicalSystem = '' //dummy "on" condition
or sc.LogicalSystem <> ''
{
key 'M' as PeriodType,
key ' ' as FiscalYearVariant,
key concat(cd.CalendarYear, concat('0', cd.CalendarMonth)) as YearPeriod,
min(cd.CalendarDate) as StartDate,
max(cd.CalendarDate) as EndDate
}
where
cd.CalendarDate >= $parameters.P_StartDate
and cd.CalendarDate <= $parameters.P_EndDate
group by
cd.CalendarYear,
cd.CalendarMonth
union all
// Calendar Week
select from I_SAPClient as sc
inner join I_CalendarDate as cd on sc.LogicalSystem = '' //dummy "on" condition
or sc.LogicalSystem <> ''
{
key 'W' as PeriodType,
key ' ' as FiscalYearVariant,
key concat(substring(cd.YearWeek,1,4),concat('0', cd.CalendarWeek)) as YearPeriod,
min(cd.CalendarDate) as StartDate,
max(cd.CalendarDate) as EndDate
}
where
cd.CalendarDate >= $parameters.P_StartDate
and cd.CalendarDate <= $parameters.P_EndDate
group by
cd.CalendarWeek,
cd.YearWeek
union all
// Calendar Day
select from I_SAPClient as sc
inner join I_CalendarDate as cd on sc.LogicalSystem = '' //dummy "on" condition
or sc.LogicalSystem <> ''
{
key 'D' as PeriodType,
key ' ' as FiscalYearVariant,
key concat(cd.CalendarYear, cd.CalendarDayOfYear) as YearPeriod,
min(cd.CalendarDate) as StartDate,
max(cd.CalendarDate) as EndDate
}
where
cd.CalendarDate >= $parameters.P_StartDate
and cd.CalendarDate <= $parameters.P_EndDate
group by
cd.CalendarYear,
cd.CalendarDayOfYear
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