@AbapCatalog.sqlViewName: 'CSRFALTRFORMC'
@VDM.viewType: #CONSUMPTION
@Analytics.dataCategory: #CUBE
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
@AccessControl.personalData.blocking: #BLOCKED_DATA_EXCLUDED
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.preserveKey: true
@EndUserText.label: 'Fixed Asset Location Transfer Form Cube'
@Metadata.allowExtensions: true
define view C_StRpFxdAssetLocTransferFormC with parameters
P_FiscalYear : fis_gjahr,
P_ToFiscalPeriod : fis_period_to,
P_FromPostingDate : fiaagen_frm_ltr_date_from,
P_ToPostingDate : fiaagen_frm_ltr_date_to,
P_AssetAccountingKeyFigureSet : faa_key_figure_set,
P_NationalClsfctnSourceField : fiaagen_natl_clfn_srce_fld
as select from P_StRpFxdAsstLocTransferAssgmt( P_FromPostingDate: :P_FromPostingDate, P_ToPostingDate: :P_ToPostingDate ) as LocTransferAssgmt
inner join I_AssetBalanceCube(P_AssetAccountingKeyFigureSet : :P_AssetAccountingKeyFigureSet, P_FiscalYear: :P_FiscalYear, P_FiscalPeriod: :P_ToFiscalPeriod, P_KeyDate: :P_ToPostingDate ) as FixedAssetVal
on LocTransferAssgmt.CompanyCode = FixedAssetVal.CompanyCode
and LocTransferAssgmt.MasterFixedAsset = FixedAssetVal.MasterFixedAsset
and LocTransferAssgmt.FixedAsset = FixedAssetVal.FixedAsset
left outer join I_FixedAssetFormNumber as FormNumber on FormNumber.FixedAssetFormType = '20' //Location transfer
and FormNumber.CompanyCode = LocTransferAssgmt.CompanyCode
and FormNumber.MasterFixedAsset = LocTransferAssgmt.MasterFixedAsset
and FormNumber.FixedAsset = LocTransferAssgmt.FixedAsset
and FormNumber.ValidityEndDate = LocTransferAssgmt.ValidityEndDate
left outer join P_STRPFxdAssetFormCompanyCode as AssetFormCompCode on AssetFormCompCode.CompanyCode = FixedAssetVal.CompanyCode
association [0..1] to I_FxdAstAssgmtByFsclPerdEndDte as _AssignmentByFiscalPeriodEnd
on FixedAssetVal.CompanyCode = _AssignmentByFiscalPeriodEnd.CompanyCode
and FixedAssetVal.Ledger = _AssignmentByFiscalPeriodEnd.Ledger
and FixedAssetVal.AssetDepreciationArea = _AssignmentByFiscalPeriodEnd.AssetDepreciationArea
and FixedAssetVal.MasterFixedAsset = _AssignmentByFiscalPeriodEnd.MasterFixedAsset
and FixedAssetVal.FixedAsset = _AssignmentByFiscalPeriodEnd.FixedAsset
association [0..*] to I_CostCenter as _AssetCostCenter on $projection.ControllingArea = _AssetCostCenter.ControllingArea
and $projection.AssetCostCenter = _AssetCostCenter.CostCenter
association [0..1] to I_BusinessArea as _AssetBusinessArea on $projection.AssetBusinessArea = _AssetBusinessArea.BusinessArea
association [0..1] to I_Plant as _AssetPlant on $projection.AssetPlant = _AssetPlant.Plant
association [0..1] to I_Group1AssetEvaluationKey as _EvaluationGroup1 on $projection.Group1AssetEvaluationKey = _EvaluationGroup1.Group1AssetEvaluationKey
association [0..1] to I_Group2AssetEvaluationKey as _EvaluationGroup2 on $projection.Group2AssetEvaluationKey = _EvaluationGroup2.Group2AssetEvaluationKey
association [0..1] to I_Group3AssetEvaluationKey as _EvaluationGroup3 on $projection.Group3AssetEvaluationKey = _EvaluationGroup3.Group3AssetEvaluationKey
association [0..1] to I_Group4AssetEvaluationKey as _EvaluationGroup4 on $projection.Group4AssetEvaluationKey = _EvaluationGroup4.Group4AssetEvaluationKey
association [0..1] to I_Group5AssetEvaluationKey as _EvaluationGroup5 on $projection.Group5AssetEvaluationKey = _EvaluationGroup5.Group5AssetEvaluationKey
{
@ObjectModel.foreignKey.association: '_CompanyCode'
key FixedAssetVal.CompanyCode,
@ObjectModel.foreignKey.association: '_DepreciationArea'
key FixedAssetVal.AssetDepreciationArea,
@ObjectModel.foreignKey.association: '_MasterFixedAsset'
key FixedAssetVal.MasterFixedAsset,
@ObjectModel.foreignKey.association: '_FixedAsset'
key FixedAssetVal.FixedAsset,
@ObjectModel.foreignKey.association: '_JournalEntry'
key FixedAssetVal.AccountingDocument,
@ObjectModel.foreignKey.association: '_Ledger'
key FixedAssetVal.Ledger,
@ObjectModel.foreignKey.association: '_FiscalYear'
key FixedAssetVal.FiscalYear,
@ObjectModel.foreignKey.association: '_SubledgerAccLineItemType'
key FixedAssetVal.SubLedgerAcctLineItemType,
@ObjectModel.foreignKey.association: '_AssetAcctTransClassfctn'
key FixedAssetVal.AssetAcctTransClassfctn,
@ObjectModel.foreignKey.association: '_AssetKeyFigureSet'
key FixedAssetVal.AssetAccountingKeyFigureSet as AssetAccountingKeyFigureSet,
@ObjectModel.foreignKey.association: '_AssetKeyFigure'
key FixedAssetVal.AssetAccountingKeyFigure,
// @ObjectModel.foreignKey.association: '_DebitCreditCode'
key FixedAssetVal.DebitCreditCode,
@Semantics.businessDate.from: false
key LocTransferAssgmt.ValidityStartDate,
@Semantics.businessDate.from: false
key LocTransferAssgmt.ValidityEndDate,
AssetFormCompCode.FullName as CompanyCodeName,
@ObjectModel.foreignKey.association: '_ControllingArea'
FixedAssetVal.ControllingArea,
FixedAssetVal.Inventory,
FixedAssetVal.AssetClass,
FixedAssetVal._FixedAsset.FixedAssetDescription as FixedAssetDescription,
FixedAssetVal._FixedAsset.AssetAdditionalDescription as AssetAdditionalDescription,
cast( case $parameters.P_NationalClsfctnSourceField
when '1' then NationalClassification
when '2' then FixedAssetGroup
when '3' then Group1AssetEvaluationKey
when '4' then Group2AssetEvaluationKey
when '5' then Group3AssetEvaluationKey
when '6' then Group4AssetEvaluationKey
when '7' then Group5AssetEvaluationKey
else NationalClassification end as glo_natl_clfn_code ) as NationalClassification,
cast( case $parameters.P_NationalClsfctnSourceField
when '1' then _FixedAssetNatlClfn._Text[1:Language = $session.system_language].NationalClassificationDesc
when '2' then _FixedAssetGroup._Text[1:Language = $session.system_language].FixedAssetGroupName
when '3' then _EvaluationGroup1._Text[1:Language = $session.system_language].AssetEvaluationKeyName
when '4' then _EvaluationGroup2._Text[1:Language = $session.system_language].AssetEvaluationKeyName
when '5' then _EvaluationGroup3._Text[1:Language = $session.system_language].AssetEvaluationKeyName
when '6' then _EvaluationGroup4._Text[1:Language = $session.system_language].AssetEvaluationKeyName
when '7' then _EvaluationGroup5._Text[1:Language = $session.system_language].Group5AssetEvaluationKeyName
else _FixedAssetNatlClfn._Text[1:Language = $session.system_language].NationalClassificationDesc end as glo_natl_clfn_code_text ) as NationalClassificationDesc,
Group1AssetEvaluationKey,
Group2AssetEvaluationKey,
Group3AssetEvaluationKey,
Group4AssetEvaluationKey,
Group5AssetEvaluationKey,
LocTransferAssgmt.ValidityEndDate as ActiveValidityEndDate, //this field added since otherwise the key field ValidityEndDate is not displayed by anal.query
@ObjectModel.foreignKey.association: '_AssetTransactionType'
FixedAssetVal.AssetTransactionType,
FixedAssetVal._AssetTransactionType._Text[1:Language = $session.system_language].AssetTransactionTypeName,
FixedAssetVal.Country,
FixedAssetVal.AssetSerialNumber,
// @ObjectModel.foreignKey.association: '_CompanyCodeCurrency'
@Semantics.currencyCode: true
//FixedAssetVal.CompanyCodeCurrency,
cast (DisplayCurrency as waers) as CompanyCodeCurrency,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'CompanyCodeCurrency'} }
case
when ( FixedAssetVal.AssetAccountingKeyFigure = '0010700000' or FixedAssetVal.AssetAccountingKeyFigure = '0010700301')
then cast( FixedAssetVal.AmountInDisplayCurrency as fiaagen_amt_acqn_val )
else cast( 0 as fiaagen_amt_acqn_val )
end as AcquisitionValueAmtInCCCrcy,
// @ObjectModel.foreignKey.association: '_Plant'
cast( LocTransferAssgmt.OldAssetPlant as fiaagen_frm_old_plant ) as OldAssetPlant,
// @ObjectModel.foreignKey.association: '_AssetLocation'
cast( LocTransferAssgmt.OldAssetLocation as fiaagen_frm_old_loc ) as OldAssetLocation,
// @ObjectModel.foreignKey.association: '_Plant'
cast( LocTransferAssgmt.NewAssetPlant as fiaagen_frm_new_plant ) as NewAssetPlant,
// @ObjectModel.foreignKey.association: '_AssetLocation'
cast( LocTransferAssgmt.NewAssetLocation as fiaagen_frm_new_loc ) as NewAssetLocation,
// @ObjectModel.foreignKey.association: '_AssetCostCenter'
cast( LocTransferAssgmt.OldAssetCostCenter as fiaagen_frm_old_cost_ctr ) as OldAssetCostCenter,
// @ObjectModel.foreignKey.association: '_AssetCostCenter'
cast( LocTransferAssgmt.NewAssetCostCenter as fiaagen_frm_new_cost_ctr ) as NewAssetCostCenter,
// asset master data fields ANLZ valid at the end of period (used in authorizations)
@ObjectModel.foreignKey.association: '_AssetPlant'
cast (_AssignmentByFiscalPeriodEnd(P_FiscalYear: :P_FiscalYear, P_FiscalPeriod: :P_ToFiscalPeriod).Plant as faa_werks) as AssetPlant,
@ObjectModel.foreignKey.association: '_AssetCostCenter'
cast (_AssignmentByFiscalPeriodEnd(P_FiscalYear: :P_FiscalYear, P_FiscalPeriod: :P_ToFiscalPeriod).CostCenter as faa_kostl) as AssetCostCenter,
@ObjectModel.foreignKey.association: '_AssetBusinessArea' //added because of authority check
cast (_AssignmentByFiscalPeriodEnd(P_FiscalYear: :P_FiscalYear, P_FiscalPeriod: :P_ToFiscalPeriod).BusinessArea as faa_gsber) as AssetBusinessArea,
//the fields in FIAAGEND_FRMNUM
FormNumber.FixedAssetFormNumber,
FormNumber.StatryRptgEntity,
FormNumber.StatryRptCategory,
FormNumber.StatryRptRunID,
// expose associations
FixedAssetVal._CompanyCode,
FixedAssetVal._DepreciationArea,
FixedAssetVal._MasterFixedAsset,
FixedAssetVal._FixedAsset,
FixedAssetVal._JournalEntry,
FixedAssetVal._Ledger,
FixedAssetVal._FiscalYear,
FixedAssetVal._SubLedgerAccLineItemType,
FixedAssetVal._AssetAcctTransClassfctn,
// FixedAssetVal._CompanyCodeCurrency,
FixedAssetVal._AssetKeyFigure,
// FixedAssetVal._DebitCreditCode,
FixedAssetVal._AssetKeyFigureSet,
_AssetClass,
_AssetPlant,
_AssetBusinessArea,
_AssetCostCenter,
FixedAssetVal._ControllingArea,
FixedAssetVal._AssetTransactionType,
FixedAssetVal._Country
}
where
//the view selects all transactions until the end of reporting period
FixedAssetVal.FiscalYear = :P_FiscalYear
and FixedAssetVal.FiscalPeriod <= :P_ToFiscalPeriod
and SelectedCurrencyBranch = '10'
// and FormNumber.FixedAssetFormType = '20' //Location Transfer
//and ValidityStartDate between :P_FromPostingDate and :P_ToPostingDate