P_MaterialStockPeriods

DDL: P_MATERIALSTOCKPERIODS SQL: PMATSTOCKPERIODS Type: view COMPOSITE

P_MaterialStockPeriods is a Composite CDS View in SAP S/4HANA. It reads from 12 data sources and exposes 25 fields with key fields PeriodType, FiscalYearVariant, YearPeriod, FiscalYearVariant, YearPeriod.

Data Sources (12)

SourceAliasJoin 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)

NameTypeDefault
P_StartDate vdm_v_start_date
P_EndDate vdm_v_end_date

Annotations (10)

NameValueLevelField
AbapCatalog.preserveKey true view
AbapCatalog.sqlViewName PMATSTOCKPERIODS view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ObjectModel.usageType.sizeCategory #M view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.private true view
VDM.viewType #COMPOSITE view

Fields (25)

KeyFieldSource TableSource FieldDescription
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
@AbapCatalog.preserveKey: true
@AbapCatalog.sqlViewName: 'PMATSTOCKPERIODS'

@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck:#NOT_REQUIRED
@ObjectModel.usageType.sizeCategory: #M
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass:#TRANSACTIONAL
@ClientHandling.algorithm: #SESSION_VARIABLE

@VDM.private: true
@VDM.viewType: #COMPOSITE

define view 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   >= :P_StartDate
  and fc.FiscalPeriodStartDate <= :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 >= :P_StartDate
  and cd.CalendarDate <= :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 >= :P_StartDate
  and cd.CalendarDate <= :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 >= :P_StartDate
  and cd.CalendarDate <= :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 >= :P_StartDate
  and cd.CalendarDate <= :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 >= :P_StartDate
  and cd.CalendarDate <= :P_EndDate
group by
  cd.CalendarYear,
  cd.CalendarDayOfYear    

/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CALENDARDATE",
"I_FISCALCALENDARDATE",
"I_SAPCLIENT",
"P_MATERIALSTOCKFYVARIANT"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/