I_StatementOfChanges

DDL: I_STATEMENTOFCHANGES SQL: ISTMNTOFCHANGES Type: view COMPOSITE

Statement of Changes line items

I_StatementOfChanges is a Composite CDS View (Cube) that provides data about "Statement of Changes line items" in SAP S/4HANA. It reads from 5 data sources (I_GLAccountLineItem, I_LedgerCompanyCodeCrcyRoles, I_SemTagGLAccount, I_StatementOfChangesSemTag, P_LedgerCompanyCodeCrcyRoles) and exposes 98 fields with key fields Ledger, CompanyCode, FiscalYear, StatementOfChangesSortOrder, FinancialTransactionType. It has 3 associations to related views.

Data Sources (5)

SourceAliasJoin Type
I_GLAccountLineItem I_GLAcctBalance from
I_LedgerCompanyCodeCrcyRoles I_LedgerCompanyCodeCrcyRoles inner
I_SemTagGLAccount I_SemTagGLAccount right_outer
I_StatementOfChangesSemTag I_SOCTYPESEMTAG right_outer
P_LedgerCompanyCodeCrcyRoles P_LedgerCompanyCodeCrcyRoles inner

Parameters (6)

NameTypeDefault
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

Associations (3)

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

Annotations (19)

NameValueLevelField
AbapCatalog.sqlViewName ISTMNTOFCHANGES view
VDM.lifecycle.contract.type #PUBLIC_LOCAL_API view
AbapCatalog.preserveKey true view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.dataMaintenance #RESTRICTED view
Analytics.dataCategory #CUBE view
VDM.viewType #COMPOSITE view
AccessControl.authorizationCheck #CHECK view
ClientHandling.algorithm #SESSION_VARIABLE view
AbapCatalog.buffering.status #NOT_ALLOWED view
Metadata.ignorePropagatedAnnotations true view
Metadata.allowExtensions true view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.modelingPattern #ANALYTICAL_CUBE view
AccessControl.personalData.blocking #REQUIRED view
EndUserText.label Statement of Changes line items view
Analytics.internalName #LOCAL view

Fields (98)

KeyFieldSource TableSource FieldDescription
KEY Ledger I_GLAccountLineItem Ledger
KEY CompanyCode I_GLAccountLineItem CompanyCode
KEY FiscalYear FiscalYear
KEY StatementOfChangesSortOrder I_soc_ta StatementOfChangesSortOrder
KEY FinancialTransactionType I_soc_ta FinancialTransactionType
LedgerFiscalYear LedgerFiscalYear
GLAccount I_GLAccountLineItem GLAccount
ProfitCenter ProfitCenter
FunctionalArea FunctionalArea
BusinessArea BusinessArea
ControllingArea ControllingArea
Segment Segment
DebitCreditCode DebitCreditCode
FiscalYearVariant I_GLAccountLineItem FiscalYearVariant
FiscalYearPeriod FiscalYearPeriod
PostingDate PostingDate
ChartOfAccounts I_GLAccountLineItem ChartOfAccounts
TransactionCurrency TransactionCurrency
AmountInTransactionCurrency AmountInTransactionCurrency
CompanyCodeCurrency CompanyCodeCurrency
AmountInCompanyCodeCurrency AmountInCompanyCodeCurrency
GlobalCurrency GlobalCurrency
AmountInGlobalCurrency AmountInGlobalCurrency
FreeDefinedCurrency1 FreeDefinedCurrency1
AmountInFreeDefinedCurrency1 AmountInFreeDefinedCurrency1
FreeDefinedCurrency2 FreeDefinedCurrency2
AmountInFreeDefinedCurrency2 AmountInFreeDefinedCurrency2
FreeDefinedCurrency3 FreeDefinedCurrency3
AmountInFreeDefinedCurrency3 AmountInFreeDefinedCurrency3
FreeDefinedCurrency4 FreeDefinedCurrency4
AmountInFreeDefinedCurrency4 AmountInFreeDefinedCurrency4
FreeDefinedCurrency5 FreeDefinedCurrency5
AmountInFreeDefinedCurrency5 AmountInFreeDefinedCurrency5
FreeDefinedCurrency6 FreeDefinedCurrency6
AmountInFreeDefinedCurrency6 AmountInFreeDefinedCurrency6
FreeDefinedCurrency7 FreeDefinedCurrency7
AmountInFreeDefinedCurrency7 AmountInFreeDefinedCurrency7
FreeDefinedCurrency8 FreeDefinedCurrency8
AmountInFreeDefinedCurrency8 AmountInFreeDefinedCurrency8
FiscalPeriod 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 _FiscalCalendarDate FiscalQuarter
FiscalWeek _FiscalCalendarDate FiscalWeek
FiscalYearQuarter _FiscalCalendarDate FiscalYearQuarter
FiscalYearWeek _FiscalCalendarDate FiscalYearWeek
FiscalPeriodStartDate _FiscalPeriodForVariant FiscalPeriodStartDate
FiscalPeriodEndDate _FiscalPeriodForVariant FiscalPeriodEndDate
_CompanyCode _CompanyCode
_FiscalYear _FiscalYear
_ControllingArea _ControllingArea
_TransactionCurrency _TransactionCurrency
_CompanyCodeCurrency _CompanyCodeCurrency
_GlobalCurrency _GlobalCurrency
_FreeDefinedCurrency1 _FreeDefinedCurrency1
_FreeDefinedCurrency2 _FreeDefinedCurrency2
_FreeDefinedCurrency3 _FreeDefinedCurrency3
_FreeDefinedCurrency4 _FreeDefinedCurrency4
_FreeDefinedCurrency5 _FreeDefinedCurrency5
_FreeDefinedCurrency6 _FreeDefinedCurrency6
_FreeDefinedCurrency7 _FreeDefinedCurrency7
_FreeDefinedCurrency8 _FreeDefinedCurrency8
_Segment _Segment
_ProfitCenter _ProfitCenter
_BusinessArea _BusinessArea
_FunctionalArea _FunctionalArea
_GLAccountInChartOfAccounts _GLAccountInChartOfAccounts
_ChartOfAccounts _ChartOfAccounts
_DebitCreditCode _DebitCreditCode
_Ledger _Ledger
_FiscalCalendarDate _FiscalCalendarDate
_FiscalYearVariant _FiscalYearVariant
_FinancialTransactionType _FinancialTransactionType
_PartnerCompany _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.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