P_LastDayOfFsclDteFunction is a Basic CDS View that provides data about "Last day of fiscal date function" in SAP S/4HANA. It reads from 2 data sources (I_Datefunction, I_FiscalDateFunctionValue) and exposes 2 fields with key fields DateFunctionendasDateFunction, FiscalYearVariant.
@AbapCatalog.sqlViewName: 'PLSTDAYDTEFUNC'
@AbapCatalog.compiler.compareFilter: true@AbapCatalog.preserveKey: true@AccessControl.authorizationCheck: #NOT_REQUIRED@ClientHandling.algorithm: #SESSION_VARIABLE@VDM.private:true@VDM.viewType: #BASIC@EndUserText.label: 'Last day of fiscal date function'
defineview P_LastDayOfFsclDteFunction
asselectfrom I_Datefunction as _DateFunction
innerjoin I_FiscalDateFunctionValue as _fsclDateFunctionValue on _fsclDateFunctionValue.DateFunction = _DateFunction.DateFunction
and _fsclDateFunctionValue.DateFunctionValidityDate = $session.system_date
leftouter to one join P_LastDayOfTwoPeriodsAgoText as _LastDayOfTwoPeriodsAgoText on DomainValue = '01'
and Language = $session.system_language
{
keycasewhen _DateFunction.DateFunction = 'FIRSTDAYOFPREVIOUSFISCALPERIOD'
then 'LASTDAYOF2PERIODSAGO'
else _DateFunction.DateFunction endas DateFunction,
key _fsclDateFunctionValue.FiscalYearVariant as FiscalYearVariant,
casewhen _DateFunction.DateFunction = 'FIRSTDAYOFPREVIOUSFISCALPERIOD'
then _LastDayOfTwoPeriodsAgoText.DateFunctionDescription
else _DateFunctionText[1: Language = $session.system_language].DateFunctionDescription endas DateFunctionDescription,
cast( casewhen _DateFunction.DateFunction = 'FIRSTDAYOFPREVIOUSFISCALPERIOD'
then dats_add_days(_fsclDateFunctionValue.DateFunctionEndDate, -1,'NULL')
else _fsclDateFunctionValue.DateFunctionEndDate endas datum) as DateFunctionEndDate
}
where
_DateFunction.DateFunction = 'LASTDAYOFPREVIOUSFISCALPERIOD'
or _DateFunction.DateFunction = 'LASTDAYOFCURRENTFISCALPERIOD'
or _DateFunction.DateFunction = 'FIRSTDAYOFPREVIOUSFISCALPERIOD'
or _DateFunction.DateFunction = 'LASTDAYOFNEXTFISCALPERIOD'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_DATEFUNCTION",
"I_DATEFUNCTIONTEXT",
"I_FISCALDATEFUNCTIONVALUE",
"P_LASTDAYOFTWOPERIODSAGOTEXT"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/