@AbapCatalog.sqlViewName: 'CSRFARETFORMC'
@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 Retirement Form Cube'
@Metadata.allowExtensions: true
define view C_StRpFxdAstRetirementFormCube with parameters
P_FiscalYear : fis_gjahr,
P_ToFiscalPeriod : fis_period_to,
P_FromPostingDate : fis_budat_from,
P_ToPostingDate : fis_budat_to,
P_AssetAccountingKeyFigureSet : faa_key_figure_set,
P_DateFieldPrintedOnForm : fiaagen_frm_date_fld_prntd,
P_NationalClsfctnSourceField : fiaagen_natl_clfn_srce_fld
as select from I_AssetBalanceCube(P_AssetAccountingKeyFigureSet : :P_AssetAccountingKeyFigureSet, P_FiscalYear: :P_FiscalYear, P_FiscalPeriod: :P_ToFiscalPeriod, P_KeyDate: :P_ToPostingDate ) as FixedAssetVal
left outer join I_FixedAssetFormNumber as FormNumber on FormNumber.FixedAssetFormType = '30' //Retirement
and FormNumber.CompanyCode = FixedAssetVal.CompanyCode
and FormNumber.MasterFixedAsset = FixedAssetVal.MasterFixedAsset
and FormNumber.FixedAsset = FixedAssetVal.FixedAsset
and FormNumber.AccountingDocument = FixedAssetVal.AccountingDocument
and FormNumber.FiscalYear = FixedAssetVal.FiscalYear
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..1] to I_Plant as _AssetPlant on $projection.AssetPlant = _AssetPlant.Plant
association [0..1] to I_Location as _AssetLocation on $projection.assetlocation = _AssetLocation.Location
and $projection.AssetPlant = _AssetLocation.Plant
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_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 AssetDepreciationArea,
@ObjectModel.foreignKey.association: '_MasterFixedAsset'
key FixedAssetVal.MasterFixedAsset,
@ObjectModel.foreignKey.association: '_FixedAsset'
key FixedAssetVal.FixedAsset,
@ObjectModel.foreignKey.association: '_JournalEntry'
key FixedAssetVal.AccountingDocument,
// key TransactionSubitem,
key LedgerGLLineItem,
@ObjectModel.foreignKey.association: '_Ledger'
key FixedAssetVal.Ledger,
@ObjectModel.foreignKey.association: '_FiscalYear'
key FixedAssetVal.FiscalYear,
@ObjectModel.foreignKey.association: '_SubledgerAccLineItemType'
key SubLedgerAcctLineItemType,
@ObjectModel.foreignKey.association: '_AssetAcctTransClassfctn'
key AssetAcctTransClassfctn,
@ObjectModel.foreignKey.association: '_AssetKeyFigureSet'
key FixedAssetVal.AssetAccountingKeyFigureSet,
@ObjectModel.foreignKey.association: '_AssetKeyFigure'
key AssetAccountingKeyFigure,
// @ObjectModel.foreignKey.association: '_DebitCreditCode'
key DebitCreditCode,
FixedAssetVal._CompanyCode._Address.FullName as CompanyCodeName,
@ObjectModel.foreignKey.association: '_ControllingArea'
ControllingArea,
Inventory,
PostingDate,
DocumentDate,
AssetValueDate,
//Date printed on the PDF form
case $parameters.P_DateFieldPrintedOnForm
when '1' then cast( PostingDate as fiaagen_frm_date_prntd )
when '2' then cast( DocumentDate as fiaagen_frm_date_prntd )
when '3' then cast( AssetValueDate as fiaagen_frm_date_prntd )
else cast( PostingDate as fiaagen_frm_date_prntd )
end as FormPrintDate,
AssetClass,
_FixedAsset.FixedAssetDescription as FixedAssetDescription,
_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,
@ObjectModel.foreignKey.association: '_AssetTransactionType'
AssetTransactionType,
_AssetTransactionType._Text[1:Language = $session.system_language].AssetTransactionTypeName,
Country,
AssetSerialNumber,
// @ObjectModel.foreignKey.association: '_CompanyCodeCurrency'
@Semantics.currencyCode: true
cast (DisplayCurrency as waers) as CompanyCodeCurrency,
@ObjectModel.foreignKey.association: '_GLAccountInChartOfAccounts'
GLAccount,
//Acqusition value
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'CompanyCodeCurrency'} }
case
when( AssetAccountingKeyFigure = '0002700000' or AssetAccountingKeyFigure = '0002700300' )
then cast( AmountInDisplayCurrency as fiaagen_amt_acqn_val )
end as AcquisitionValueAmtInCCCrcy,
//Acqusition account
//@ObjectModel.foreignKey.association: '_GLAccountInChartOfAccounts'
case
when( AssetAccountingKeyFigure = '0002700000' or AssetAccountingKeyFigure = '0002700300' )
then cast( GLAccount as fis_ktansw )
end as AcqnProdnCostGLAccount,
//Cummulated depreciation amount
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'CompanyCodeCurrency'} }
case
when( AssetAccountingKeyFigure = '0002700400' or AssetAccountingKeyFigure = '0002700500' or
AssetAccountingKeyFigure = '0002700600' or AssetAccountingKeyFigure = '0002700700' )
then cast( AmountInDisplayCurrency as fiaagen_amt_cumltv_depr )
end as CumulativeDepreciationAmount,
//Cummulated depreciation account
//@ObjectModel.foreignKey.association: '_GLAccountInChartOfAccounts'
case
when( AssetAccountingKeyFigure = '0002700400' or AssetAccountingKeyFigure = '0002700500' or
AssetAccountingKeyFigure = '0002700600' or AssetAccountingKeyFigure = '0002700700' )
then cast( GLAccount as fis_ktnafb )
end as AccumulatedOrdinaryDeprGLAcct,
//Net Book Value Amount
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'CompanyCodeCurrency'} }
case
when( AssetAccountingKeyFigure = '0002700000' or AssetAccountingKeyFigure = '0002700300' or //AcquisitionValueAmtInCCCrcy
AssetAccountingKeyFigure = '0002700400' or AssetAccountingKeyFigure = '0002700500' or //CumulativeDepreciationAmount
AssetAccountingKeyFigure = '0002700600' or AssetAccountingKeyFigure = '0002700700' ) //CumulativeDepreciationAmount
then cast( AmountInDisplayCurrency as fiaagen_amt_net_book_val )
end as NetBookValueAmountInCoCodeCrcy,
@ObjectModel.foreignKey.association: '_ChartOfAccounts'
ChartOfAccounts,
@ObjectModel.foreignKey.association: '_AssetPlant'
cast (_AssignmentByFiscalPeriodEnd( P_FiscalYear: :P_FiscalYear, P_FiscalPeriod: :P_ToFiscalPeriod).Plant as faa_werks) as AssetPlant,
@ObjectModel.foreignKey.association: '_AssetLocation'
_AssignmentByFiscalPeriodEnd(P_FiscalYear: :P_FiscalYear, P_FiscalPeriod: :P_ToFiscalPeriod).AssetLocation,
@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,
FormNumber.FixedAssetFormNumber,
FormNumber.StatryRptgEntity,
FormNumber.StatryRptCategory,
FormNumber.StatryRptRunID,
// expose associations
_CompanyCode,
_Country,
_DepreciationArea,
_MasterFixedAsset,
_FixedAsset,
_JournalEntry,
FixedAssetVal._Ledger,
FixedAssetVal._FiscalYear,
_SubLedgerAccLineItemType,
_AssetAcctTransClassfctn,
// _CompanyCodeCurrency,
_AssetKeyFigure,
// _DebitCreditCode,
_AssetKeyFigureSet,
_AssetClass,
_GLAccountInChartOfAccounts,
_ChartOfAccounts,
_AssetPlant,
_AssetLocation,
_AssetCostCenter,
_AssetBusinessArea,
_ControllingArea,
_AssetTransactionType
}
where (PostingDate between :P_FromPostingDate and :P_ToPostingDate) and SelectedCurrencyBranch = '10'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ADDRESS",
"I_ASSETBALANCECUBE",
"I_ASSETEVALUATIONKEYTEXT",
"I_ASSETTRANSACTIONTYPE",
"I_ASSETTRANSACTIONTYPETEXT",
"I_COMPANYCODE",
"I_FIXEDASSET",
"I_FIXEDASSETFORMNUMBER",
"I_FIXEDASSETGROUP",
"I_FIXEDASSETGROUPTEXT",
"I_FIXEDASSETNATLCLFN",
"I_FIXEDASSETNATLCLFNTEXT",
"I_FXDASTASSGMTBYFSCLPERDENDDTE",
"I_GROUP1ASSETEVALUATIONKEY",
"I_GROUP2ASSETEVALUATIONKEY",
"I_GROUP3ASSETEVALUATIONKEY",
"I_GROUP4ASSETEVALUATIONKEY",
"I_GROUP5ASSETEVALUATIONKEY",
"I_GROUP5ASSETEVALUATIONKEYTEXT"
],
"ASSOCIATED":
[
"I_ASSETCLASS",
"I_ASSETKEYFIGURE",
"I_ASSETKEYFIGURESET",
"I_ASSETTRANSACTIONTYPE",
"I_BUSINESSAREA",
"I_CHARTOFACCOUNTS",
"I_COMPANYCODE",
"I_CONTROLLINGAREA",
"I_COSTCENTER",
"I_COUNTRY",
"I_DEPRECIATIONAREAFORLEDGER",
"I_FISCALYEARFORCOMPANYCODE",
"I_FIXEDASSET",
"I_FXDASTASSGMTBYFSCLPERDENDDTE",
"I_GLACCOUNTINCHARTOFACCOUNTS",
"I_GROUP1ASSETEVALUATIONKEY",
"I_GROUP2ASSETEVALUATIONKEY",
"I_GROUP3ASSETEVALUATIONKEY",
"I_GROUP4ASSETEVALUATIONKEY",
"I_GROUP5ASSETEVALUATIONKEY",
"I_JOURNALENTRY",
"I_LEDGER",
"I_LOCATION",
"I_MASTERFIXEDASSET",
"I_MOVEMENTCATEGORY",
"I_PLANT",
"I_SUBLEDGERACCLINEITEMTYPE"
],
"BASE":
[
"I_ASSETBALANCECUBE"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/