@AbapCatalog.sqlViewName: 'CROSAFTFASSETCUB'
@VDM.viewType: #CONSUMPTION
@Analytics: { dataCategory: #CUBE }
@Analytics.internalName: #LOCAL
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@ObjectModel.usageType.sizeCategory: #L
@ObjectModel.usageType.serviceQuality: 'D'
@ObjectModel.usageType.dataClass: 'TRANSACTIONAL'
@AccessControl.authorizationCheck: #MANDATORY
@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.allowExtensions:true
@EndUserText.label: 'RO SAFT Fixed Asset - Cube'
define view C_RO_SAFTFixedAssetCube
with parameters
P_AssetAccountingKeyFigureSet : faa_key_figure_set,
P_FiscalYear : fis_gjahr,
P_ToFiscalPeriod : fis_period_to,
P_KeyDate : fagl_keydate, //Reporting End Date
P_NationalClsfctnSourceField : /ceecv/ro_sa_natl_clfn_src_fld,
P_UtilznStartDateSourceField : /ceecv/ro_sa_util_strt_src_fld,
P_ReportingStartDate : fis_rep_period_start_date,
P_AcquisitionDateSourceCode : /ceecv/ro_sa_acqn_date_src_fld,
P_RevalIsAddedToAcqnProdnCost : /ceecv/ro_sa_add_reval_to_apc,
P_AstLeadingDepreciationArea : saft_aa_ro_depr_area,
P_AstLdngDeprAreaLedger : saft_aa_ro_depr_area_ledger,
P_RO_SAFTAccmltdDeprCategory : /ceecv/ro_sa_accum_depr_cat,
P_LeadingCompanyCode : /ceecv/ro_sa_ldng_comp_code
as select from P_RO_SAFTFixedAsset( P_KeyDate: :P_KeyDate,
P_NationalClsfctnSourceField: :P_NationalClsfctnSourceField,
P_UtilznStartDateSourceField: :P_UtilznStartDateSourceField,
P_ReportingStartDate: :P_ReportingStartDate,
P_AcquisitionDateSourceCode: :P_AcquisitionDateSourceCode,
P_AstLeadingDepreciationArea: :P_AstLeadingDepreciationArea,
P_AstLdngDeprAreaLedger: :P_AstLdngDeprAreaLedger,
P_LeadingCompanyCode: :P_LeadingCompanyCode ) as SAFTFixedAsset
inner join I_AssetBalanceCube( P_AssetAccountingKeyFigureSet: :P_AssetAccountingKeyFigureSet,
P_FiscalYear: :P_FiscalYear,
P_FiscalPeriod: :P_ToFiscalPeriod,
P_KeyDate: :P_KeyDate ) as AstBal
on AstBal.CompanyCode = SAFTFixedAsset.CompanyCode
and AstBal.MasterFixedAsset = SAFTFixedAsset.MasterFixedAsset
and AstBal.FixedAsset = SAFTFixedAsset.FixedAsset
{
@ObjectModel.foreignKey.association: '_CompanyCode'
key AstBal.CompanyCode,
@ObjectModel.foreignKey.association: '_MasterFixedAsset'
key AstBal.MasterFixedAsset,
@ObjectModel.foreignKey.association: '_FixedAsset'
key AstBal.FixedAsset,
@ObjectModel.foreignKey.association: '_DepreciationArea'
key AstBal.AssetDepreciationArea,
@ObjectModel.foreignKey.association: '_Ledger'
key AstBal.Ledger,
@ObjectModel.foreignKey.association: '_FiscalYear'
key AstBal.FiscalYear,
key AstBal.FiscalPeriod,
key AstBal.SubLedgerAcctLineItemType,
key AstBal.AssetAcctTransClassfctn,
key AstBal.AssetAccountingKeyFigure,
key AstBal.AssetAccountingKeyFigureSet,
// key AccountingDocument,
// key LedgerGLLineItem,
// key TransactionSubitem,
// key DebitCreditCode,
// key CurrencyRole,
// key ReferenceDocument,
// @ObjectModel.foreignKey.association: '_ChartOfDepreciation'
AstBal.ChartOfDepreciation,
AstBal.AcqnProdnCostGLAccount,
AstBal.AssetAccountDetermination,
//P_RO_SAFTFixedAsset
SAFTFixedAsset.FixedAssetDescription,
SAFTFixedAsset.AssetAdditionalDescription,
SAFTFixedAsset.AssetClass,
SAFTFixedAsset.AssetCapitalizationDate,
SAFTFixedAsset.AcquisitionValueDate,
SAFTFixedAsset.FixedAssetOrderDate,
SAFTFixedAsset.AcquisitionDate,
SAFTFixedAsset.UtilizationStartDate,
SAFTFixedAsset.NationalClassification,
SAFTFixedAsset.PlannedUsefulLifeInYears,
SAFTFixedAsset.PlannedUsefulLifeInPeriods,
SAFTFixedAsset.DepreciationKey,
RO_SAFTAstIsInvestmentSupport,
//VALUES
//APC at reporting period start
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'DisplayCurrency'
cast( case $parameters.P_RevalIsAddedToAcqnProdnCost
when 'X'
then case when ( AstBal.AssetAccountingKeyFigure = '0000700130' or //APC FY start
AstBal.AssetAccountingKeyFigure = '0000700300' ) //Revaluation
then AstBal.AmountInDisplayCurrency
else cast ('0' as /ceecv/ro_sa_acqn_prod_cst_beg )
end
else
case when AstBal.AssetAccountingKeyFigure = '0000700130' //APC FY start
then AstBal.AmountInDisplayCurrency
else cast ('0' as /ceecv/ro_sa_acqn_prod_cst_beg )
end
end as /ceecv/ro_sa_acqn_prod_cst_beg preserving type ) as RptgPerdStrtAcqnProdnAmtInDC,
//APC at reporting period end
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'DisplayCurrency'
cast( case $parameters.P_RevalIsAddedToAcqnProdnCost
when 'X'
then case when ( AstBal.AssetAccountingKeyFigure = '0010700000' or //APC FY start
AstBal.AssetAccountingKeyFigure = '0010700300' ) //Revaluation
then AstBal.AmountInDisplayCurrency
else cast ('0' as /ceecv/ro_sa_acqn_prod_cst_end )
end
else
case when AstBal.AssetAccountingKeyFigure = '0010700000' //APC FY start
then AstBal.AmountInDisplayCurrency
else cast ('0' as /ceecv/ro_sa_acqn_prod_cst_end )
end
end as /ceecv/ro_sa_acqn_prod_cst_end preserving type ) as AcqnProdnAmtInDspCrcy,
//NBV at FY start
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'DisplayCurrency'
cast( case when ( AstBal.AssetAccountingKeyFigure = '0000790400' )
then AstBal.AmountInDisplayCurrency
else cast( '0' as /ceecv/ro_sa_book_val_beg )
end as /ceecv/ro_sa_book_val_beg preserving type ) as RptgPerdStrtNetBookValAmtInDC,
//NBV at FY end
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'DisplayCurrency'
cast( case when ( AstBal.AssetAccountingKeyFigure = '0010790400' )
then AstBal.AmountInDisplayCurrency
else cast ('0' as /ceecv/ro_sa_book_val_end )
end as /ceecv/ro_sa_book_val_end preserving type ) as NetBookValueAmount,
//Accumulated depreciation at the FY end
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'DisplayCurrency'
cast( case $parameters.P_RO_SAFTAccmltdDeprCategory
when '2' then //Special Depreciation is not Included
case when ( AstBal.AssetAccountingKeyFigure = '0010700400' or AstBal.AssetAccountingKeyFigure = '0010700500' or AstBal.AssetAccountingKeyFigure = '0010700700' )
then AstBal.AmountInDisplayCurrency
else cast ('0' as /ceecv/ro_sa_accum_depr )
end
when '3' then //Unplanned Depreciation is not Included
case when ( AstBal.AssetAccountingKeyFigure = '0010700400' or AstBal.AssetAccountingKeyFigure = '0010700500' or AstBal.AssetAccountingKeyFigure = '0010700600' )
then AstBal.AmountInDisplayCurrency
else cast ('0' as /ceecv/ro_sa_accum_depr )
end
else //All Depreciation Types are Included
case when ( AstBal.AssetAccountingKeyFigure = '0010700400' or AstBal.AssetAccountingKeyFigure = '0010700500' or AstBal.AssetAccountingKeyFigure = '0010700600' or AstBal.AssetAccountingKeyFigure = '0010700700' )
then AstBal.AmountInDisplayCurrency
else cast ('0' as /ceecv/ro_sa_accum_depr )
end
end as /ceecv/ro_sa_accum_depr preserving type ) as CumulativeDepreciationAmount,
//Investment support at the FY end
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'DisplayCurrency'
cast( case SAFTFixedAsset.RO_SAFTAstIsInvestmentSupport
when 'X' then
case when ( AstBal.AssetAccountingKeyFigure = '0010790400' ) //Complete NBV
then AstBal.AmountInDisplayCurrency
else cast ('0' as /ceecv/ro_sa_invmt_support )
end
else
case when ( AstBal.AssetAccountingKeyFigure = '0010700200' ) //Standard Investment Support
then AstBal.AmountInDisplayCurrency
else cast ('0' as /ceecv/ro_sa_invmt_support )
end
end as /ceecv/ro_sa_invmt_support preserving type ) as InvestmentSupportAmtInDspCrcy,
@Semantics.currencyCode:true
DisplayCurrency,
// Associations
_CompanyCode,
_DepreciationArea,
_ChartOfDepreciation,
_MasterFixedAsset,
_FixedAsset,
_AssetAccountDetermination,
_Ledger,
_FiscalYear
}
where AstBal.SelectedCurrencyBranch = '10' and SAFTFixedAsset.UtilizationStartDate <> '00000000'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ASSETBALANCECUBE",
"P_RO_SAFTFIXEDASSET"
],
"ASSOCIATED":
[
"I_ASSETACCTDETERMINATION",
"I_CHARTOFDEPRECIATION",
"I_COMPANYCODE",
"I_DEPRECIATIONAREAFORLEDGER",
"I_FISCALYEARFORCOMPANYCODE",
"I_FIXEDASSET",
"I_LEDGER",
"I_MASTERFIXEDASSET"
],
"BASE":
[
"I_ASSETBALANCECUBE"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/