@AbapCatalog.sqlViewName: 'ISTMNTOFCHANGES'
@VDM.lifecycle.contract.type: #PUBLIC_LOCAL_API
@AbapCatalog.preserveKey: true
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.dataMaintenance : #RESTRICTED
@Analytics: { dataCategory: #CUBE }
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck: #CHECK
@AbapCatalog.dbHints: [
{dbSystem: #HDB, hint: 'AGGR_TARGET("ACDOCA")'} ]
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.buffering.status: #NOT_ALLOWED
@Metadata.ignorePropagatedAnnotations: true
@Metadata.allowExtensions: true
@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel: { supportedCapabilities: [#ANALYTICAL_PROVIDER, #SQL_DATA_SOURCE, #CDS_MODELING_DATA_SOURCE],
modelingPattern: #ANALYTICAL_CUBE }
@AccessControl.personalData.blocking:#REQUIRED
@EndUserText.label: 'Statement of Changes line items'
@Analytics.internalName:#LOCAL
define view I_StatementOfChanges
with parameters
P_StatementOfChangesType : bspl_account_type,
P_CompanyCode : fis_bukrs,
P_Ledger : fis_rldnr,
P_FiscalYear : fis_gjahr,
P_FiscalPeriod : fis_period_to,
P_CurrencyRole : fins_curtp
as select from I_GLAccountLineItem as I_GLAcctBalance
//transaction type
left outer to many join I_StmntOfChgsTransTypeSqnc as I_soc_ta on I_GLAcctBalance.FinancialTransactionType = I_soc_ta.FinancialTransactionType
and I_soc_ta.StatementOfChangesType = $parameters.P_StatementOfChangesType
//hierarchy and semantic tag for SOCType
right outer join I_StatementOfChangesSemTag as I_SOCTYPESEMTAG on I_SOCTYPESEMTAG.StatementOfChangesType = $parameters.P_StatementOfChangesType
right outer join I_SemTagGLAccount on I_SemTagGLAccount.GLAccount = I_GLAcctBalance.GLAccount
and I_SemTagGLAccount.GLAccountHierarchy = I_SOCTYPESEMTAG.GLAccountHierarchy
and I_SemTagGLAccount.SemanticTag = I_SOCTYPESEMTAG.SemanticTag
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
association [0..1] to I_GLAccountInChartOfAccounts as _GLAccountInChartOfAccounts on $projection.ChartOfAccounts = _GLAccountInChartOfAccounts.ChartOfAccounts
and $projection.GLAccount = _GLAccountInChartOfAccounts.GLAccount
association [0..1] to I_FiscalPeriodForVariant as _FiscalPeriodForVariant on $projection.FiscalYearVariant = _FiscalPeriodForVariant.FiscalYearVariant
and $projection.LedgerFiscalYear = _FiscalPeriodForVariant.FiscalYear
and $projection.FiscalPeriod = _FiscalPeriodForVariant.FiscalPeriod
association [1..1] to I_FinancialTransactionType as _FinancialTransactionType on $projection.FinancialTransactionType = _FinancialTransactionType.FinancialTransactionType
{
@ObjectModel.foreignKey.association: '_Ledger'
key I_GLAcctBalance.Ledger,
@ObjectModel.foreignKey.association: '_CompanyCode'
key I_GLAcctBalance.CompanyCode,
@ObjectModel.foreignKey.association: '_FiscalYear'
//@Semantics.fiscal.year: true
key FiscalYear,
key I_soc_ta.StatementOfChangesSortOrder,
@ObjectModel.foreignKey.association: '_FinancialTransactionType'
key I_soc_ta.FinancialTransactionType,
LedgerFiscalYear,
@ObjectModel.foreignKey.association: '_GLAccountInChartOfAccounts'
I_GLAcctBalance.GLAccount,
// @ObjectModel.foreignKey.association: '_GLAccountHierarchy'
// GLAccountHierarchy,
@ObjectModel.foreignKey.association: '_ProfitCenter'
ProfitCenter,
@ObjectModel.foreignKey.association: '_FunctionalArea'
FunctionalArea,
@ObjectModel.foreignKey.association: '_BusinessArea'
BusinessArea,
@ObjectModel.foreignKey.association: '_ControllingArea'
ControllingArea,
@ObjectModel.foreignKey.association: '_Segment'
Segment,
@ObjectModel.foreignKey.association: '_DebitCreditCode'
DebitCreditCode,
@ObjectModel.foreignKey.association: '_FiscalYearVariant'
I_GLAcctBalance.FiscalYearVariant,
FiscalYearPeriod,
@ObjectModel.foreignKey.association: '_FiscalCalendarDate'
PostingDate,
@ObjectModel.foreignKey.association: '_ChartOfAccounts'
I_GLAcctBalance.ChartOfAccounts,
@Semantics.currencyCode:true
@ObjectModel.foreignKey.association: '_TransactionCurrency'
TransactionCurrency,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'TransactionCurrency'} }
AmountInTransactionCurrency,
@Semantics.currencyCode:true
@ObjectModel.foreignKey.association: '_CompanyCodeCurrency'
CompanyCodeCurrency,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'CompanyCodeCurrency'} }
AmountInCompanyCodeCurrency,
@Semantics.currencyCode:true
@ObjectModel.foreignKey.association: '_GlobalCurrency'
GlobalCurrency,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'GlobalCurrency'} }
AmountInGlobalCurrency,
@Semantics.currencyCode:true
@ObjectModel.foreignKey.association: '_FreeDefinedCurrency1'
FreeDefinedCurrency1,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'FreeDefinedCurrency1'} }
AmountInFreeDefinedCurrency1,
@Semantics.currencyCode:true
@ObjectModel.foreignKey.association: '_FreeDefinedCurrency2'
FreeDefinedCurrency2,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'FreeDefinedCurrency2'} }
AmountInFreeDefinedCurrency2,
@Semantics.currencyCode:true
@ObjectModel.foreignKey.association: '_FreeDefinedCurrency3'
FreeDefinedCurrency3,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'FreeDefinedCurrency3'} }
AmountInFreeDefinedCurrency3,
@Semantics.currencyCode:true
@ObjectModel.foreignKey.association: '_FreeDefinedCurrency4'
FreeDefinedCurrency4,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'FreeDefinedCurrency4'} }
AmountInFreeDefinedCurrency4,
@Semantics.currencyCode:true
@ObjectModel.foreignKey.association: '_FreeDefinedCurrency5'
FreeDefinedCurrency5,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'FreeDefinedCurrency5'} }
AmountInFreeDefinedCurrency5,
@Semantics.currencyCode:true
@ObjectModel.foreignKey.association: '_FreeDefinedCurrency6'
FreeDefinedCurrency6,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'FreeDefinedCurrency6'} }
AmountInFreeDefinedCurrency6,
@Semantics.currencyCode:true
@ObjectModel.foreignKey.association: '_FreeDefinedCurrency7'
FreeDefinedCurrency7,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'FreeDefinedCurrency7'} }
AmountInFreeDefinedCurrency7,
@Semantics.currencyCode:true
@ObjectModel.foreignKey.association: '_FreeDefinedCurrency8'
FreeDefinedCurrency8,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'FreeDefinedCurrency8'} }
AmountInFreeDefinedCurrency8,
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
_FiscalCalendarDate.FiscalQuarter as FiscalQuarter,
_FiscalCalendarDate.FiscalWeek as FiscalWeek,
_FiscalCalendarDate.FiscalYearQuarter as FiscalYearQuarter,
_FiscalCalendarDate.FiscalYearWeek as FiscalYearWeek,
_FiscalPeriodForVariant.FiscalPeriodStartDate,
_FiscalPeriodForVariant.FiscalPeriodEndDate,
_CompanyCode,
_FiscalYear,
_ControllingArea,
_TransactionCurrency,
_CompanyCodeCurrency,
_GlobalCurrency,
_FreeDefinedCurrency1,
_FreeDefinedCurrency2,
_FreeDefinedCurrency3,
_FreeDefinedCurrency4,
_FreeDefinedCurrency5,
_FreeDefinedCurrency6,
_FreeDefinedCurrency7,
_FreeDefinedCurrency8,
_Segment,
_ProfitCenter,
_BusinessArea,
_FunctionalArea,
_GLAccountInChartOfAccounts,
_ChartOfAccounts,
_DebitCreditCode,
_Ledger,
_FiscalCalendarDate,
_FiscalYearVariant,
_FinancialTransactionType,
_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
@Semantics.currencyCode:true
case
// when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles. then cast (CompanyCodeCurrency as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.CompanyCodeCurrencyRole then cast (CompanyCodeCurrency as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.GlobalCurrencyRole then cast (GlobalCurrency as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency1Role then cast (FreeDefinedCurrency1 as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency2Role then cast (FreeDefinedCurrency2 as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency3Role then cast (FreeDefinedCurrency3 as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency4Role then cast (FreeDefinedCurrency4 as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency5Role then cast (FreeDefinedCurrency5 as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency6Role then cast (FreeDefinedCurrency6 as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency7Role then cast (FreeDefinedCurrency7 as vdm_v_display_currency preserving type)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency8Role then cast (FreeDefinedCurrency8 as vdm_v_display_currency preserving type)
else cast('' as vdm_v_display_currency)
end as DisplayCurrency,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'DisplayCurrency'
case when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.CompanyCodeCurrencyRole then cast(AmountInCompanyCodeCurrency as farp_amount_display_crcy)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.GlobalCurrencyRole then cast(AmountInGlobalCurrency as farp_amount_display_crcy)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency1Role then cast(AmountInFreeDefinedCurrency1 as farp_amount_display_crcy)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency2Role then cast(AmountInFreeDefinedCurrency2 as farp_amount_display_crcy)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency3Role then cast(AmountInFreeDefinedCurrency3 as farp_amount_display_crcy)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency4Role then cast(AmountInFreeDefinedCurrency4 as farp_amount_display_crcy)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency5Role then cast(AmountInFreeDefinedCurrency5 as farp_amount_display_crcy)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency6Role then cast(AmountInFreeDefinedCurrency6 as farp_amount_display_crcy)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency7Role then cast(AmountInFreeDefinedCurrency7 as farp_amount_display_crcy)
when P_LedgerCompanyCodeCrcyRoles.CurrencyRole = I_LedgerCompanyCodeCrcyRoles.FreeDefinedCurrency8Role then cast(AmountInFreeDefinedCurrency8 as farp_amount_display_crcy)
else cast('0' as farp_amount_display_crcy)
end as AmountInDisplayCurrency
}
where
I_GLAcctBalance.Ledger = $parameters.P_Ledger
and I_GLAcctBalance.CompanyCode = $parameters.P_CompanyCode
and FiscalYear = $parameters.P_FiscalYear
and FiscalPeriod <= $parameters.P_FiscalPeriod
and P_LedgerCompanyCodeCrcyRoles.CurrencyRole = $parameters.P_CurrencyRole