@VDM.private: true
@VDM.viewType: #COMPOSITE
@ClientDependent: true
//@Analytics: { dataCategory: #COMPOSITE, dataExtraction.enabled: true }
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@AbapCatalog.sqlViewName: 'PCASHFLOWBASE' //must start with "P"
define view P_Cashflow_Base //must start with "P_"; same as DDL source name in upper-camelcase notation
with parameters
@Environment.systemField: #SYSTEM_LANGUAGE
P_Language : abap.lang
as select from I_CashFlow as flow
association [0..1] to I_CalendarDate as _Date on $projection.CalendarDay = _Date.CalendarDate
//association [0..1] to I_PlanningUnit as _PlanningUnit on $projection.CompanyCode = _PlanningUnit.CompanyCode
association [0..1] to I_LiquidityItem as _LiquidityItem on $projection.LiquidityItem = _LiquidityItem.LiquidityItem
association [0..1] to I_GLAccount as _GLAccount on $projection.CompanyCode = _GLAccount.CompanyCode
and $projection.GLAccount = _GLAccount.GLAccount
{
// key flow.CashFlow,
@ObjectModel.foreignKey.association: '_CompanyCode'
flow.CompanyCode,
_CompanyCode.ControllingArea,
_CompanyCode.Country,
// @ObjectModel.foreignKey.association: '_DemoMasterData'
// flow.LiquidityItem,
// _LiquidityMasterData,
@ObjectModel.foreignKey.association: '_LiquidityItem'
flow.LiquidityItem,
@ObjectModel.foreignKey.association: '_BankAccount'
flow.BankAccountInternalID,
@Semantics.currencyCode: true
case when (flow._BankAccount._BankAccountCurrency.BankAccountCurrency is null or flow._BankAccount._BankAccountCurrency.BankAccountCurrency = '')
then flow.TransactionCurrency
else flow._BankAccount._BankAccountCurrency.BankAccountCurrency
end as TransactionCurrency,
@Semantics.currencyCode: true
case when (flow.TransactionCurrency is null or flow.TransactionCurrency = '')
then flow._BankAccount._BankAccountCurrency.BankAccountCurrency
else flow.TransactionCurrency
end as OriginalTransactionCurrency,
_BankAccount.BankAccountType,
_BankAccount.Bank,
_BankAccount.BankAccountNumber as BankAccount,
_BankAccount._Text[1: Language = $parameters.P_Language].BankAccountDescription,
_BankAccount.BankAccountStatus,
//Time dimensions
flow.TransactionDate as CalendarDay,
_Date.YearWeek as CalendarYearWeek,
_Date.YearMonth as CalendarYearMonth,
_Date.YearQuarter as CalendarYearQuarter,
_Date.CalendarYear as CalendarYear,
flow.FiscalYear,
flow._CompanyCode.FiscalYearVariant,
@Semantics.amount.currencyCode: 'TransactionCurrency'
@DefaultAggregation: #SUM
case when AmountInTransactionCurrency < 0
then flow.AmountInTransactionCurrency
else 0 end as CashOut,
@Semantics.amount.currencyCode: 'TransactionCurrency'
@DefaultAggregation: #SUM
case when AmountInTransactionCurrency >= 0
then flow.AmountInTransactionCurrency
else 0 end as CashIn,
@Semantics.amount.currencyCode: 'TransactionCurrency'
@DefaultAggregation: #SUM
flow.AmountInTransactionCurrency,
flow.PaymentMethod,
flow.OriginApplication,
flow.CertaintyLevel,
@ObjectModel.foreignKey.association: '_GLAccount' //Inserted by VDM CDS Suite Plugin
flow.GLAccount,
--flow.DocumentItemText,
flow.Customer,
flow.Supplier,
// flow.Supplier as Vendor,
flow.BusinessPartner,
flow.Material,
flow.BusinessArea,
flow.ProfitCenter,
@ObjectModel.foreignKey.association: '_WBSElement'
flow.WBSElementInternalID,
flow.WBSElement,
flow.PartnerCompany,
// flow.PartnerCompany as TradingPartner,
flow.CostCenter,
flow.Segment,
@ObjectModel.foreignKey.association: '_CashPlanningGroup'
flow.CashPlanningGroup,
@ObjectModel.foreignKey.association: '_PlanningLevel' //Inserted by VDM CDS Suite Plugin
flow.PlanningLevel,
flow.ExpirationDate,
flow.HouseBank,
flow.HouseBankAccount,
flow.SourceCompanyCode,
flow._WBSElement.ResponsibleCostCenter,
flow._WBSElement._Project.Project,
// @ObjectModel.foreignKey.association: '_PlanningUnit'
// _PlanningUnit.PlanningUnit,
// _PlanningUnit.PlanningUnitText,
// _PlanningUnit.Reviewer,
// _PlanningUnit
// association
_CompanyCode,
_LiquidityItem,
_BankAccount,
_GLAccount,
_WBSElement,
_CashPlanningGroup,
_PlanningLevel --,
}
where
CertaintyLevel <> 'ACTUAL'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_BANKACCOUNT",
"I_BANKACCOUNTCURRENCY",
"I_BANKACCOUNTTEXT",
"I_CALENDARDATE",
"I_CASHFLOW",
"I_COMPANYCODE",
"I_PROJECTBYINTERNALKEY",
"I_WBSELEMENTBYINTERNALKEY"
],
"ASSOCIATED":
[
"I_BANKACCOUNT",
"I_CALENDARDATE",
"I_CASHPLANNINGGROUP",
"I_COMPANYCODE",
"I_GLACCOUNT",
"I_LIQUIDITYITEM",
"I_PLANNINGLEVEL",
"I_WBSELEMENTBYINTERNALKEY"
],
"BASE":
[
"I_CASHFLOW"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/