P_IntApportnmntBasic

DDL: P_INTAPPORTNMNTBASIC SQL: PINTAPPRTMTBASIC Type: view COMPOSITE

P_IntApportnmntBasic is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (I_PubSecPrtcpntAccts, I_GLAccountLineItem) and exposes 28 fields with key fields CompanyCode, Fund, GrantID, ProfitCenter, Segment. It has 1 association to related views.

Data Sources (2)

SourceAliasJoin Type
I_PubSecPrtcpntAccts _PrtcpntAccts inner
I_GLAccountLineItem GLAcctLineItem from

Parameters (3)

NameTypeDefault
P_PoolID psm_pool_id
P_Year num4
P_Period num2

Associations (1)

CardinalityTargetAliasCondition
[1..1] I_ProfitCenter _RealProfitCenter $projection.ControllingArea = _RealProfitCenter.ControllingArea and $projection.ProfitCenter = _RealProfitCenter.ProfitCenter and $projection.PostingDate >= _RealProfitCenter.ValidityStartDate and $projection.PostingDate <= _RealProfitCenter.ValidityEndDate

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PINTAPPRTMTBASIC view
ClientHandling.algorithm #SESSION_VARIABLE view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
VDM.viewType #COMPOSITE view
VDM.private true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ObjectModel.usageType.dataClass #MASTER view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #S view

Fields (28)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_GLAccountLineItem CompanyCode
KEY Fund I_GLAccountLineItem Fund
KEY GrantID I_GLAccountLineItem GrantID
KEY ProfitCenter I_GLAccountLineItem ProfitCenter
KEY Segment I_GLAccountLineItem Segment
InvestmentPooledFund _IntrstApprtmt InvestmentPooledFund
PYear
PPeriod
InvestmentPoolUUID I_PubSecPrtcpntAccts InvestmentPoolUUID
ChartOfAccounts I_GLAccountLineItem ChartOfAccounts
FinancialManagementArea I_GLAccountLineItem FinancialManagementArea
ControllingArea I_GLAccountLineItem ControllingArea
InvestmentParticipantAccount I_GLAccountLineItem GLAccount
PostingDate I_GLAccountLineItem PostingDate
CalendarDayelse00endasPoolDay
LastDay _CalendarYearMonth NumberOfDays
AmountInCompanyCodeCurrency I_GLAccountLineItem AmountInCompanyCodeCurrency
CompanyCodeCurrency I_GLAccountLineItem CompanyCodeCurrency
_ChartOfAccounts I_GLAccountLineItem _ChartOfAccounts
_CompanyCode I_GLAccountLineItem _CompanyCode
_FinancialManagementArea I_GLAccountLineItem _FinancialManagementArea
_ControllingArea I_GLAccountLineItem _ControllingArea
_Fund I_GLAccountLineItem _Fund
_Grant I_GLAccountLineItem _Grant
_RealProfitCenter _RealProfitCenter
_Segment I_GLAccountLineItem _Segment
_GLAccountInChartOfAccounts I_GLAccountLineItem _GLAccountInChartOfAccounts
_CompanyCodeCurrency I_GLAccountLineItem _CompanyCodeCurrency
@AbapCatalog.sqlViewName: 'PINTAPPRTMTBASIC'
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@VDM.viewType: #COMPOSITE
@VDM.private:true
@AccessControl.authorizationCheck: #NOT_REQUIRED
//@EndUserText.label: 'PSM Interest Apportionment Query Basic'

@ObjectModel.usageType: {
  dataClass: #MASTER,
  serviceQuality: #D,
  sizeCategory: #S
}

define view P_IntApportnmntBasic

  with parameters
    P_PoolID : psm_pool_id,
    P_Year   : num4,
    P_Period : num2

  as select from I_GLAccountLineItem   as GLAcctLineItem
    join         I_PubSecIntrstApprtmt as _IntrstApprtmt             on _IntrstApprtmt.InvestmentPoolID = $parameters.P_PoolID

    inner join   I_PubSecPrtcpntAccts  as _PrtcpntAccts              on  _PrtcpntAccts.InvestmentPoolUUID = _IntrstApprtmt.InvestmentPoolUUID
                                                                     and GLAcctLineItem.GLAccount         = _PrtcpntAccts.InvestmentParticipantAccount

    join         I_CalendarDate        as _CalendarDateByPostingDate on GLAcctLineItem.PostingDate = _CalendarDateByPostingDate.CalendarDate

    join         I_CalendarDate        as _CalendarDate              on _CalendarDate.CalendarDate = concat(
      $parameters.P_Year, concat(
        $parameters.P_Period, '01'
      )
    )

    join         I_YearMonth           as _CalendarYearMonth         on  _CalendarDate.CalendarYear  = _CalendarYearMonth.CalendarYear
                                                                     and _CalendarDate.CalendarMonth = _CalendarYearMonth.CalendarMonth

  association [1..1] to I_ProfitCenter as _RealProfitCenter on  $projection.ControllingArea =  _RealProfitCenter.ControllingArea
                                                            and $projection.ProfitCenter    =  _RealProfitCenter.ProfitCenter
                                                            and $projection.PostingDate     >= _RealProfitCenter.ValidityStartDate
                                                            and $projection.PostingDate     <= _RealProfitCenter.ValidityEndDate

{

  key  GLAcctLineItem.CompanyCode             as CompanyCode,
  key  GLAcctLineItem.Fund                    as Fund,
  key  GLAcctLineItem.GrantID                 as GrantID,
       @ObjectModel.foreignKey.association: '_RealProfitCenter'
  key  GLAcctLineItem.ProfitCenter            as ProfitCenter,
  key  GLAcctLineItem.Segment                 as Segment,

       _IntrstApprtmt.InvestmentPooledFund    as InvestmentPooledFund,
       $parameters.P_Year                     as PYear,
       $parameters.P_Period                   as PPeriod,
       _PrtcpntAccts.InvestmentPoolUUID       as InvestmentPoolUUID,
       GLAcctLineItem.ChartOfAccounts         as ChartOfAccounts,
       GLAcctLineItem.FinancialManagementArea as FinancialManagementArea,
       GLAcctLineItem.ControllingArea         as ControllingArea,
       GLAcctLineItem.GLAccount               as InvestmentParticipantAccount,
       GLAcctLineItem.PostingDate             as PostingDate,

       case
        when ( _CalendarDateByPostingDate.CalendarMonth = $parameters.P_Period and GLAcctLineItem.AccountingDocumentCategory <> 'C' )
        then _CalendarDateByPostingDate.CalendarDay
        else '00'
       end                                    as PoolDay,

       _CalendarYearMonth.NumberOfDays        as LastDay,

       @DefaultAggregation: #SUM
       @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
       GLAcctLineItem.AmountInCompanyCodeCurrency,
       @Semantics.currencyCode:true
       GLAcctLineItem.CompanyCodeCurrency,

       //_PoolID,

       //_CalendarYearMonth,

       GLAcctLineItem._ChartOfAccounts,
       GLAcctLineItem._CompanyCode,
       GLAcctLineItem._FinancialManagementArea,
       GLAcctLineItem._ControllingArea,
       GLAcctLineItem._Fund,
       GLAcctLineItem._Grant,
       _RealProfitCenter,
       GLAcctLineItem._Segment,
       GLAcctLineItem._GLAccountInChartOfAccounts,
       GLAcctLineItem._CompanyCodeCurrency

}

where
          GLAcctLineItem.CompanyCode                = _IntrstApprtmt.CompanyCode
  and     GLAcctLineItem.Ledger                     = '0L'
  and     GLAcctLineItem.GLAccount                  = _PrtcpntAccts.InvestmentParticipantAccount
  and     _CalendarDateByPostingDate.CalendarYear   = $parameters.P_Year
  and(
          GLAcctLineItem.PubSecBudgetCnsmpnType     = '56'
    and   _CalendarDateByPostingDate.CalendarMonth  > '00'
    and   _CalendarDateByPostingDate.CalendarMonth  <= $parameters.P_Period
    or(
          GLAcctLineItem.AccountingDocumentCategory = 'C'
      and GLAcctLineItem.FiscalPeriod               = '000'
    )
  )
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CALENDARDATE",
"I_GLACCOUNTLINEITEM",
"I_PUBSECINTRSTAPPRTMT",
"I_PUBSECPRTCPNTACCTS",
"I_YEARMONTH"
],
"ASSOCIATED":
[
"I_CHARTOFACCOUNTS",
"I_COMPANYCODE",
"I_CONTROLLINGAREA",
"I_CURRENCY",
"I_FINANCIALMANAGEMENTAREA",
"I_FUND",
"I_GLACCOUNTINCHARTOFACCOUNTS",
"I_GRANT",
"I_PROFITCENTER",
"I_SEGMENT"
],
"BASE":
[
"I_GLACCOUNTLINEITEM"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/