@AbapCatalog.sqlViewName: 'IFIFSCLDTEFUNCRL'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@ClientHandling.algorithm: #SESSION_VARIABLE
// @AccessControl.authorizationCheck: #CHECK set to avoid ATC check error. View does not expose DPP relevant data
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Fiscal Date Function for Ledger'
@Analytics: { dataCategory: #DIMENSION, internalName: #LOCAL }
@VDM.viewType: #COMPOSITE
@ObjectModel: { representativeKey: 'DateFunction',
usageType: { dataClass: #META,
serviceQuality: #C,
sizeCategory: #S },
supportedCapabilities: [#ANALYTICAL_DIMENSION, #CDS_MODELING_ASSOCIATION_TARGET, #SQL_DATA_SOURCE, #CDS_MODELING_DATA_SOURCE],
modelingPattern: #ANALYTICAL_DIMENSION }
@Metadata: { allowExtensions: true ,
ignorePropagatedAnnotations: true }
define view I_FsclDateFuncRangeForLedger
with parameters
P_DateFunction : datefunctionid
as select from I_FiscalDateFunctionValue
inner join I_Datefunction on I_FiscalDateFunctionValue.DateFunction = I_Datefunction.DateFunction
inner join I_FiscalCalendarDate as Date1 on I_FiscalDateFunctionValue.FiscalYearVariant = Date1.FiscalYearVariant
and I_FiscalDateFunctionValue.DateFunctionStartDate = Date1.CalendarDate
inner join I_FiscalCalendarDate as Date2 on I_FiscalDateFunctionValue.FiscalYearVariant = Date2.FiscalYearVariant
and I_FiscalDateFunctionValue.DateFunctionEndDate = Date2.CalendarDate
inner join I_LedgerCompanyCodeCrcyRoles on I_FiscalDateFunctionValue.FiscalYearVariant = I_LedgerCompanyCodeCrcyRoles.FiscalYearVariant
association [1..1] to I_CompanyCode as _CompanyCode on I_LedgerCompanyCodeCrcyRoles.CompanyCode = _CompanyCode.CompanyCode
association [1..1] to I_Ledger as _Ledger on I_LedgerCompanyCodeCrcyRoles.Ledger = _Ledger.Ledger
{
@ObjectModel.foreignKey.association: '_Ledger'
key I_LedgerCompanyCodeCrcyRoles.Ledger,
@ObjectModel.foreignKey.association: '_CompanyCode'
key I_LedgerCompanyCodeCrcyRoles.CompanyCode,
key I_Datefunction.DateFunction,
I_LedgerCompanyCodeCrcyRoles.FiscalYearVariant,
// I_Datefunction.DateFunctionType,
cast( Date1.FiscalYear as fis_ryear_from_no_conv ) as FromFiscalYear,
cast( Date2.FiscalYear as fis_ryear_to_no_conv ) as ToFiscalYear,
// Can be added later, new GFN required
// Date1.FiscalYearQuarter as FromFiscalYearQuarter,
// Date2.FiscalYearQuarter as ToFiscalYearQuarter,
cast(case when I_FiscalDateFunctionValue.DateFunctionStartDate = Date1.FiscalYearStartDate then concat( Date1.FiscalYear, '000' )
else Date1.FiscalYearPeriod
end as fins_fyearperiod ) as FromFiscalYearPeriod,
Date2.FiscalYearPeriod as ToFiscalYearPeriod,
// Can be added later, new GFN required
// Date1.FiscalYearWeek as FromFiscalYearWeek,
// Date2.FiscalYearWeek as ToFiscalYearWeek,
cast( case when I_FiscalDateFunctionValue.DateFunctionStartDate = Date1.FiscalYearStartDate then '00000000'
else I_FiscalDateFunctionValue.DateFunctionStartDate
end as fis_budat_from ) as FromPostingDate,
cast( I_FiscalDateFunctionValue.DateFunctionEndDate as fis_budat_to ) as ToPostingDate,
_CompanyCode,
_Ledger
}
where
I_FiscalDateFunctionValue.DateFunction = $parameters.P_DateFunction
and I_FiscalDateFunctionValue.DateFunctionValidityDate = $session.system_date
and I_Datefunction.DateFunctionType = '02'
//
//union all select from I_DateFunctionValue
// inner join I_Datefunction on I_DateFunctionValue.DateFunction = I_Datefunction.DateFunction
// inner join I_FiscalCalendarDate as Date1 on I_DateFunctionValue.DateFunctionStartDate = Date1.CalendarDate
// inner join I_FiscalCalendarDate as Date2 on Date1.FiscalYearVariant = Date2.FiscalYearVariant
// and I_DateFunctionValue.DateFunctionEndDate = Date2.CalendarDate
// inner join I_LedgerCompanyCodeCrcyRoles on I_LedgerCompanyCodeCrcyRoles.FiscalYearVariant = Date2.FiscalYearVariant
//{
// I_LedgerCompanyCodeCrcyRoles.Ledger,
// I_LedgerCompanyCodeCrcyRoles.CompanyCode,
// I_LedgerCompanyCodeCrcyRoles.FiscalYearVariant,
//
// case when I_DateFunctionValue.DateFunctionStartDate = Date1.FiscalYearStartDate then concat( Date1.FiscalYear, '000' )
// else Date1.FiscalYearPeriod
// end as FromFiscalYearPeriod,
// Date2.FiscalYearPeriod as ToFiscalYearPeriod,
// case when I_DateFunctionValue.DateFunctionStartDate = Date1.FiscalYearStartDate then '19000101'
// else I_DateFunctionValue.DateFunctionStartDate
// end as DateFunctionStartDate,
// I_DateFunctionValue.DateFunctionEndDate as DateFunctionEndDate,
//
// I_Datefunction.DateFunction,
// I_Datefunction.DateFunctionType
//
//}
//where
// I_DateFunctionValue.DateFunction = $parameters.P_DateFunction
// and I_DateFunctionValue.DateFunctionValidityDate = $session.system_date
// and I_Datefunction.DateFunctionType = '02'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_DATEFUNCTION",
"I_FISCALCALENDARDATE",
"I_FISCALDATEFUNCTIONVALUE",
"I_LEDGERCOMPANYCODECRCYROLES"
],
"ASSOCIATED":
[
"I_COMPANYCODE",
"I_LEDGER"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/