P_FixedAssetValueCube

DDL: P_FIXEDASSETVALUECUBE SQL: PFASSETVALUECUBE Type: view COMPOSITE Package: FINS_FIS_AA_MD

P_FixedAssetValueCube

P_FixedAssetValueCube is a Composite CDS View that provides data about "P_FixedAssetValueCube" in SAP S/4HANA. It reads from 4 data sources (I_FiscalYearPeriodForLedger, I_FiscalYearPeriodForLedger, I_FixedAssetValueForToFsclPerd, I_FixedAssetValueForToFsclPerd) and exposes 249 fields with key fields CompanyCode, AssetDepreciationArea, MasterFixedAsset, FixedAsset, Ledger. Part of development package FINS_FIS_AA_MD.

Data Sources (4)

SourceAliasJoin Type
I_FiscalYearPeriodForLedger I_FiscalYearPeriodForLedger inner
I_FiscalYearPeriodForLedger I_FiscalYearPeriodForLedger inner
I_FixedAssetValueForToFsclPerd I_FixedAssetValueForToFsclPerd from
I_FixedAssetValueForToFsclPerd I_FixedAssetValueForToFsclPerd union_all

Parameters (4)

NameTypeDefault
P_CurrencyRole fis_curtp
P_FiscalYear fis_gjahr
P_FiscalPeriod fis_poper
P_AssetAccountingKeyFigureSet faa_key_figure_set

Annotations (6)

NameValueLevelField
AbapCatalog.sqlViewName PFASSETVALUECUBE view
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.viewType #COMPOSITE view
VDM.private true view
ClientHandling.algorithm #SESSION_VARIABLE view
Metadata.ignorePropagatedAnnotations true view

Fields (249)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_FixedAssetValue CompanyCode
KEY AssetDepreciationArea AssetDepreciationArea
KEY MasterFixedAsset MasterFixedAsset
KEY FixedAsset FixedAsset
KEY Ledger I_FixedAssetValue Ledger
KEY FiscalYear I_FixedAssetValue FiscalYear
KEY FiscalPeriod I_FixedAssetValue FiscalPeriod
KEY SubLedgerAcctLineItemType SubLedgerAcctLineItemType
KEY AssetAcctTransClassfctn AssetAcctTransClassfctn
KEY AssetAccountingKeyFigure AssetAccountingKeyFigure
KEY AssetAccountingKeyFigureSet AssetAccountingKeyFigureSet
KEY AccountingDocument AccountingDocument
KEY TransactionSubitem TransactionSubitem
KEY DebitCreditCode DebitCreditCode
LedgerFiscalYear LedgerFiscalYear
FiscalYearVariant I_FixedAssetValue FiscalYearVariant
FiscalYearPeriod I_FixedAssetValue FiscalYearPeriod
DepreciationFiscalPeriod DepreciationFiscalPeriod
PlannedValueIsInclusive PlannedValueIsInclusive
AssetAccountingSortedKeyFigure AssetAccountingSortedKeyFigure
LedgerGroup LedgerGroup
Country I_FixedAssetValue Country
ChartOfAccounts I_FixedAssetValue ChartOfAccounts
GLAccount GLAccount
AlternativeGLAccount AlternativeGLAccount
GroupMasterFixedAsset GroupMasterFixedAsset
GroupFixedAsset GroupFixedAsset
FinancialAccountType FinancialAccountType
AccountingDocumentCreationDate AccountingDocumentCreationDate
CreationTime CreationTime
JointVentureCostRecoveryCode JointVentureCostRecoveryCode
ChartOfDepreciation ChartOfDepreciation
CostCenter CostCenter
Plant Plant
BusinessArea BusinessArea
PersonnelNumber PersonnelNumber
FinancialManagementArea FinancialManagementArea
Fund Fund
GrantID GrantID
FunctionalArea FunctionalArea
BudgetPeriod BudgetPeriod
ProfitCenter ProfitCenter
Segment Segment
FundsCenter FundsCenter
AssetTransactionType AssetTransactionType
ControllingArea ControllingArea
CountryChartOfAccounts CountryChartOfAccounts
FinancialStatementVariant I_FixedAssetValue FinancialStatementVariant
AccountingPrinciple I_FixedAssetValue AccountingPrinciple
GLBusinessTransactionType GLBusinessTransactionType
AssetAccountDetermination AssetAccountDetermination
AssetClass AssetClass
AssetCapitalizationDate AssetCapitalizationDate
FirstAcquisitionFiscalYear FirstAcquisitionFiscalYear
FirstAcquisitionFiscalPeriod FirstAcquisitionFiscalPeriod
AssetDeactivationDate AssetDeactivationDate
FixedAssetGroup FixedAssetGroup
AssetSupplierName AssetSupplierName
InvestmentOrder InvestmentOrder
BaseUnit BaseUnit
InventoryIsCounted InventoryIsCounted
LastInventoryDate LastInventoryDate
Inventory Inventory
Group1AssetEvaluationKey Group1AssetEvaluationKey
Group2AssetEvaluationKey Group2AssetEvaluationKey
Group3AssetEvaluationKey Group3AssetEvaluationKey
Group4AssetEvaluationKey Group4AssetEvaluationKey
Group5AssetEvaluationKey Group5AssetEvaluationKey
AssetSerialNumber AssetSerialNumber
NationalClassification NationalClassification
TaxDepreciationGroup TaxDepreciationGroup
AssetIsRetiredOnFiscalPerdEnd
FiscalPeriodEndDate I_FiscalYearPeriodForLedger FiscalPeriodEndDate
WBSElementExternalID _WBSElement WBSElementExternalID
_CompanyCode I_FixedAssetValue _CompanyCode
_Country I_FixedAssetValue _Country
_DepreciationArea _DepreciationArea
_MasterFixedAsset _MasterFixedAsset
_FixedAsset _FixedAsset
_Ledger I_FixedAssetValue _Ledger
_FiscalYear I_FixedAssetValue _FiscalYear
_FiscalPeriod I_FixedAssetValue _FiscalPeriod
_JournalEntry _JournalEntry
_SubLedgerAccLineItemType _SubLedgerAccLineItemType
_AssetAcctTransClassfctn _AssetAcctTransClassfctn
_AssetKeyFigure _AssetKeyFigure
_AssetKeyFigureSet _AssetKeyFigureSet
_AssetSortedKeyFigureSetSpec _AssetSortedKeyFigureSetSpec
_LedgerGroup _LedgerGroup
_ChartOfAccounts _ChartOfAccounts
_GLAccountInChartOfAccounts _GLAccountInChartOfAccounts
_AlternativeGLAccount _AlternativeGLAccount
_FinancialAccountType _FinancialAccountType
_ChartOfDepreciation _ChartOfDepreciation
_CostCenter _CostCenter
_Plant _Plant
_BusinessArea _BusinessArea
_ProfitCenter _ProfitCenter
_Segment _Segment
_FunctionalArea _FunctionalArea
_AssetTransactionType _AssetTransactionType
_ControllingArea _ControllingArea
_CountryChartOfAccounts _CountryChartOfAccounts
_FinancialStatementVersion _FinancialStatementVersion
_AccountingPrinciple _AccountingPrinciple
_AssetAccountDetermination _AssetAccountDetermination
_AssetClass _AssetClass
_FixedAssetGroup _FixedAssetGroup
_InvestmentOrder _InvestmentOrder
_UnitOfMeasure _UnitOfMeasure
_Group1AssetEvaluationKey _Group1AssetEvaluationKey
_Group2AssetEvaluationKey _Group2AssetEvaluationKey
_Group3AssetEvaluationKey _Group3AssetEvaluationKey
_Group4AssetEvaluationKey _Group4AssetEvaluationKey
_Group5AssetEvaluationKey _Group5AssetEvaluationKey
_FiscalYearVariant I_FixedAssetValue _FiscalYearVariant
_LedgerFiscalYearForVariant _LedgerFiscalYearForVariant
_FiscalYearPeriodForVariant _FiscalYearPeriodForVariant
_FiscalPeriodForVariant _FiscalPeriodForVariant
_FixedAssetCountryData _FixedAssetCountryData
_FixedAssetNatlClfn _FixedAssetNatlClfn
_TaxDepreciationGroup _TaxDepreciationGroup
_FinancialManagementArea _FinancialManagementArea
_Fund _Fund
CompanyCode
KEY AssetDepreciationArea AssetDepreciationArea
KEY MasterFixedAsset MasterFixedAsset
KEY FixedAsset FixedAsset
KEY Ledger I_FixedAssetValue Ledger
KEY FiscalYear I_FixedAssetValue FiscalYear
KEY FiscalPeriod I_FixedAssetValue FiscalPeriod
KEY SubLedgerAcctLineItemType SubLedgerAcctLineItemType
KEY AssetAcctTransClassfctn AssetAcctTransClassfctn
KEY AssetAccountingKeyFigure AssetAccountingKeyFigure
KEY AssetAccountingKeyFigureSet AssetAccountingKeyFigureSet
KEY AccountingDocument AccountingDocument
KEY TransactionSubitem TransactionSubitem
KEY DebitCreditCode DebitCreditCode
LedgerFiscalYear LedgerFiscalYear
FiscalYearVariant I_FixedAssetValue FiscalYearVariant
FiscalYearPeriod I_FixedAssetValue FiscalYearPeriod
DepreciationFiscalPeriod DepreciationFiscalPeriod
PlannedValueIsInclusive PlannedValueIsInclusive
AssetAccountingSortedKeyFigure AssetAccountingSortedKeyFigure
LedgerGroup LedgerGroup
Country I_FixedAssetValue Country
ChartOfAccounts I_FixedAssetValue ChartOfAccounts
GLAccount GLAccount
AlternativeGLAccount AlternativeGLAccount
GroupMasterFixedAsset GroupMasterFixedAsset
GroupFixedAsset GroupFixedAsset
FinancialAccountType FinancialAccountType
AccountingDocumentCreationDate AccountingDocumentCreationDate
CreationTime CreationTime
JointVentureCostRecoveryCode JointVentureCostRecoveryCode
ChartOfDepreciation ChartOfDepreciation
CostCenter CostCenter
Plant Plant
BusinessArea BusinessArea
PersonnelNumber PersonnelNumber
FinancialManagementArea FinancialManagementArea
Fund Fund
GrantID GrantID
FunctionalArea FunctionalArea
BudgetPeriod BudgetPeriod
ProfitCenter ProfitCenter
Segment Segment
FundsCenter FundsCenter
AssetTransactionType AssetTransactionType
ControllingArea ControllingArea
CountryChartOfAccounts CountryChartOfAccounts
FinancialStatementVariant I_FixedAssetValue FinancialStatementVariant
AccountingPrinciple I_FixedAssetValue AccountingPrinciple
GLBusinessTransactionType GLBusinessTransactionType
AssetAccountDetermination AssetAccountDetermination
AssetClass AssetClass
AssetCapitalizationDate AssetCapitalizationDate
FirstAcquisitionFiscalYear FirstAcquisitionFiscalYear
FirstAcquisitionFiscalPeriod FirstAcquisitionFiscalPeriod
AssetDeactivationDate AssetDeactivationDate
FixedAssetGroup FixedAssetGroup
AssetSupplierName AssetSupplierName
InvestmentOrder InvestmentOrder
BaseUnit BaseUnit
InventoryIsCounted InventoryIsCounted
LastInventoryDate LastInventoryDate
Inventory Inventory
Group1AssetEvaluationKey Group1AssetEvaluationKey
Group2AssetEvaluationKey Group2AssetEvaluationKey
Group3AssetEvaluationKey Group3AssetEvaluationKey
Group4AssetEvaluationKey Group4AssetEvaluationKey
Group5AssetEvaluationKey Group5AssetEvaluationKey
AssetSerialNumber AssetSerialNumber
NationalClassification NationalClassification
TaxDepreciationGroup TaxDepreciationGroup
AssetIsRetiredOnFiscalPerdEnd
FiscalPeriodEndDate I_FiscalYearPeriodForLedger FiscalPeriodEndDate
WBSElementExternalID _WBSElement WBSElementExternalID
_CompanyCode I_FixedAssetValue _CompanyCode
_Country I_FixedAssetValue _Country
_DepreciationArea _DepreciationArea
_MasterFixedAsset _MasterFixedAsset
_FixedAsset _FixedAsset
_Ledger I_FixedAssetValue _Ledger
_FiscalYear I_FixedAssetValue _FiscalYear
_FiscalPeriod I_FixedAssetValue _FiscalPeriod
_JournalEntry _JournalEntry
_SubLedgerAccLineItemType _SubLedgerAccLineItemType
_AssetAcctTransClassfctn _AssetAcctTransClassfctn
_AssetKeyFigure _AssetKeyFigure
_AssetKeyFigureSet _AssetKeyFigureSet
_AssetSortedKeyFigureSetSpec _AssetSortedKeyFigureSetSpec
_LedgerGroup _LedgerGroup
_ChartOfAccounts _ChartOfAccounts
_GLAccountInChartOfAccounts _GLAccountInChartOfAccounts
_AlternativeGLAccount _AlternativeGLAccount
_FinancialAccountType _FinancialAccountType
_ChartOfDepreciation _ChartOfDepreciation
_CostCenter _CostCenter
_Plant _Plant
_BusinessArea _BusinessArea
_ProfitCenter _ProfitCenter
_Segment _Segment
_FunctionalArea _FunctionalArea
_AssetTransactionType _AssetTransactionType
_ControllingArea _ControllingArea
_CountryChartOfAccounts _CountryChartOfAccounts
_FinancialStatementVersion _FinancialStatementVersion
_AccountingPrinciple _AccountingPrinciple
_AssetAccountDetermination _AssetAccountDetermination
_AssetClass _AssetClass
_FixedAssetGroup _FixedAssetGroup
_InvestmentOrder _InvestmentOrder
_UnitOfMeasure _UnitOfMeasure
_Group1AssetEvaluationKey _Group1AssetEvaluationKey
_Group2AssetEvaluationKey _Group2AssetEvaluationKey
_Group3AssetEvaluationKey _Group3AssetEvaluationKey
_Group4AssetEvaluationKey _Group4AssetEvaluationKey
_Group5AssetEvaluationKey _Group5AssetEvaluationKey
_FiscalYearVariant I_FixedAssetValue _FiscalYearVariant
_LedgerFiscalYearForVariant _LedgerFiscalYearForVariant
_FiscalYearPeriodForVariant _FiscalYearPeriodForVariant
_FiscalPeriodForVariant _FiscalPeriodForVariant
_FixedAssetCountryData _FixedAssetCountryData
_FixedAssetNatlClfn _FixedAssetNatlClfn
_TaxDepreciationGroup _TaxDepreciationGroup
_FinancialManagementArea _FinancialManagementArea
_Fund _Fund
_BudgetPeriod _BudgetPeriod
@AbapCatalog.sqlViewName: 'PFASSETVALUECUBE'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #COMPOSITE
@VDM.private:true
@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.ignorePropagatedAnnotations: true

//The union all is used to force the optimizer to choose the right path for the values of the not retired assets

define view P_FixedAssetValueCube
  with parameters
    P_CurrencyRole                : fis_curtp,
    P_FiscalYear                  : fis_gjahr,
    P_FiscalPeriod                : fis_poper,
    P_AssetAccountingKeyFigureSet : faa_key_figure_set

  //as select from I_FixedAssetValue( P_AssetAccountingKeyFigureSet: :P_AssetAccountingKeyFigureSet )

  as select from I_FixedAssetValueForToFsclPerd( P_AssetAccountingKeyFigureSet: :P_AssetAccountingKeyFigureSet, P_FiscalYear: :P_FiscalYear, P_ToFiscalPeriod: :P_FiscalPeriod) as I_FixedAssetValue
    inner join   I_FiscalYearPeriodForLedger on  I_FixedAssetValue.CompanyCode            = I_FiscalYearPeriodForLedger.CompanyCode
                                             and I_FixedAssetValue.Ledger                 = I_FiscalYearPeriodForLedger.Ledger
                                             and I_FiscalYearPeriodForLedger.FiscalYear   = :P_FiscalYear
                                             and I_FiscalYearPeriodForLedger.FiscalPeriod = :P_FiscalPeriod


{
      @ObjectModel.foreignKey.association: '_CompanyCode'
  key I_FixedAssetValue.CompanyCode,
      @ObjectModel.foreignKey.association: '_DepreciationArea'
  key AssetDepreciationArea,
      @ObjectModel.foreignKey.association: '_MasterFixedAsset'
  key MasterFixedAsset,
      @ObjectModel.foreignKey.association: '_FixedAsset'
  key FixedAsset,
      @ObjectModel.foreignKey.association: '_Ledger'
  key I_FixedAssetValue.Ledger,
      @ObjectModel.foreignKey.association: '_FiscalYear'
  key I_FixedAssetValue.FiscalYear,
      //@ObjectModel.foreignKey.association: '_FiscalPeriod'

      @ObjectModel.foreignKey.association: '_FiscalPeriodForVariant'
  key I_FixedAssetValue.FiscalPeriod,
      @ObjectModel.foreignKey.association: '_SubledgerAccLineItemType'
  key SubLedgerAcctLineItemType,
      @ObjectModel.foreignKey.association: '_AssetAcctTransClassfctn'
  key AssetAcctTransClassfctn,
      @ObjectModel.foreignKey.association: '_AssetKeyFigure'
  key AssetAccountingKeyFigure,
      @ObjectModel.foreignKey.association: '_AssetKeyFigureSet'
  key AssetAccountingKeyFigureSet,
      @ObjectModel.foreignKey.association: '_JournalEntry'
  key AccountingDocument,
  key TransactionSubitem,
  key DebitCreditCode,  

      @ObjectModel.foreignKey.association: '_LedgerFiscalYearForVariant'
      @Semantics.fiscal.year: true
      LedgerFiscalYear,
      @ObjectModel.foreignKey.association: '_FiscalYearVariant'
      @Semantics.fiscal.yearVariant: true
      I_FixedAssetValue.FiscalYearVariant,
      @ObjectModel.foreignKey.association: '_FiscalYearPeriodForVariant'
      @Semantics.fiscal.yearPeriod: true
      I_FixedAssetValue.FiscalYearPeriod,
      DepreciationFiscalPeriod,
      //AssetLineItemIsPlannedValue,

      PlannedValueIsInclusive,

      @ObjectModel.foreignKey.association: '_AssetSortedKeyFigureSetSpec'
      AssetAccountingSortedKeyFigure,

      @ObjectModel.foreignKey.association: '_LedgerGroup'
      LedgerGroup,

      @ObjectModel.foreignKey.association: '_Country'
      I_FixedAssetValue.Country,
      @ObjectModel.foreignKey.association: '_ChartOfAccounts'
      I_FixedAssetValue.ChartOfAccounts,

      //@ObjectModel.foreignKey.association: '_AcqnProdnCostGLAccount'

      //_BalanceSheetAccount.AcqnProdnCostGLAccount,

      @ObjectModel.foreignKey.association: '_GLAccountInChartOfAccounts'
      GLAccount,
      @ObjectModel.foreignKey.association: '_AlternativeGLAccount'
      AlternativeGLAccount,
      GroupMasterFixedAsset,
      GroupFixedAsset,
      @ObjectModel.foreignKey.association: '_FinancialAccountType'
      FinancialAccountType,
      @Semantics.businessDate.at: true
      AccountingDocumentCreationDate,
      CreationTime,
      JointVentureCostRecoveryCode,
      @ObjectModel.foreignKey.association: '_ChartOfDepreciation'
      ChartOfDepreciation,

      @ObjectModel.foreignKey.association: '_CostCenter'
      CostCenter,
      @ObjectModel.foreignKey.association: '_Plant'
      Plant,
      @ObjectModel.foreignKey.association: '_BusinessArea'
      BusinessArea,
      PersonnelNumber,
      @ObjectModel.foreignKey.association: '_FinancialManagementArea'
      FinancialManagementArea,
      @ObjectModel.foreignKey.association: '_Fund'
      Fund,
      GrantID,
      @ObjectModel.foreignKey.association: '_FunctionalArea'
      FunctionalArea,
      @ObjectModel.foreignKey.association: '_BudgetPeriod'
      BudgetPeriod,
      @ObjectModel.foreignKey.association: '_ProfitCenter'
      ProfitCenter,
      @ObjectModel.foreignKey.association: '_Segment'
      Segment,
      FundsCenter,
      @ObjectModel.foreignKey.association: '_AssetTransactionType'
      AssetTransactionType,

      @ObjectModel.foreignKey.association: '_ControllingArea'
      ControllingArea,
      @ObjectModel.foreignKey.association: '_CountryChartOfAccounts'
      CountryChartOfAccounts,

      @ObjectModel.foreignKey.association: '_FinancialStatementVersion'
      I_FixedAssetValue.FinancialStatementVariant,
      @ObjectModel.foreignKey.association: '_AccountingPrinciple'
      I_FixedAssetValue.AccountingPrinciple,

      GLBusinessTransactionType,

      @Semantics.currencyCode:true
      case when CompanyCodeCurrencyRole = :P_CurrencyRole then CompanyCodeCurrency
           when GlobalCurrencyRole = :P_CurrencyRole then GlobalCurrency
           when FreeDefinedCurrency1Role = :P_CurrencyRole then FreeDefinedCurrency1
           when FreeDefinedCurrency2Role = :P_CurrencyRole then FreeDefinedCurrency2
           when FreeDefinedCurrency3Role = :P_CurrencyRole then FreeDefinedCurrency3
           when FreeDefinedCurrency4Role = :P_CurrencyRole then FreeDefinedCurrency4
           when FreeDefinedCurrency5Role = :P_CurrencyRole then FreeDefinedCurrency5
           when FreeDefinedCurrency6Role = :P_CurrencyRole then FreeDefinedCurrency6
           when FreeDefinedCurrency7Role = :P_CurrencyRole then FreeDefinedCurrency7
           when FreeDefinedCurrency8Role = :P_CurrencyRole then FreeDefinedCurrency8
        else cast('' as vdm_v_display_currency)
      end                                                                                                                                                                                                                                                                                                        as  DisplayCurrency,

      @DefaultAggregation:#SUM
      @Semantics.amount.currencyCode: 'DisplayCurrency'
      case when CompanyCodeCurrencyRole = :P_CurrencyRole then cast(AmountInCompanyCodeCurrency as farp_amount_display_crcy)
           when GlobalCurrencyRole = :P_CurrencyRole then cast(AmountInGlobalCurrency as farp_amount_display_crcy)
           when FreeDefinedCurrency1Role = :P_CurrencyRole then cast(AmountInFreeDefinedCurrency1 as farp_amount_display_crcy)
           when FreeDefinedCurrency2Role = :P_CurrencyRole then cast(AmountInFreeDefinedCurrency2 as farp_amount_display_crcy)
           when FreeDefinedCurrency3Role = :P_CurrencyRole then cast(AmountInFreeDefinedCurrency3 as farp_amount_display_crcy)
           when FreeDefinedCurrency4Role = :P_CurrencyRole then cast(AmountInFreeDefinedCurrency4 as farp_amount_display_crcy)
           when FreeDefinedCurrency5Role = :P_CurrencyRole then cast(AmountInFreeDefinedCurrency5 as farp_amount_display_crcy)
           when FreeDefinedCurrency6Role = :P_CurrencyRole then cast(AmountInFreeDefinedCurrency6 as farp_amount_display_crcy)
           when FreeDefinedCurrency7Role = :P_CurrencyRole then cast(AmountInFreeDefinedCurrency7 as farp_amount_display_crcy)
           when FreeDefinedCurrency8Role = :P_CurrencyRole then cast(AmountInFreeDefinedCurrency8 as farp_amount_display_crcy)
        else cast('0' as farp_amount_display_crcy)
      end                                                                                                                                                                                                                                                                                                        as  AmountInDisplayCurrency,

      //      @DefaultAggregation:#SUM

      //      @Semantics.amount.currencyCode: 'DisplayCurrency'

      //      case when CompanyCodeCurrencyRole = :P_CurrencyRole then cast(ActualAmountInCompanyCodeCrcy as farp_amount_display_crcy)

      //           when GlobalCurrencyRole = :P_CurrencyRole then cast(ActualAmountInGlobalCurrency as farp_amount_display_crcy)

      //           when FreeDefinedCurrency1Role = :P_CurrencyRole then cast(ActualAmountInFreeDfndCrcy1 as farp_amount_display_crcy)

      //           when FreeDefinedCurrency2Role = :P_CurrencyRole then cast(ActualAmountInFreeDfndCrcy2 as farp_amount_display_crcy)

      //           when FreeDefinedCurrency3Role = :P_CurrencyRole then cast(ActualAmountInFreeDfndCrcy3 as farp_amount_display_crcy)

      //           when FreeDefinedCurrency4Role = :P_CurrencyRole then cast(ActualAmountInFreeDfndCrcy4 as farp_amount_display_crcy)

      //           when FreeDefinedCurrency5Role = :P_CurrencyRole then cast(ActualAmountInFreeDfndCrcy5 as farp_amount_display_crcy)

      //           when FreeDefinedCurrency6Role = :P_CurrencyRole then cast(ActualAmountInFreeDfndCrcy6 as farp_amount_display_crcy)

      //           when FreeDefinedCurrency7Role = :P_CurrencyRole then cast(ActualAmountInFreeDfndCrcy7 as farp_amount_display_crcy)

      //           when FreeDefinedCurrency8Role = :P_CurrencyRole then cast(ActualAmountInFreeDfndCrcy8 as farp_amount_display_crcy)

      //        else cast('0' as farp_amount_display_crcy)

      //      end                                                                                                                                                                                                                                                                                                        as  ActualAmountInDisplayCurrency,


      /* Fields from ANLA */
      @ObjectModel.foreignKey.association: '_AssetAccountDetermination'
      AssetAccountDetermination,
      @ObjectModel.foreignKey.association: '_AssetClass'
      AssetClass,
      AssetCapitalizationDate,
      FirstAcquisitionFiscalYear,
      FirstAcquisitionFiscalPeriod,
      AssetDeactivationDate,
      @ObjectModel.foreignKey.association: '_FixedAssetGroup'
      FixedAssetGroup,
      AssetSupplierName,
      @ObjectModel.foreignKey.association: '_InvestmentOrder'
      InvestmentOrder,
      @ObjectModel.foreignKey.association: '_UnitOfMeasure'
      BaseUnit,
      InventoryIsCounted,
      LastInventoryDate,
      Inventory,
      @ObjectModel.foreignKey.association: '_Group1AssetEvaluationKey'
      Group1AssetEvaluationKey,
      @ObjectModel.foreignKey.association: '_Group2AssetEvaluationKey'
      Group2AssetEvaluationKey,
      @ObjectModel.foreignKey.association: '_Group3AssetEvaluationKey'
      Group3AssetEvaluationKey,
      @ObjectModel.foreignKey.association: '_Group4AssetEvaluationKey'
      Group4AssetEvaluationKey,
      @ObjectModel.foreignKey.association: '_Group5AssetEvaluationKey'
      Group5AssetEvaluationKey,
      AssetSerialNumber,

      @ObjectModel.foreignKey.association: '_FixedAssetNatlClfn'
      NationalClassification,
      @ObjectModel.foreignKey.association: '_TaxDepreciationGroup'
      TaxDepreciationGroup,

      cast('X' as boolean preserving type)                                                                                                                                                                                                                                                                       as  AssetIsRetiredOnFiscalPerdEnd,
      I_FiscalYearPeriodForLedger.FiscalPeriodEndDate,

      _WBSElement.WBSElementExternalID,

      I_FixedAssetValue._CompanyCode,
      I_FixedAssetValue._Country,
      _DepreciationArea,
      _MasterFixedAsset,
      _FixedAsset,
      I_FixedAssetValue._Ledger,
      I_FixedAssetValue._FiscalYear,
      I_FixedAssetValue._FiscalPeriod,
      _JournalEntry,
      _SubLedgerAccLineItemType,
      _AssetAcctTransClassfctn,
      _AssetKeyFigure,
      _AssetKeyFigureSet,
      _AssetSortedKeyFigureSetSpec,
      _LedgerGroup,
      _ChartOfAccounts,
      _GLAccountInChartOfAccounts,
      _AlternativeGLAccount,
      _FinancialAccountType,
      _ChartOfDepreciation,
      _CostCenter,
      _Plant,
      _BusinessArea,
      _ProfitCenter,
      _Segment,
      _FunctionalArea,
      _AssetTransactionType,
      _ControllingArea,
      _CountryChartOfAccounts,
      _FinancialStatementVersion,
      _AccountingPrinciple,
      _AssetAccountDetermination,
      _AssetClass,
      _FixedAssetGroup,
      _InvestmentOrder,
      _UnitOfMeasure,
      _Group1AssetEvaluationKey,
      _Group2AssetEvaluationKey,
      _Group3AssetEvaluationKey,
      _Group4AssetEvaluationKey,
      _Group5AssetEvaluationKey,
      I_FixedAssetValue._FiscalYearVariant,
      _LedgerFiscalYearForVariant,
      _FiscalYearPeriodForVariant,
      _FiscalPeriodForVariant,
      _FixedAssetCountryData,
      _FixedAssetNatlClfn,
      _TaxDepreciationGroup,
      _FinancialManagementArea,
      _Fund,
      _BudgetPeriod
}
where
  //Due to asset accounting configuration changes we no longer restrict IsRealDepreciationArea

  //IsRealDepreciationArea         =  'X' //Due to performance we dont select any values from derived areas not even for BUHBKT = '4'

  //        I_FixedAssetValue.FiscalYear   =  :P_FiscalYear

  //  and   I_FixedAssetValue.FiscalPeriod <= :P_FiscalPeriod

  //  and(

  (
        AssetDeactivationDate <= I_FiscalYearPeriodForLedger.FiscalPeriodEndDate
    and AssetDeactivationDate <> '00000000'
  )

//union all select from I_FixedAssetValue( P_AssetAccountingKeyFigureSet: :P_AssetAccountingKeyFigureSet )

union all select from I_FixedAssetValueForToFsclPerd( P_AssetAccountingKeyFigureSet: :P_AssetAccountingKeyFigureSet, P_FiscalYear: :P_FiscalYear, P_ToFiscalPeriod: :P_FiscalPeriod) as I_FixedAssetValue
  inner join          I_FiscalYearPeriodForLedger on  I_FixedAssetValue.CompanyCode            = I_FiscalYearPeriodForLedger.CompanyCode
                                                  and I_FixedAssetValue.Ledger                 = I_FiscalYearPeriodForLedger.Ledger
                                                  and I_FiscalYearPeriodForLedger.FiscalYear   = :P_FiscalYear
                                                  and I_FiscalYearPeriodForLedger.FiscalPeriod = :P_FiscalPeriod


{
      @ObjectModel.foreignKey.association: '_CompanyCode'
  key I_FixedAssetValue.CompanyCode,
      @ObjectModel.foreignKey.association: '_DepreciationArea'
  key AssetDepreciationArea,
      @ObjectModel.foreignKey.association: '_MasterFixedAsset'
  key MasterFixedAsset,
      @ObjectModel.foreignKey.association: '_FixedAsset'
  key FixedAsset,
      @ObjectModel.foreignKey.association: '_Ledger'
  key I_FixedAssetValue.Ledger,
      @ObjectModel.foreignKey.association: '_FiscalYear'
  key I_FixedAssetValue.FiscalYear,
      //@ObjectModel.foreignKey.association: '_FiscalPeriod'

      @ObjectModel.foreignKey.association: '_FiscalPeriodForVariant'
  key I_FixedAssetValue.FiscalPeriod,
      @ObjectModel.foreignKey.association: '_SubledgerAccLineItemType'
  key SubLedgerAcctLineItemType,
      @ObjectModel.foreignKey.association: '_AssetAcctTransClassfctn'
  key AssetAcctTransClassfctn,
      @ObjectModel.foreignKey.association: '_AssetKeyFigure'
  key AssetAccountingKeyFigure,
      @ObjectModel.foreignKey.association: '_AssetKeyFigureSet'
  key AssetAccountingKeyFigureSet,
      @ObjectModel.foreignKey.association: '_JournalEntry'
  key AccountingDocument,
  key TransactionSubitem,
  key DebitCreditCode,  

      @ObjectModel.foreignKey.association: '_LedgerFiscalYearForVariant'
      @Semantics.fiscal.year: true
      LedgerFiscalYear,
      @ObjectModel.foreignKey.association: '_FiscalYearVariant'
      @Semantics.fiscal.yearVariant: true
      I_FixedAssetValue.FiscalYearVariant,
      @ObjectModel.foreignKey.association: '_FiscalYearPeriodForVariant'
      @Semantics.fiscal.yearPeriod: true
      I_FixedAssetValue.FiscalYearPeriod,
      DepreciationFiscalPeriod,
      //AssetLineItemIsPlannedValue,

      PlannedValueIsInclusive,

      @ObjectModel.foreignKey.association: '_AssetSortedKeyFigureSetSpec'
      AssetAccountingSortedKeyFigure,

      @ObjectModel.foreignKey.association: '_LedgerGroup'
      LedgerGroup,

      @ObjectModel.foreignKey.association: '_Country'
      I_FixedAssetValue.Country,
      @ObjectModel.foreignKey.association: '_ChartOfAccounts'
      I_FixedAssetValue.ChartOfAccounts,

      //@ObjectModel.foreignKey.association: '_AcqnProdnCostGLAccount'

      //_BalanceSheetAccount.AcqnProdnCostGLAccount,

      @ObjectModel.foreignKey.association: '_GLAccountInChartOfAccounts'
      GLAccount,
      @ObjectModel.foreignKey.association: '_AlternativeGLAccount'
      AlternativeGLAccount,
      GroupMasterFixedAsset,
      GroupFixedAsset,
      @ObjectModel.foreignKey.association: '_FinancialAccountType'
      FinancialAccountType,
      @Semantics.businessDate.at: true
      AccountingDocumentCreationDate,
      CreationTime,
      JointVentureCostRecoveryCode,
      @ObjectModel.foreignKey.association: '_ChartOfDepreciation'
      ChartOfDepreciation,

      @ObjectModel.foreignKey.association: '_CostCenter'
      CostCenter,
      @ObjectModel.foreignKey.association: '_Plant'
      Plant,
      @ObjectModel.foreignKey.association: '_BusinessArea'
      BusinessArea,
      PersonnelNumber,
      @ObjectModel.foreignKey.association: '_FinancialManagementArea'
      FinancialManagementArea,
      @ObjectModel.foreignKey.association: '_Fund'
      Fund,
      GrantID,
      @ObjectModel.foreignKey.association: '_FunctionalArea'
      FunctionalArea,
      @ObjectModel.foreignKey.association: '_BudgetPeriod'
      BudgetPeriod,
      @ObjectModel.foreignKey.association: '_ProfitCenter'
      ProfitCenter,
      @ObjectModel.foreignKey.association: '_Segment'
      Segment,
      FundsCenter,
      @ObjectModel.foreignKey.association: '_AssetTransactionType'
      AssetTransactionType,

      @ObjectModel.foreignKey.association: '_ControllingArea'
      ControllingArea,
      @ObjectModel.foreignKey.association: '_CountryChartOfAccounts'
      CountryChartOfAccounts,

      @ObjectModel.foreignKey.association: '_FinancialStatementVersion'
      I_FixedAssetValue.FinancialStatementVariant,
      @ObjectModel.foreignKey.association: '_AccountingPrinciple'
      I_FixedAssetValue.AccountingPrinciple,

      GLBusinessTransactionType,

      @Semantics.currencyCode:true
      case when CompanyCodeCurrencyRole = :P_CurrencyRole then CompanyCodeCurrency
           when GlobalCurrencyRole = :P_CurrencyRole then GlobalCurrency
           when FreeDefinedCurrency1Role = :P_CurrencyRole then FreeDefinedCurrency1
           when FreeDefinedCurrency2Role = :P_CurrencyRole then FreeDefinedCurrency2
           when FreeDefinedCurrency3Role = :P_CurrencyRole then FreeDefinedCurrency3
           when FreeDefinedCurrency4Role = :P_CurrencyRole then FreeDefinedCurrency4
           when FreeDefinedCurrency5Role = :P_CurrencyRole then FreeDefinedCurrency5
           when FreeDefinedCurrency6Role = :P_CurrencyRole then FreeDefinedCurrency6
           when FreeDefinedCurrency7Role = :P_CurrencyRole then FreeDefinedCurrency7
           when FreeDefinedCurrency8Role = :P_CurrencyRole then FreeDefinedCurrency8
        else cast('' as vdm_v_display_currency)
      end                                                                                                                                                                                                                                                                                                        as  DisplayCurrency,

      @DefaultAggregation:#SUM
      @Semantics.amount.currencyCode: 'DisplayCurrency'
      case when CompanyCodeCurrencyRole = :P_CurrencyRole then cast(AmountInCompanyCodeCurrency as farp_amount_display_crcy)
           when GlobalCurrencyRole = :P_CurrencyRole then cast(AmountInGlobalCurrency as farp_amount_display_crcy)
           when FreeDefinedCurrency1Role = :P_CurrencyRole then cast(AmountInFreeDefinedCurrency1 as farp_amount_display_crcy)
           when FreeDefinedCurrency2Role = :P_CurrencyRole then cast(AmountInFreeDefinedCurrency2 as farp_amount_display_crcy)
           when FreeDefinedCurrency3Role = :P_CurrencyRole then cast(AmountInFreeDefinedCurrency3 as farp_amount_display_crcy)
           when FreeDefinedCurrency4Role = :P_CurrencyRole then cast(AmountInFreeDefinedCurrency4 as farp_amount_display_crcy)
           when FreeDefinedCurrency5Role = :P_CurrencyRole then cast(AmountInFreeDefinedCurrency5 as farp_amount_display_crcy)
           when FreeDefinedCurrency6Role = :P_CurrencyRole then cast(AmountInFreeDefinedCurrency6 as farp_amount_display_crcy)
           when FreeDefinedCurrency7Role = :P_CurrencyRole then cast(AmountInFreeDefinedCurrency7 as farp_amount_display_crcy)
           when FreeDefinedCurrency8Role = :P_CurrencyRole then cast(AmountInFreeDefinedCurrency8 as farp_amount_display_crcy)
        else cast('0' as farp_amount_display_crcy)
      end                                                                                                                                                                                                                                                                                                        as  AmountInDisplayCurrency,

      //      @DefaultAggregation:#SUM

      //      @Semantics.amount.currencyCode: 'DisplayCurrency'

      //      case when CompanyCodeCurrencyRole = :P_CurrencyRole then cast(ActualAmountInCompanyCodeCrcy as farp_amount_display_crcy)

      //           when GlobalCurrencyRole = :P_CurrencyRole then cast(ActualAmountInGlobalCurrency as farp_amount_display_crcy)

      //           when FreeDefinedCurrency1Role = :P_CurrencyRole then cast(ActualAmountInFreeDfndCrcy1 as farp_amount_display_crcy)

      //           when FreeDefinedCurrency2Role = :P_CurrencyRole then cast(ActualAmountInFreeDfndCrcy2 as farp_amount_display_crcy)

      //           when FreeDefinedCurrency3Role = :P_CurrencyRole then cast(ActualAmountInFreeDfndCrcy3 as farp_amount_display_crcy)

      //           when FreeDefinedCurrency4Role = :P_CurrencyRole then cast(ActualAmountInFreeDfndCrcy4 as farp_amount_display_crcy)

      //           when FreeDefinedCurrency5Role = :P_CurrencyRole then cast(ActualAmountInFreeDfndCrcy5 as farp_amount_display_crcy)

      //           when FreeDefinedCurrency6Role = :P_CurrencyRole then cast(ActualAmountInFreeDfndCrcy6 as farp_amount_display_crcy)

      //           when FreeDefinedCurrency7Role = :P_CurrencyRole then cast(ActualAmountInFreeDfndCrcy7 as farp_amount_display_crcy)

      //           when FreeDefinedCurrency8Role = :P_CurrencyRole then cast(ActualAmountInFreeDfndCrcy8 as farp_amount_display_crcy)

      //        else cast('0' as farp_amount_display_crcy)

      //      end                                                                                                                                                                                                                                                                                                        as  ActualAmountInDisplayCurrency,


      /* Fields from ANLA */
      @ObjectModel.foreignKey.association: '_AssetAccountDetermination'
      AssetAccountDetermination,
      @ObjectModel.foreignKey.association: '_AssetClass'
      AssetClass,
      AssetCapitalizationDate,
      FirstAcquisitionFiscalYear,
      FirstAcquisitionFiscalPeriod,
      AssetDeactivationDate,
      @ObjectModel.foreignKey.association: '_FixedAssetGroup'
      FixedAssetGroup,
      AssetSupplierName,
      @ObjectModel.foreignKey.association: '_InvestmentOrder'
      InvestmentOrder,
      @ObjectModel.foreignKey.association: '_UnitOfMeasure'
      BaseUnit,
      InventoryIsCounted,
      LastInventoryDate,
      Inventory,
      @ObjectModel.foreignKey.association: '_Group1AssetEvaluationKey'
      Group1AssetEvaluationKey,
      @ObjectModel.foreignKey.association: '_Group2AssetEvaluationKey'
      Group2AssetEvaluationKey,
      @ObjectModel.foreignKey.association: '_Group3AssetEvaluationKey'
      Group3AssetEvaluationKey,
      @ObjectModel.foreignKey.association: '_Group4AssetEvaluationKey'
      Group4AssetEvaluationKey,
      @ObjectModel.foreignKey.association: '_Group5AssetEvaluationKey'
      Group5AssetEvaluationKey,
      AssetSerialNumber,

      @ObjectModel.foreignKey.association: '_FixedAssetNatlClfn'
      NationalClassification,
      @ObjectModel.foreignKey.association: '_TaxDepreciationGroup'
      TaxDepreciationGroup,

      cast(' ' as boolean preserving type)                                                                                                                                                                                                                                                                       as  AssetIsRetiredOnFiscalPerdEnd,
      I_FiscalYearPeriodForLedger.FiscalPeriodEndDate,

      _WBSElement.WBSElementExternalID,

      I_FixedAssetValue._CompanyCode,
      I_FixedAssetValue._Country,
      _DepreciationArea,
      _MasterFixedAsset,
      _FixedAsset,
      I_FixedAssetValue._Ledger,
      I_FixedAssetValue._FiscalYear,
      I_FixedAssetValue._FiscalPeriod,
      _JournalEntry,
      _SubLedgerAccLineItemType,
      _AssetAcctTransClassfctn,
      _AssetKeyFigure,
      _AssetKeyFigureSet,
      _AssetSortedKeyFigureSetSpec,
      _LedgerGroup,
      _ChartOfAccounts,
      _GLAccountInChartOfAccounts,
      _AlternativeGLAccount,
      _FinancialAccountType,
      _ChartOfDepreciation,
      _CostCenter,
      _Plant,
      _BusinessArea,
      _ProfitCenter,
      _Segment,
      _FunctionalArea,
      _AssetTransactionType,
      _ControllingArea,
      _CountryChartOfAccounts,
      _FinancialStatementVersion,
      _AccountingPrinciple,
      _AssetAccountDetermination,
      _AssetClass,
      _FixedAssetGroup,
      _InvestmentOrder,
      _UnitOfMeasure,
      _Group1AssetEvaluationKey,
      _Group2AssetEvaluationKey,
      _Group3AssetEvaluationKey,
      _Group4AssetEvaluationKey,
      _Group5AssetEvaluationKey,
      I_FixedAssetValue._FiscalYearVariant,
      _LedgerFiscalYearForVariant,
      _FiscalYearPeriodForVariant,
      _FiscalPeriodForVariant,
      _FixedAssetCountryData,
      _FixedAssetNatlClfn,
      _TaxDepreciationGroup,
      _FinancialManagementArea,
      _Fund,
      _BudgetPeriod
}
where
  //Due to asset accounting configuration changes we no longer restrict IsRealDepreciationArea

  //IsRealDepreciationArea         =  'X' //Due to performance we dont select any values from derived areas not even for BUHBKT = '4'

  //        I_FixedAssetValue.FiscalYear   =  :P_FiscalYear

  //  and   I_FixedAssetValue.FiscalPeriod <= :P_FiscalPeriod

  //  and   not(

        not(
          AssetDeactivationDate     <= I_FiscalYearPeriodForLedger.FiscalPeriodEndDate
          and AssetDeactivationDate <> '00000000'
        )