I_StatementOfChangesCube

DDL: I_STATEMENTOFCHANGESCUBE Type: view_entity COMPOSITE Package: FIN_GL_FS_REVIEW_BOOKLET

Statement of Changes line items - Cube

I_StatementOfChangesCube is a Composite CDS View (Cube) that provides data about "Statement of Changes line items - Cube" in SAP S/4HANA. It reads from 4 data sources (I_GLAccountHierarchyNode, I_GLAccountLineItem, I_LedgerCompanyCodeCrcyRoles, P_LedgerCompanyCodeCrcyRoles) and exposes 107 fields with key fields SourceLedger, Ledger, CompanyCode, FiscalYear, AccountingDocument. It has 3 associations to related views. Part of development package FIN_GL_FS_REVIEW_BOOKLET.

Data Sources (4)

SourceAliasJoin Type
I_GLAccountHierarchyNode _GLAccountHierarchyNode inner
I_GLAccountLineItem I_GLAcctBalance from
I_LedgerCompanyCodeCrcyRoles I_LedgerCompanyCodeCrcyRoles inner
P_LedgerCompanyCodeCrcyRoles P_LedgerCompanyCodeCrcyRoles inner

Parameters (6)

NameTypeDefault
P_KeyDate sydatum
P_GLAccountHierarchy fis_glaccthier
P_Ledger fis_rldnr
P_LedgerFiscalYear fis_gjahr
P_ToFiscalPeriod fis_period_to
P_CurrencyRole fins_curtp

Associations (3)

CardinalityTargetAliasCondition
[0..1] I_GLAccountInChartOfAccounts _GLAccountInChartOfAccounts $projection.ChartOfAccounts = _GLAccountInChartOfAccounts.ChartOfAccounts and $projection.GLAccount = _GLAccountInChartOfAccounts.GLAccount
[1..1] I_FinancialTransactionType _FinancialTransactionType $projection.FinancialTransactionType = _FinancialTransactionType.FinancialTransactionType
[0..1] I_FiscalPeriodForVariant _FiscalPeriodForVariant $projection.FiscalYearVariant = _FiscalPeriodForVariant.FiscalYearVariant and $projection.LedgerFiscalYear = _FiscalPeriodForVariant.FiscalYear and $projection.FiscalPeriod = _FiscalPeriodForVariant.FiscalPeriod

Annotations (14)

NameValueLevelField
AbapCatalog.dataMaintenance #RESTRICTED view
AccessControl.authorizationCheck #MANDATORY view
AccessControl.personalData.blocking #REQUIRED view
Analytics.internalName #LOCAL view
Analytics.dataCategory #CUBE view
EndUserText.label Statement of Changes line items - Cube view
Metadata.allowExtensions true view
Metadata.ignorePropagatedAnnotations true view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.modelingPattern #ANALYTICAL_CUBE view
VDM.lifecycle.contract.type #PUBLIC_LOCAL_API view
VDM.viewType #COMPOSITE view

Fields (107)

KeyFieldSource TableSource FieldDescription
KEY SourceLedger I_GLAccountLineItem SourceLedger
KEY Ledger I_GLAccountLineItem Ledger
KEY CompanyCode I_GLAccountLineItem CompanyCode
KEY FiscalYear I_GLAccountLineItem FiscalYear
KEY AccountingDocument I_GLAccountLineItem AccountingDocument
KEY LedgerGLLineItem I_GLAccountLineItem LedgerGLLineItem
FinancialTransactionType I_GLAccountLineItem FinancialTransactionType
LedgerFiscalYear I_GLAccountLineItem LedgerFiscalYear
ChartOfAccounts I_GLAccountLineItem ChartOfAccounts
GLAccount I_GLAccountLineItem GLAccount
GLAccountHierarchy I_GLAccountHierarchyNode GLAccountHierarchy
HierarchyNode I_GLAccountHierarchyNode HierarchyNode
ParentNode I_GLAccountHierarchyNode ParentNode
ValidityStartDate I_GLAccountHierarchyNode ValidityStartDate
ValidityEndDate I_GLAccountHierarchyNode ValidityEndDate
HierarchyNodeSequence I_GLAccountHierarchyNode HierarchyNodeSequence
ProfitCenter I_GLAccountLineItem ProfitCenter
FunctionalArea I_GLAccountLineItem FunctionalArea
BusinessArea I_GLAccountLineItem BusinessArea
ControllingArea I_GLAccountLineItem ControllingArea
Segment I_GLAccountLineItem Segment
DebitCreditCode I_GLAccountLineItem DebitCreditCode
FiscalYearVariant I_GLAccountLineItem FiscalYearVariant
FiscalYearPeriod I_GLAccountLineItem FiscalYearPeriod
PostingDate I_GLAccountLineItem PostingDate
TransactionCurrency I_GLAccountLineItem TransactionCurrency
AmountInTransactionCurrency I_GLAccountLineItem AmountInTransactionCurrency
CompanyCodeCurrency I_GLAccountLineItem CompanyCodeCurrency
AmountInCompanyCodeCurrency I_GLAccountLineItem AmountInCompanyCodeCurrency
GlobalCurrency I_GLAccountLineItem GlobalCurrency
AmountInGlobalCurrency I_GLAccountLineItem AmountInGlobalCurrency
FreeDefinedCurrency1 I_GLAccountLineItem FreeDefinedCurrency1
AmountInFreeDefinedCurrency1 I_GLAccountLineItem AmountInFreeDefinedCurrency1
FreeDefinedCurrency2 I_GLAccountLineItem FreeDefinedCurrency2
AmountInFreeDefinedCurrency2 I_GLAccountLineItem AmountInFreeDefinedCurrency2
FreeDefinedCurrency3 I_GLAccountLineItem FreeDefinedCurrency3
AmountInFreeDefinedCurrency3 I_GLAccountLineItem AmountInFreeDefinedCurrency3
FreeDefinedCurrency4 I_GLAccountLineItem FreeDefinedCurrency4
AmountInFreeDefinedCurrency4 I_GLAccountLineItem AmountInFreeDefinedCurrency4
FreeDefinedCurrency5 I_GLAccountLineItem FreeDefinedCurrency5
AmountInFreeDefinedCurrency5 I_GLAccountLineItem AmountInFreeDefinedCurrency5
FreeDefinedCurrency6 I_GLAccountLineItem FreeDefinedCurrency6
AmountInFreeDefinedCurrency6 I_GLAccountLineItem AmountInFreeDefinedCurrency6
FreeDefinedCurrency7 I_GLAccountLineItem FreeDefinedCurrency7
AmountInFreeDefinedCurrency7 I_GLAccountLineItem AmountInFreeDefinedCurrency7
FreeDefinedCurrency8 I_GLAccountLineItem FreeDefinedCurrency8
AmountInFreeDefinedCurrency8 I_GLAccountLineItem AmountInFreeDefinedCurrency8
FiscalPeriod I_GLAccountLineItem FiscalPeriod
OrderID I_GLAccountLineItem OrderID
Supplier I_GLAccountLineItem Supplier
CostCenter I_GLAccountLineItem CostCenter
OrganizationDivision I_GLAccountLineItem OrganizationDivision
ServiceDocumentType I_GLAccountLineItem ServiceDocumentType
AssetClass I_GLAccountLineItem AssetClass
Plant I_GLAccountLineItem Plant
ValuationArea I_GLAccountLineItem ValuationArea
FinancialAccountType I_GLAccountLineItem FinancialAccountType
SalesDocument I_GLAccountLineItem SalesDocument
SalesOrganization I_GLAccountLineItem SalesOrganization
DistributionChannel I_GLAccountLineItem DistributionChannel
ServiceDocument I_GLAccountLineItem ServiceDocument
Customer I_GLAccountLineItem Customer
AccountingDocumentType I_GLAccountLineItem AccountingDocumentType
ServiceDocumentItem I_GLAccountLineItem ServiceDocumentItem
PartnerCompany I_GLAccountLineItem PartnerCompany
FiscalQuarter
FiscalWeek
FiscalYearQuarter
FiscalYearWeek
FiscalPeriodStartDate
FiscalPeriodEndDate
_CompanyCode I_GLAccountLineItem _CompanyCode
_FiscalYear I_GLAccountLineItem _FiscalYear
_ControllingArea I_GLAccountLineItem _ControllingArea
_TransactionCurrency I_GLAccountLineItem _TransactionCurrency
_CompanyCodeCurrency I_GLAccountLineItem _CompanyCodeCurrency
_GlobalCurrency I_GLAccountLineItem _GlobalCurrency
_FreeDefinedCurrency1 I_GLAccountLineItem _FreeDefinedCurrency1
_FreeDefinedCurrency2 I_GLAccountLineItem _FreeDefinedCurrency2
_FreeDefinedCurrency3 I_GLAccountLineItem _FreeDefinedCurrency3
_FreeDefinedCurrency4 I_GLAccountLineItem _FreeDefinedCurrency4
_FreeDefinedCurrency5 I_GLAccountLineItem _FreeDefinedCurrency5
_FreeDefinedCurrency6 I_GLAccountLineItem _FreeDefinedCurrency6
_FreeDefinedCurrency7 I_GLAccountLineItem _FreeDefinedCurrency7
_FreeDefinedCurrency8 I_GLAccountLineItem _FreeDefinedCurrency8
_Segment I_GLAccountLineItem _Segment
_ProfitCenter I_GLAccountLineItem _ProfitCenter
_BusinessArea I_GLAccountLineItem _BusinessArea
_FunctionalArea I_GLAccountLineItem _FunctionalArea
_ChartOfAccounts I_GLAccountLineItem _ChartOfAccounts
_DebitCreditCode I_GLAccountLineItem _DebitCreditCode
_Ledger I_GLAccountLineItem _Ledger
_FiscalCalendarDate I_GLAccountLineItem _FiscalCalendarDate
_FiscalYearVariant I_GLAccountLineItem _FiscalYearVariant
_GLAccountInChartOfAccounts _GLAccountInChartOfAccounts
_FiscalPeriodForVariant _FiscalPeriodForVariant
_FinancialTransactionType _FinancialTransactionType
_PartnerCompany I_GLAccountLineItem _PartnerCompany
_GLAccountInCompanyCode I_GLAccountLineItem _GLAccountInCompanyCode
_Supplier I_GLAccountLineItem _Supplier
_Order I_GLAccountLineItem _Order
_CurrentCostCenter I_GLAccountLineItem _CurrentCostCenter
_SalesDocument I_GLAccountLineItem _SalesDocument
_CurrentProfitCenter I_GLAccountLineItem _CurrentProfitCenter
_ServiceDocument I_GLAccountLineItem _ServiceDocument
_Customer I_GLAccountLineItem _Customer
_AccountingDocumentType I_GLAccountLineItem _AccountingDocumentType
@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