P_CostCenterBudget

DDL: P_COSTCENTERBUDGET SQL: PCSTCNTRBDGT Type: view COMPOSITE

P_CostCenterBudget is a Composite CDS View in SAP S/4HANA. It reads from 14 data sources and exposes 80 fields. It has 9 associations to related views.

Data Sources (14)

SourceAliasJoin Type
I_AvailyCtrlProfileSemanticTag _AvailyCtrlProfileSemanticTag inner
I_AvailyCtrlProfileSemanticTag _AvailyCtrlProfileSemanticTag inner
I_CostCenter _BudgetCarryingCostCenter inner
I_CostCenter _BudgetCarryingCostCenter inner
I_CostCenter _CostCenterAtPostingDate inner
I_CostCenter _CostCenterAtPostingDate inner
I_GLAccountHierarchyNode _GLAccountHierarchyID inner
I_GLAccountHierarchyNode _GLAccountHierarchyID inner
I_GLAccountHierSubTree _GLAccountHierSubTree inner
I_GLAccountHierSubTree _GLAccountHierSubTree inner
I_PredictionLedger _PredictionLedger left_outer
I_PredictionLedger _PredictionLedger left_outer
I_GLAccountLineItemRawData GLAccountLineItem from
I_GLAccountLineItemRawData GLAccountLineItem union_all

Parameters (5)

NameTypeDefault
P_KeyDate sydatum
P_BudgetPlanningCategory fis_category
P_InputPlanningCategory fis_category
P_Language spras
P_LeadingLedger fins_ledger

Associations (9)

CardinalityTargetAliasCondition
[0..1] I_ProfitCenter _CurrentProfitCenter $projection.ControllingArea = _CurrentProfitCenter.ControllingArea and $projection.ProfitCenter = _CurrentProfitCenter.ProfitCenter and _CurrentProfitCenter.ValidityStartDate <= $session.system_date and _CurrentProfitCenter.ValidityEndDate >= $session.system_date
[0..1] I_CostCenter _CurrentCostCenter $projection.ControllingArea = _CurrentCostCenter.ControllingArea and $projection.CostCenter = _CurrentCostCenter.CostCenter and _CurrentCostCenter.ValidityStartDate <= $session.system_date and _CurrentCostCenter.ValidityEndDate >= $session.system_date
[0..1] I_GLAccountHierarchyNode _GLAccountHierarchyNode _GLAccountHierarchyNode.GLAccountHierarchy = _AvailyCtrlProfileSemanticTag.GLAccountHierarchy and _GLAccountHierarchyNode.HierarchyNode = _AvailyCtrlProfileSemanticTag.HierarchyNode and _GLAccountHierarchyNode.ValidityEndDate = '99991231'
[0..*] I_GLAccountHierarchyNodeT _GLAccountHierarchyNodeT $projection.GLAccountHierarchy = _GLAccountHierarchyNodeT.GLAccountHierarchy and $projection.HierarchyNode = _GLAccountHierarchyNodeT.HierarchyNode and _GLAccountHierarchyNodeT.ValidityEndDate = '99991231'
[0..*] I_GLAccountHierarchyText _GLAccountHierarchyText $projection.GLAccountHierarchy = _GLAccountHierarchyText.GLAccountHierarchy
[0..*] I_PlanningCategoryText _PlanningCategoryText $projection.PlanningCategory = _PlanningCategoryText.PlanningCategory
[0..*] I_JointVentureDesc _JointVentureDesc _JointVentureDesc.CompanyCode = GLAccountLineItem.CompanyCode and _JointVentureDesc.JointVenture = GLAccountLineItem.JointVenture
[0..*] I_JntVntrEquityGrpText _JntVntrEquityGrpText _JntVntrEquityGrpText.CompanyCode = GLAccountLineItem.CompanyCode and _JntVntrEquityGrpText.JointVenture = GLAccountLineItem.JointVenture and _JntVntrEquityGrpText.JntOpgAgrmtEquityGrp = GLAccountLineItem.JointVentureEquityGroup
[0..*] I_JointVentureRecoveryText _JointVentureRecoveryText _JointVentureRecoveryText.CompanyCode = GLAccountLineItem.CompanyCode and _JointVentureRecoveryText.JointVentureRecoveryCode = GLAccountLineItem.JointVentureCostRecoveryCode

Annotations (6)

NameValueLevelField
AbapCatalog.sqlViewName PCSTCNTRBDGT view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.viewType #COMPOSITE view
VDM.private true view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (80)

KeyFieldSource TableSource FieldDescription
KeyDate
PlanningCategory
FiscalYear I_GLAccountLineItemRawData FiscalYear
FiscalPeriod I_GLAccountLineItemRawData FiscalPeriod
Ledger I_GLAccountLineItemRawData SourceLedger
ControllingArea I_GLAccountLineItemRawData ControllingArea
BudgetCarryingCostCenter I_CostCenter BudgetCarryingCostCenter
GLAccountHierarchy I_AvailyCtrlProfileSemanticTag GLAccountHierarchy
HierarchyNode I_AvailyCtrlProfileSemanticTag HierarchyNode
GLAccountHierNodeSemanticKey
AvailabilityControlProfile I_CostCenter AvailabilityControlProfile
GlobalCurrency I_GLAccountLineItemRawData GlobalCurrency
CompanyCodeCurrency I_GLAccountLineItemRawData CompanyCodeCurrency
LedgerFiscalYear I_GLAccountLineItemRawData LedgerFiscalYear
FiscalYearVariant I_GLAccountLineItemRawData FiscalYearVariant
CompanyCode I_GLAccountLineItemRawData CompanyCode
PredictionLedger I_PredictionLedger PredictionLedger
PlanAmountInCompanyCodeCrcy
BudgetAmountInCompanyCodeCrcy
ActualCostAmtInCCCrcy I_GLAccountLineItemRawData AmountInCompanyCodeCurrency
CmtmtCostInCCCrcy
TotAssgdAmtInCoCodeCurrency I_GLAccountLineItemRawData AmountInCompanyCodeCurrency
AvailableBdgtAmtInCoCodeCrcy
PlanAmountInGlobalCurrency
BudgetInGlobalCrcy
ActualCostInGlobalCrcy I_GLAccountLineItemRawData AmountInGlobalCurrency
CmtmtCostInGlobalCurrency
TotAssgdAmtInGlobalCurrency I_GLAccountLineItemRawData AmountInGlobalCurrency
AvailableBudgetInGlobalCrcy
BudgetCarryingCostCenterName
HierarchyNodeText
CostCenterName
GLAccountName
_ControllingArea I_GLAccountLineItemRawData _ControllingArea
_FiscalYear I_GLAccountLineItemRawData _FiscalYear
_CompanyCode I_GLAccountLineItemRawData _CompanyCode
_FiscalPeriodForVariant I_GLAccountLineItemRawData _FiscalPeriodForVariant
_LedgerFiscalYearForVariant I_GLAccountLineItemRawData _LedgerFiscalYearForVariant
_FiscalYearVariant I_GLAccountLineItemRawData _FiscalYearVariant
_GLAccountHierarchyNode _GLAccountHierarchyNode
_GLAccountHierarchyNodeT _GLAccountHierarchyNodeT
GLAccountHierarchyName
PlanningCategoryName
FinancialAccountType I_GLAccountLineItemRawData FinancialAccountType
OrderID I_GLAccountLineItemRawData OrderID
AccountingDocumentType I_GLAccountLineItemRawData AccountingDocumentType
Customer I_GLAccountLineItemRawData Customer
Segment I_GLAccountLineItemRawData Segment
BusinessArea I_GLAccountLineItemRawData BusinessArea
ProfitCenter I_GLAccountLineItemRawData ProfitCenter
Supplier I_GLAccountLineItemRawData Supplier
SalesOrganization I_GLAccountLineItemRawData SalesOrganization
Plant I_GLAccountLineItemRawData Plant
ServiceDocumentType I_GLAccountLineItemRawData ServiceDocumentType
ValuationArea I_GLAccountLineItemRawData ValuationArea
SalesDocument I_GLAccountLineItemRawData SalesDocument
CostCenter I_GLAccountLineItemRawData CostCenter
GLAccount I_GLAccountLineItemRawData GLAccount
DistributionChannel I_GLAccountLineItemRawData DistributionChannel
OrganizationDivision I_GLAccountLineItemRawData OrganizationDivision
ServiceDocument I_GLAccountLineItemRawData ServiceDocument
AssetClass I_GLAccountLineItemRawData AssetClass
PostingDate I_GLAccountLineItemRawData PostingDate
FunctionalArea I_GLAccountLineItemRawData FunctionalArea
_Ledger I_GLAccountLineItemRawData _Ledger
_Order I_GLAccountLineItemRawData _Order
_AccountingDocumentType I_GLAccountLineItemRawData _AccountingDocumentType
_Customer I_GLAccountLineItemRawData _Customer
_CurrentProfitCenter _CurrentProfitCenter
_CurrentCostCenter _CurrentCostCenter
_Supplier I_GLAccountLineItemRawData _Supplier
_GLAccountInCompanyCode I_GLAccountLineItemRawData _GLAccountInCompanyCode
_SalesDocument I_GLAccountLineItemRawData _SalesDocument
_ServiceDocument I_GLAccountLineItemRawData _ServiceDocument
JointVenture I_GLAccountLineItemRawData JointVenture
JointVentureName
JointVentureEquityGroup I_GLAccountLineItemRawData JointVentureEquityGroup
JointVentureEquityGroupName
JointVentureRecoveryCode I_GLAccountLineItemRawData JointVentureCostRecoveryCode
JointVentureRecoveryCodeName
@AbapCatalog.sqlViewName: 'PCSTCNTRBDGT'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #COMPOSITE
@VDM.private: true
@ClientHandling.algorithm: #SESSION_VARIABLE

define view P_CostCenterBudget

  with parameters
    P_KeyDate                : sydatum,
    P_BudgetPlanningCategory : fis_category,
    P_InputPlanningCategory  : fis_category,
    P_Language               : spras,
    P_LeadingLedger          : fins_ledger

  ////////////////////////////////

  // A C T U A L  C O S T S

  ////////////////////////////////

  as select from    I_GLAccountLineItemRawData     as GLAccountLineItem
    inner join      I_CostCenter                   as _CostCenterAtPostingDate      on  GLAccountLineItem.ControllingArea          =  _CostCenterAtPostingDate.ControllingArea
                                                                                    and GLAccountLineItem.CostCenter               =  _CostCenterAtPostingDate.CostCenter
                                                                                    and _CostCenterAtPostingDate.ValidityStartDate <= GLAccountLineItem.PostingDate
                                                                                    and _CostCenterAtPostingDate.ValidityEndDate   >= GLAccountLineItem.PostingDate
    inner join      I_CostCenter                   as _BudgetCarryingCostCenter     on  _CostCenterAtPostingDate.ControllingArea          =  _BudgetCarryingCostCenter.ControllingArea
                                                                                    and _CostCenterAtPostingDate.BudgetCarryingCostCenter =  _BudgetCarryingCostCenter.CostCenter
                                                                                    and _BudgetCarryingCostCenter.ValidityStartDate       <= GLAccountLineItem.PostingDate
                                                                                    and _BudgetCarryingCostCenter.ValidityEndDate         >= GLAccountLineItem.PostingDate
    inner join      I_AvailyCtrlProfileSemanticTag as _AvailyCtrlProfileSemanticTag on _BudgetCarryingCostCenter.AvailabilityControlProfile = _AvailyCtrlProfileSemanticTag.AvailabilityControlProfile
    inner join      I_GLAccountHierSubTree         as _GLAccountHierSubTree         on  _GLAccountHierSubTree.GLAccountHierarchy = _AvailyCtrlProfileSemanticTag.GLAccountHierarchy
                                                                                    and _GLAccountHierSubTree.HierarchyNode      = _AvailyCtrlProfileSemanticTag.HierarchyNode
                                                                                    and _GLAccountHierSubTree.GLAccount          = GLAccountLineItem.GLAccount
                                                                                    and _GLAccountHierSubTree.ChartOfAccounts    = GLAccountLineItem.ChartOfAccounts
    inner join      I_GLAccountHierarchyNode       as _GLAccountHierarchyID         on  _GLAccountHierarchyID.GLAccountHierarchy = _AvailyCtrlProfileSemanticTag.GLAccountHierarchy
                                                                                    and _GLAccountHierarchyID.ValidityEndDate    = '99991231'
                                                                                    and _GLAccountHierarchyID.NodeType           = 'R'

    left outer join I_PredictionLedger             as _PredictionLedger             on _PredictionLedger.LedgerIsRelevantForAvailyCtrl = 'X'

  association [0..1] to I_ProfitCenter             as _CurrentProfitCenter     on  $projection.ControllingArea            = _CurrentProfitCenter.ControllingArea
                                                                               and $projection.ProfitCenter               = _CurrentProfitCenter.ProfitCenter
                                                                               and _CurrentProfitCenter.ValidityStartDate <= $session.system_date
                                                                               and _CurrentProfitCenter.ValidityEndDate   >= $session.system_date
  association [0..1] to I_CostCenter               as _CurrentCostCenter       on  $projection.ControllingArea          = _CurrentCostCenter.ControllingArea
                                                                               and $projection.CostCenter               = _CurrentCostCenter.CostCenter
                                                                               and _CurrentCostCenter.ValidityStartDate <= $session.system_date
                                                                               and _CurrentCostCenter.ValidityEndDate   >= $session.system_date
  association [0..1] to I_GLAccountHierarchyNode   as _GLAccountHierarchyNode  on  _GLAccountHierarchyNode.GLAccountHierarchy = _AvailyCtrlProfileSemanticTag.GLAccountHierarchy
                                                                               and _GLAccountHierarchyNode.HierarchyNode      = _AvailyCtrlProfileSemanticTag.HierarchyNode
                                                                               and _GLAccountHierarchyNode.ValidityEndDate    = '99991231'

  association [0..*] to I_GLAccountHierarchyNodeT  as _GLAccountHierarchyNodeT on  $projection.GLAccountHierarchy           = _GLAccountHierarchyNodeT.GLAccountHierarchy
                                                                               and $projection.HierarchyNode                = _GLAccountHierarchyNodeT.HierarchyNode
                                                                               and _GLAccountHierarchyNodeT.ValidityEndDate = '99991231'

  association [0..*] to I_GLAccountHierarchyText   as _GLAccountHierarchyText  on  $projection.GLAccountHierarchy = _GLAccountHierarchyText.GLAccountHierarchy //added

  association [0..*] to I_PlanningCategoryText     as _PlanningCategoryText    on  $projection.PlanningCategory = _PlanningCategoryText.PlanningCategory       //added



  //JVA added begin

  association [0..*] to I_JointVentureDesc         as _JointVentureDesc         //on $projection.CompanyCode                             = GLAccountLineItem.CompanyCode

                                                                               on  _JointVentureDesc.CompanyCode  = GLAccountLineItem.CompanyCode
                                                                               and _JointVentureDesc.JointVenture = GLAccountLineItem.JointVenture

  association [0..*] to I_JntVntrEquityGrpText     as _JntVntrEquityGrpText     //on $projection.CompanyCode                             = GLAccountLineItem.CompanyCode

                                                                               on  _JntVntrEquityGrpText.CompanyCode          = GLAccountLineItem.CompanyCode
                                                                               and _JntVntrEquityGrpText.JointVenture         = GLAccountLineItem.JointVenture
                                                                               and _JntVntrEquityGrpText.JntOpgAgrmtEquityGrp = GLAccountLineItem.JointVentureEquityGroup

  association [0..*] to I_JointVentureRecoveryText as _JointVentureRecoveryText //on  $projection.CompanyCode                            = GLAccountLineItem.CompanyCode

                                                                               on  _JointVentureRecoveryText.CompanyCode              = GLAccountLineItem.CompanyCode
                                                                               and _JointVentureRecoveryText.JointVentureRecoveryCode = GLAccountLineItem.JointVentureCostRecoveryCode
  //JVA added end


{
  $parameters.P_KeyDate                                                                                                                             as KeyDate,
  cast( cast( 'ACT01' as abap.char( 5  )) as fcom_category)                                                                                         as PlanningCategory,
  GLAccountLineItem.FiscalYear,
  GLAccountLineItem.FiscalPeriod,
  GLAccountLineItem.SourceLedger                                                                                                                    as Ledger,
  GLAccountLineItem.ControllingArea,
  _CostCenterAtPostingDate.BudgetCarryingCostCenter                                                                                                 as BudgetCarryingCostCenter,

  _AvailyCtrlProfileSemanticTag.GLAccountHierarchy                                                                                                  as GLAccountHierarchy,
  _AvailyCtrlProfileSemanticTag.HierarchyNode                                                                                                       as HierarchyNode,
  concat( concat( substring( _GLAccountHierarchyID.HierarchyNode, 2, 39 ), '~' ), substring( _AvailyCtrlProfileSemanticTag.HierarchyNode, 2, 23 ) ) as GLAccountHierNodeSemanticKey,
  _BudgetCarryingCostCenter.AvailabilityControlProfile                                                                                              as AvailabilityControlProfile,
  @Semantics.currencyCode:true
  GLAccountLineItem.GlobalCurrency,
  @Semantics.currencyCode:true
  GLAccountLineItem.CompanyCodeCurrency,
  GLAccountLineItem.LedgerFiscalYear,
  GLAccountLineItem.FiscalYearVariant,
  GLAccountLineItem.CompanyCode                                                                                                                     as CompanyCode,
  _PredictionLedger.PredictionLedger,

  @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
  @DefaultAggregation: #SUM
  cast( 0 as fins_vkcur12)                                                                                                                          as PlanAmountInCompanyCodeCrcy,

  @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
  @DefaultAggregation: #SUM
  cast( 0 as fins_vkcur12)                                                                                                                          as BudgetAmountInCompanyCodeCrcy,

  @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
  @DefaultAggregation: #SUM
  GLAccountLineItem.AmountInCompanyCodeCurrency                                                                                                     as ActualCostAmtInCCCrcy,

  @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
  @DefaultAggregation: #SUM
  cast( 0 as fins_vkcur12)                                                                                                                          as CmtmtCostInCCCrcy,

  @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
  @DefaultAggregation: #SUM
  GLAccountLineItem.AmountInCompanyCodeCurrency                                                                                                     as TotAssgdAmtInCoCodeCurrency,

  @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
  @DefaultAggregation: #SUM
  -GLAccountLineItem.AmountInCompanyCodeCurrency                                                                                                    as AvailableBdgtAmtInCoCodeCrcy,

  @Semantics.amount.currencyCode: 'GlobalCurrency'
  @DefaultAggregation: #SUM
  cast(0 as fins_vkcur12)                                                                                                                           as PlanAmountInGlobalCurrency,

  @Semantics.amount.currencyCode: 'GlobalCurrency'
  @DefaultAggregation: #SUM
  cast( 0 as fins_vkcur12)                                                                                                                          as BudgetInGlobalCrcy,

  @Semantics.amount.currencyCode: 'GlobalCurrency'
  @DefaultAggregation: #SUM
  GLAccountLineItem.AmountInGlobalCurrency                                                                                                          as ActualCostInGlobalCrcy,

  @Semantics.amount.currencyCode: 'GlobalCurrency'
  @DefaultAggregation: #SUM
  cast( 0 as fins_vkcur12)                                                                                                                          as CmtmtCostInGlobalCurrency,

  @Semantics.amount.currencyCode: 'GlobalCurrency'
  @DefaultAggregation: #SUM
  GLAccountLineItem.AmountInGlobalCurrency                                                                                                          as TotAssgdAmtInGlobalCurrency,

  @Semantics.amount.currencyCode: 'GlobalCurrency'
  @DefaultAggregation: #SUM
  -GLAccountLineItem.AmountInGlobalCurrency                                                                                                         as AvailableBudgetInGlobalCrcy,

  _BudgetCarryingCostCenter._Text[1:Language = $parameters.P_Language].CostCenterName                                                               as BudgetCarryingCostCenterName,
  _GLAccountHierarchyNodeT[1:Language = $parameters.P_Language].HierarchyNodeText                                                                   as HierarchyNodeText,
  _CostCenterAtPostingDate._Text[1:Language = $parameters.P_Language].CostCenterName                                                                as CostCenterName,
  GLAccountLineItem._GLAccountInChartOfAccounts._Text[1:Language = $parameters.P_Language].GLAccountName                                            as GLAccountName,
  GLAccountLineItem._ControllingArea,
  GLAccountLineItem._FiscalYear,
  GLAccountLineItem._CompanyCode                                                                                                                    as _CompanyCode,
  GLAccountLineItem._FiscalPeriodForVariant,
  GLAccountLineItem._LedgerFiscalYearForVariant,
  GLAccountLineItem._FiscalYearVariant,
  _GLAccountHierarchyNode,
  _GLAccountHierarchyNodeT,
  _GLAccountHierarchyText[1:Language = $parameters.P_Language].GLAccountHierarchyName                                                               as GLAccountHierarchyName, //added

  cast('                                        ' as fcom_category_t preserving type )                                                              as PlanningCategoryName, //added


  // for DCL (authority check):

  GLAccountLineItem.FinancialAccountType,
  GLAccountLineItem.OrderID,
  GLAccountLineItem.AccountingDocumentType,
  GLAccountLineItem.Customer,
  GLAccountLineItem.Segment,
  GLAccountLineItem.BusinessArea,
  GLAccountLineItem.ProfitCenter,
  GLAccountLineItem.Supplier,
  GLAccountLineItem.SalesOrganization,
  GLAccountLineItem.Plant,
  GLAccountLineItem.ServiceDocumentType,
  GLAccountLineItem.ValuationArea,
  GLAccountLineItem.SalesDocument,
  GLAccountLineItem.CostCenter,
  GLAccountLineItem.GLAccount,
  GLAccountLineItem.DistributionChannel,
  GLAccountLineItem.OrganizationDivision,
  GLAccountLineItem.ServiceDocument,
  GLAccountLineItem.AssetClass,
  GLAccountLineItem.PostingDate,
  GLAccountLineItem.FunctionalArea,

  // associations for DCL (authority check)

  GLAccountLineItem._Ledger,
  GLAccountLineItem._Order,
  GLAccountLineItem._AccountingDocumentType,
  GLAccountLineItem._Customer,
  _CurrentProfitCenter,
  _CurrentCostCenter,
  GLAccountLineItem._Supplier,
  GLAccountLineItem._GLAccountInCompanyCode,
  GLAccountLineItem._SalesDocument,
  GLAccountLineItem._ServiceDocument,

  //  JVA Fields

  GLAccountLineItem.JointVenture                                                                                                                    as JointVenture, //added  JVA

  _JointVentureDesc[1:Language = $parameters.P_Language].JointVentureName                                                                           as JointVentureName, //added  JVA


  GLAccountLineItem.JointVentureEquityGroup                                                                                                         as JointVentureEquityGroup, //added  JVA

  _JntVntrEquityGrpText[1:Language = $parameters.P_Language].JntOpgAgrmtEquityGrpText                                                               as JointVentureEquityGroupName, //added  JVA



  GLAccountLineItem.JointVentureCostRecoveryCode                                                                                                    as JointVentureRecoveryCode, //added  JVA

  _JointVentureRecoveryText[1:Language = $parameters.P_Language].JointVentureRecoveryCodeName                                                       as JointVentureRecoveryCodeName //added  JVA


}

where
      _CostCenterAtPostingDate.BudgetCarryingCostCenter <> ''
  and GLAccountLineItem.CostCenter                      <> ''
  and // Exclude so-called 'cutback postings' from joint venture accounting

      GLAccountLineItem.JointVentureAccountingActivity  <> 'CI'
  and GLAccountLineItem.SourceLedger                    =  :P_LeadingLedger
  and GLAccountLineItem.IsCommitment                    =  ''


union all


////////////////////////////////

// C O M M I T M E N T S

////////////////////////////////

select from       I_GLAccountLineItemRawData     as GLAccountLineItem
  inner join      I_CostCenter                   as _CostCenterAtPostingDate      on  GLAccountLineItem.ControllingArea          =  _CostCenterAtPostingDate.ControllingArea
                                                                                  and GLAccountLineItem.CostCenter               =  _CostCenterAtPostingDate.CostCenter
                                                                                  and _CostCenterAtPostingDate.ValidityStartDate <= GLAccountLineItem.PostingDate
                                                                                  and _CostCenterAtPostingDate.ValidityEndDate   >= GLAccountLineItem.PostingDate
  inner join      I_CostCenter                   as _BudgetCarryingCostCenter     on  _CostCenterAtPostingDate.ControllingArea          =  _BudgetCarryingCostCenter.ControllingArea
                                                                                  and _CostCenterAtPostingDate.BudgetCarryingCostCenter =  _BudgetCarryingCostCenter.CostCenter
                                                                                  and _BudgetCarryingCostCenter.ValidityStartDate       <= GLAccountLineItem.PostingDate
                                                                                  and _BudgetCarryingCostCenter.ValidityEndDate         >= GLAccountLineItem.PostingDate
  inner join      I_AvailyCtrlProfileSemanticTag as _AvailyCtrlProfileSemanticTag on _BudgetCarryingCostCenter.AvailabilityControlProfile = _AvailyCtrlProfileSemanticTag.AvailabilityControlProfile
  inner join      I_GLAccountHierSubTree         as _GLAccountHierSubTree         on  _GLAccountHierSubTree.GLAccountHierarchy = _AvailyCtrlProfileSemanticTag.GLAccountHierarchy
                                                                                  and _GLAccountHierSubTree.HierarchyNode      = _AvailyCtrlProfileSemanticTag.HierarchyNode
                                                                                  and _GLAccountHierSubTree.GLAccount          = GLAccountLineItem.GLAccount
                                                                                  and _GLAccountHierSubTree.ChartOfAccounts    = GLAccountLineItem.ChartOfAccounts
  inner join      I_GLAccountHierarchyNode       as _GLAccountHierarchyID         on  _GLAccountHierarchyID.GLAccountHierarchy = _AvailyCtrlProfileSemanticTag.GLAccountHierarchy
                                                                                  and _GLAccountHierarchyID.ValidityEndDate    = '99991231'
                                                                                  and _GLAccountHierarchyID.NodeType           = 'R'

  left outer join I_PredictionLedger             as _PredictionLedger             on _PredictionLedger.LedgerIsRelevantForAvailyCtrl = 'X'

association [0..1] to I_ProfitCenter             as _CurrentProfitCenter     on  $projection.ControllingArea            = _CurrentProfitCenter.ControllingArea
                                                                             and $projection.ProfitCenter               = _CurrentProfitCenter.ProfitCenter
                                                                             and _CurrentProfitCenter.ValidityStartDate <= $session.system_date
                                                                             and _CurrentProfitCenter.ValidityEndDate   >= $session.system_date
association [0..1] to I_CostCenter               as _CurrentCostCenter       on  $projection.ControllingArea          = _CurrentCostCenter.ControllingArea
                                                                             and $projection.CostCenter               = _CurrentCostCenter.CostCenter
                                                                             and _CurrentCostCenter.ValidityStartDate <= $session.system_date
                                                                             and _CurrentCostCenter.ValidityEndDate   >= $session.system_date
association [0..1] to I_GLAccountHierarchyNode   as _GLAccountHierarchyNode  on  _GLAccountHierarchyNode.GLAccountHierarchy = _AvailyCtrlProfileSemanticTag.GLAccountHierarchy
                                                                             and _GLAccountHierarchyNode.HierarchyNode      = _AvailyCtrlProfileSemanticTag.HierarchyNode
                                                                             and _GLAccountHierarchyNode.ValidityEndDate    = '99991231'

association [0..*] to I_GLAccountHierarchyNodeT  as _GLAccountHierarchyNodeT on  $projection.GLAccountHierarchy           = _GLAccountHierarchyNodeT.GLAccountHierarchy
                                                                             and $projection.HierarchyNode                = _GLAccountHierarchyNodeT.HierarchyNode
                                                                             and _GLAccountHierarchyNodeT.ValidityEndDate = '99991231'

association [0..*] to I_GLAccountHierarchyText   as _GLAccountHierarchyText  on  $projection.GLAccountHierarchy = _GLAccountHierarchyText.GLAccountHierarchy   //added

association [0..*] to I_PlanningCategoryText     as _PlanningCategoryText    on  $projection.PlanningCategory = _PlanningCategoryText.PlanningCategory         //added



//JVA added begin

association [0..*] to I_JointVentureDesc         as _JointVentureDesc           //on $projection.CompanyCode                             = GLAccountLineItem.CompanyCode

                                                                             on  _JointVentureDesc.CompanyCode  = GLAccountLineItem.CompanyCode
                                                                             and _JointVentureDesc.JointVenture = GLAccountLineItem.JointVenture

association [0..*] to I_JntVntrEquityGrpText     as _JntVntrEquityGrpText       //on $projection.CompanyCode                             = GLAccountLineItem.CompanyCode

                                                                             on  _JntVntrEquityGrpText.CompanyCode          = GLAccountLineItem.CompanyCode
                                                                             and _JntVntrEquityGrpText.JointVenture         = GLAccountLineItem.JointVenture
                                                                             and _JntVntrEquityGrpText.JntOpgAgrmtEquityGrp = GLAccountLineItem.JointVentureEquityGroup

association [0..*] to I_JointVentureRecoveryText as _JointVentureRecoveryText   //on  $projection.CompanyCode                            = GLAccountLineItem.CompanyCode

                                                                             on  _JointVentureRecoveryText.CompanyCode              = GLAccountLineItem.CompanyCode
                                                                             and _JointVentureRecoveryText.JointVentureRecoveryCode = GLAccountLineItem.JointVentureCostRecoveryCode
//JVA added end


{
  $parameters.P_KeyDate                                                                                                                             as KeyDate,
  cast( cast( 'ACT01' as abap.char( 5  )) as fcom_category)                                                                                         as PlanningCategory,
  GLAccountLineItem.FiscalYear,
  GLAccountLineItem.FiscalPeriod,
  GLAccountLineItem.SourceLedger                                                                                                                    as Ledger,
  GLAccountLineItem.ControllingArea,
  _CostCenterAtPostingDate.BudgetCarryingCostCenter                                                                                                 as BudgetCarryingCostCenter,

  _AvailyCtrlProfileSemanticTag.GLAccountHierarchy                                                                                                  as GLAccountHierarchy,
  _AvailyCtrlProfileSemanticTag.HierarchyNode                                                                                                       as HierarchyNode,
  concat( concat( substring( _GLAccountHierarchyID.HierarchyNode, 2, 39 ), '~' ), substring( _AvailyCtrlProfileSemanticTag.HierarchyNode, 2, 23 ) ) as GLAccountHierNodeSemanticKey,
  _BudgetCarryingCostCenter.AvailabilityControlProfile                                                                                              as AvailabilityControlProfile,
  @Semantics.currencyCode:true
  GLAccountLineItem.GlobalCurrency,
  @Semantics.currencyCode:true
  GLAccountLineItem.CompanyCodeCurrency,
  GLAccountLineItem.LedgerFiscalYear,
  GLAccountLineItem.FiscalYearVariant,
  GLAccountLineItem.CompanyCode                                                                                                                     as CompanyCode,
  _PredictionLedger.PredictionLedger,

  @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
  @DefaultAggregation: #SUM
  cast( 0 as fins_vkcur12)                                                                                                                          as PlanAmountInCompanyCodeCrcy,

  @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
  @DefaultAggregation: #SUM
  cast( 0 as fins_vkcur12)                                                                                                                          as BudgetAmountInCompanyCodeCrcy,

  @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
  @DefaultAggregation: #SUM
  cast( 0 as fins_vkcur12)                                                                                                                          as ActualCostAmtInCCCrcy,

  @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
  @DefaultAggregation: #SUM
  GLAccountLineItem.AmountInCompanyCodeCurrency                                                                                                     as CmtmtCostInCCCrcy,

  @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
  @DefaultAggregation: #SUM
  GLAccountLineItem.AmountInCompanyCodeCurrency                                                                                                     as TotAssgdAmtInCoCodeCurrency,

  @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
  @DefaultAggregation: #SUM
  -GLAccountLineItem.AmountInCompanyCodeCurrency                                                                                                    as AvailableBdgtAmtInCoCodeCrcy,

  @Semantics.amount.currencyCode: 'GlobalCurrency'
  @DefaultAggregation: #SUM
  cast(0 as fins_vkcur12)                                                                                                                           as PlanAmountInGlobalCurrency,

  @Semantics.amount.currencyCode: 'GlobalCurrency'
  @DefaultAggregation: #SUM
  cast( 0 as fins_vkcur12)                                                                                                                          as BudgetInGlobalCrcy,

  @Semantics.amount.currencyCode: 'GlobalCurrency'
  @DefaultAggregation: #SUM
  cast( 0 as fins_vkcur12)                                                                                                                          as ActualCostInGlobalCrcy,

  @Semantics.amount.currencyCode: 'GlobalCurrency'
  @DefaultAggregation: #SUM
  GLAccountLineItem.AmountInGlobalCurrency                                                                                                          as CmtmtCostInGlobalCurrency,

  @Semantics.amount.currencyCode: 'GlobalCurrency'
  @DefaultAggregation: #SUM
  GLAccountLineItem.AmountInGlobalCurrency                                                                                                          as TotAssgdAmtInGlobalCurrency,

  @Semantics.amount.currencyCode: 'GlobalCurrency'
  @DefaultAggregation: #SUM
  -GLAccountLineItem.AmountInGlobalCurrency                                                                                                         as AvailableBudgetInGlobalCrcy,

  _BudgetCarryingCostCenter._Text[1:Language = $parameters.P_Language].CostCenterName                                                               as BudgetCarryingCostCenterName,
  _GLAccountHierarchyNodeT[1:Language = $parameters.P_Language].HierarchyNodeText                                                                   as HierarchyNodeText,
  _CostCenterAtPostingDate._Text[1:Language = $parameters.P_Language].CostCenterName                                                                as CostCenterName,
  GLAccountLineItem._GLAccountInChartOfAccounts._Text[1:Language = $parameters.P_Language].GLAccountName