@AbapCatalog.dataMaintenance: #RESTRICTED
@AccessControl.authorizationCheck: #MANDATORY
@AccessControl.personalData.blocking: #REQUIRED
@Analytics.internalName: #LOCAL
@Analytics.dataCategory: #CUBE
@EndUserText.label: 'Statement of Changes line items - Cube'
@Metadata.allowExtensions: true
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
serviceQuality: #D,
sizeCategory: #XXL,
dataClass: #MIXED
}
@ObjectModel: {
modelingPattern: #ANALYTICAL_CUBE,
supportedCapabilities: [
#ANALYTICAL_PROVIDER,
#SQL_DATA_SOURCE,
#CDS_MODELING_DATA_SOURCE
]
}
@VDM.lifecycle.contract.type: #PUBLIC_LOCAL_API
@VDM.viewType: #COMPOSITE
define view entity I_StatementOfChangesCube
with parameters
P_KeyDate : sydatum,
P_GLAccountHierarchy : fis_glaccthier,
P_Ledger : fis_rldnr,
P_LedgerFiscalYear : fis_gjahr,
P_ToFiscalPeriod : fis_period_to,
P_CurrencyRole : fins_curtp
as select from I_GLAccountLineItem as I_GLAcctBalance
inner join P_LedgerCompanyCodeCrcyRoles on I_GLAcctBalance.CompanyCode = P_LedgerCompanyCodeCrcyRoles.CompanyCode
and I_GLAcctBalance.Ledger = P_LedgerCompanyCodeCrcyRoles.Ledger
inner join I_LedgerCompanyCodeCrcyRoles on I_GLAcctBalance.CompanyCode = I_LedgerCompanyCodeCrcyRoles.CompanyCode
and I_GLAcctBalance.Ledger = I_LedgerCompanyCodeCrcyRoles.Ledger
inner join I_GLAccountHierarchyNode as _GLAccountHierarchyNode on I_GLAcctBalance.ChartOfAccounts = _GLAccountHierarchyNode.ChartOfAccounts
and I_GLAcctBalance.GLAccount = _GLAccountHierarchyNode.GLAccount
and _GLAccountHierarchyNode.GLAccountHierarchy = $parameters.P_GLAccountHierarchy
and _GLAccountHierarchyNode.ValidityStartDate <= $parameters.P_KeyDate
and _GLAccountHierarchyNode.ValidityEndDate >= $parameters.P_KeyDate
and _GLAccountHierarchyNode.ParentNode <> '00NOTASSGND'
association [0..1] to I_GLAccountInChartOfAccounts as _GLAccountInChartOfAccounts on $projection.ChartOfAccounts = _GLAccountInChartOfAccounts.ChartOfAccounts
and $projection.GLAccount = _GLAccountInChartOfAccounts.GLAccount
association [1..1] to I_FinancialTransactionType as _FinancialTransactionType on $projection.FinancialTransactionType = _FinancialTransactionType.FinancialTransactionType
association [0..1] to I_FiscalPeriodForVariant as _FiscalPeriodForVariant on $projection.FiscalYearVariant = _FiscalPeriodForVariant.FiscalYearVariant
and $projection.LedgerFiscalYear = _FiscalPeriodForVariant.FiscalYear
and $projection.FiscalPeriod = _FiscalPeriodForVariant.FiscalPeriod
{
key I_GLAcctBalance.SourceLedger,
@ObjectModel.foreignKey.association: '_Ledger'
key I_GLAcctBalance.Ledger,
@ObjectModel.foreignKey.association: '_CompanyCode'
key I_GLAcctBalance.CompanyCode,
@ObjectModel.foreignKey.association: '_FiscalYear'
key I_GLAcctBalance.FiscalYear,
key I_GLAcctBalance.AccountingDocument,
key I_GLAcctBalance.LedgerGLLineItem,
@ObjectModel.foreignKey.association: '_FinancialTransactionType'
I_GLAcctBalance.FinancialTransactionType,
I_GLAcctBalance.LedgerFiscalYear,
@ObjectModel.foreignKey.association: '_ChartOfAccounts'
I_GLAcctBalance.ChartOfAccounts,
@ObjectModel.foreignKey.association: '_GLAccountInChartOfAccounts'
I_GLAcctBalance.GLAccount,
_GLAccountHierarchyNode.GLAccountHierarchy as GLAccountHierarchy,
_GLAccountHierarchyNode.HierarchyNode as HierarchyNode,
_GLAccountHierarchyNode.ParentNode as ParentNode,
@Semantics.businessDate.from: true
_GLAccountHierarchyNode.ValidityStartDate as ValidityStartDate,
@Semantics.businessDate.to: true
_GLAccountHierarchyNode.ValidityEndDate as ValidityEndDate,
_GLAccountHierarchyNode.HierarchyNodeSequence as HierarchyNodeSequence,
@ObjectModel.foreignKey.association: '_ProfitCenter'
I_GLAcctBalance.ProfitCenter,
@ObjectModel.foreignKey.association: '_FunctionalArea'
I_GLAcctBalance.FunctionalArea,
@ObjectModel.foreignKey.association: '_BusinessArea'
I_GLAcctBalance.BusinessArea,
@ObjectModel.foreignKey.association: '_ControllingArea'
I_GLAcctBalance.ControllingArea,
@ObjectModel.foreignKey.association: '_Segment'
I_GLAcctBalance.Segment,
@ObjectModel.foreignKey.association: '_DebitCreditCode'
I_GLAcctBalance.DebitCreditCode,
@ObjectModel.foreignKey.association: '_FiscalYearVariant'
I_GLAcctBalance.FiscalYearVariant,
I_GLAcctBalance.FiscalYearPeriod,
@ObjectModel.foreignKey.association: '_FiscalCalendarDate'
I_GLAcctBalance.PostingDate,
@ObjectModel.foreignKey.association: '_TransactionCurrency'
I_GLAcctBalance.TransactionCurrency,
@Aggregation.default: #SUM
@Semantics: { amount : {currencyCode: 'TransactionCurrency'} }
I_GLAcctBalance.AmountInTransactionCurrency,
@ObjectModel.foreignKey.association: '_CompanyCodeCurrency'
I_GLAcctBalance.CompanyCodeCurrency,
@Aggregation.default: #SUM
@Semantics: { amount : {currencyCode: 'CompanyCodeCurrency'} }
I_GLAcctBalance.AmountInCompanyCodeCurrency,
@ObjectModel.foreignKey.association: '_GlobalCurrency'
I_GLAcctBalance.GlobalCurrency,
@Aggregation.default: #SUM
@Semantics: { amount : {currencyCode: 'GlobalCurrency'} }
I_GLAcctBalance.AmountInGlobalCurrency,
@ObjectModel.foreignKey.association: '_FreeDefinedCurrency1'
I_GLAcctBalance.FreeDefinedCurrency1,
@Aggregation.default: #SUM
@Semantics: { amount : {currencyCode: 'FreeDefinedCurrency1'} }
I_GLAcctBalance.AmountInFreeDefinedCurrency1,
@ObjectModel.foreignKey.association: '_FreeDefinedCurrency2'
I_GLAcctBalance.FreeDefinedCurrency2,
@Aggregation.default: #SUM
@Semantics: { amount : {currencyCode: 'FreeDefinedCurrency2'} }
I_GLAcctBalance.AmountInFreeDefinedCurrency2,
@ObjectModel.foreignKey.association: '_FreeDefinedCurrency3'
I_GLAcctBalance.FreeDefinedCurrency3,
@Aggregation.default: #SUM
@Semantics: { amount : {currencyCode: 'FreeDefinedCurrency3'} }
I_GLAcctBalance.AmountInFreeDefinedCurrency3,
@ObjectModel.foreignKey.association: '_FreeDefinedCurrency4'
I_GLAcctBalance.FreeDefinedCurrency4,
@Aggregation.default: #SUM
@Semantics: { amount : {currencyCode: 'FreeDefinedCurrency4'} }
I_GLAcctBalance.AmountInFreeDefinedCurrency4,
@ObjectModel.foreignKey.association: '_FreeDefinedCurrency5'
I_GLAcctBalance.FreeDefinedCurrency5,
@Aggregation.default: #SUM
@Semantics: { amount : {currencyCode: 'FreeDefinedCurrency5'} }
I_GLAcctBalance.AmountInFreeDefinedCurrency5,
@ObjectModel.foreignKey.association: '_FreeDefinedCurrency6'
I_GLAcctBalance.FreeDefinedCurrency6,
@Aggregation.default: #SUM
@Semantics: { amount : {currencyCode: 'FreeDefinedCurrency6'} }
I_GLAcctBalance.AmountInFreeDefinedCurrency6,
@ObjectModel.foreignKey.association: '_FreeDefinedCurrency7'
I_GLAcctBalance.FreeDefinedCurrency7,
@Aggregation.default: #SUM
@Semantics: { amount : {currencyCode: 'FreeDefinedCurrency7'} }
I_GLAcctBalance.AmountInFreeDefinedCurrency7,
@ObjectModel.foreignKey.association: '_FreeDefinedCurrency8'
I_GLAcctBalance.FreeDefinedCurrency8,
@Aggregation.default: #SUM
@Semantics: { amount : {currencyCode: 'FreeDefinedCurrency8'} }
I_GLAcctBalance.AmountInFreeDefinedCurrency8,
I_GLAcctBalance.FiscalPeriod,
// for DCL (authority check):
I_GLAcctBalance.OrderID,
I_GLAcctBalance.Supplier,
I_GLAcctBalance.CostCenter,
I_GLAcctBalance.OrganizationDivision,
I_GLAcctBalance.ServiceDocumentType,
I_GLAcctBalance.AssetClass,
I_GLAcctBalance.Plant,
I_GLAcctBalance.ValuationArea,
I_GLAcctBalance.FinancialAccountType,
I_GLAcctBalance.SalesDocument,
I_GLAcctBalance.SalesOrganization,
I_GLAcctBalance.DistributionChannel,
I_GLAcctBalance.ServiceDocument,
I_GLAcctBalance.Customer,
I_GLAcctBalance.AccountingDocumentType,
I_GLAcctBalance.ServiceDocumentItem,
I_GLAcctBalance.PartnerCompany,
// End of for DCL
I_GLAcctBalance._FiscalCalendarDate.FiscalQuarter as FiscalQuarter,
I_GLAcctBalance._FiscalCalendarDate.FiscalWeek as FiscalWeek,
I_GLAcctBalance._FiscalCalendarDate.FiscalYearQuarter as FiscalYearQuarter,
I_GLAcctBalance._FiscalCalendarDate.FiscalYearWeek as FiscalYearWeek,
I_GLAcctBalance._FiscalPeriodForVariant.FiscalPeriodStartDate,
I_GLAcctBalance._FiscalPeriodForVariant.FiscalPeriodEndDate,
I_GLAcctBalance._CompanyCode,
I_GLAcctBalance._FiscalYear,
I_GLAcctBalance._ControllingArea,
I_GLAcctBalance._TransactionCurrency,
I_GLAcctBalance._CompanyCodeCurrency,
I_GLAcctBalance._GlobalCurrency,
I_GLAcctBalance._FreeDefinedCurrency1,
I_GLAcctBalance._FreeDefinedCurrency2,
I_GLAcctBalance._FreeDefinedCurrency3,
I_GLAcctBalance._FreeDefinedCurrency4,
I_GLAcctBalance._FreeDefinedCurrency5,
I_GLAcctBalance._FreeDefinedCurrency6,
I_GLAcctBalance._FreeDefinedCurrency7,
I_GLAcctBalance._FreeDefinedCurrency8,
I_GLAcctBalance._Segment,
I_GLAcctBalance._ProfitCenter,
I_GLAcctBalance._BusinessArea,
I_GLAcctBalance._FunctionalArea,
I_GLAcctBalance._ChartOfAccounts,
I_GLAcctBalance._DebitCreditCode,
I_GLAcctBalance._Ledger,
I_GLAcctBalance._FiscalCalendarDate,
I_GLAcctBalance._FiscalYearVariant,
_GLAccountInChartOfAccounts,
_FiscalPeriodForVariant,
_FinancialTransactionType,
I_GLAcctBalance._PartnerCompany,
// for DCL (authority check):
I_GLAcctBalance._GLAccountInCompanyCode,
I_GLAcctBalance._Supplier,
I_GLAcctBalance._Order,
I_GLAcctBalance._CurrentCostCenter,
I_GLAcctBalance._SalesDocument,
I_GLAcctBalance._CurrentProfitCenter,
I_GLAcctBalance._ServiceDocument,
I_GLAcctBalance._Customer,
I_GLAcctBalance._AccountingDocumentType,
//End of for DCL
case
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.CompanyCodeCurrencyRole then cast (I_GLAcctBalance.CompanyCodeCurrency as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.GlobalCurrencyRole then cast (I_GLAcctBalance.GlobalCurrency as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency1Role then cast (I_GLAcctBalance.FreeDefinedCurrency1 as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency2Role then cast (I_GLAcctBalance.FreeDefinedCurrency2 as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency3Role then cast (I_GLAcctBalance.FreeDefinedCurrency3 as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency4Role then cast (I_GLAcctBalance.FreeDefinedCurrency4 as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency5Role then cast (I_GLAcctBalance.FreeDefinedCurrency5 as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency6Role then cast (I_GLAcctBalance.FreeDefinedCurrency6 as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency7Role then cast (I_GLAcctBalance.FreeDefinedCurrency7 as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency8Role then cast (I_GLAcctBalance.FreeDefinedCurrency8 as vdm_v_display_currency preserving type)
else cast('' as vdm_v_display_currency)
end as DisplayCurrency,
@Aggregation.default:#SUM
@Semantics.amount.currencyCode: 'DisplayCurrency'
case when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.CompanyCodeCurrencyRole then curr_to_decfloat_amount(I_GLAcctBalance.AmountInCompanyCodeCurrency)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.GlobalCurrencyRole then curr_to_decfloat_amount(I_GLAcctBalance.AmountInGlobalCurrency)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency1Role then curr_to_decfloat_amount(I_GLAcctBalance.AmountInFreeDefinedCurrency1)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency2Role then curr_to_decfloat_amount(I_GLAcctBalance.AmountInFreeDefinedCurrency2)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency3Role then curr_to_decfloat_amount(I_GLAcctBalance.AmountInFreeDefinedCurrency3)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency4Role then curr_to_decfloat_amount(I_GLAcctBalance.AmountInFreeDefinedCurrency4)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency5Role then curr_to_decfloat_amount(I_GLAcctBalance.AmountInFreeDefinedCurrency5)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency6Role then curr_to_decfloat_amount(I_GLAcctBalance.AmountInFreeDefinedCurrency6)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency7Role then curr_to_decfloat_amount(I_GLAcctBalance.AmountInFreeDefinedCurrency7)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency8Role then curr_to_decfloat_amount(I_GLAcctBalance.AmountInFreeDefinedCurrency8)
else null
end as AmountInDisplayCurrency
}
where
I_GLAcctBalance.Ledger = $parameters.P_Ledger
and I_GLAcctBalance.FiscalYear = $parameters.P_LedgerFiscalYear
and I_GLAcctBalance.FiscalPeriod <= $parameters.P_ToFiscalPeriod
and P_LedgerCompanyCodeCrcyRoles.CurrencyRole = $parameters.P_CurrencyRole