@AbapCatalog.sqlViewName: 'PPROJBDGTITM'
@VDM.viewType: #COMPOSITE
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@VDM.private:true
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.buffering.status: #NOT_ALLOWED
@Metadata.ignorePropagatedAnnotations: true
@AbapCatalog.preserveKey:true
define view P_ProjectBudgetItems
as select from P_ProjectsWithProjCat6 as Project
// as select from I_ActualPlanJournalEntryItem as _ProjCstLineItm
inner join I_ActualPlanJournalEntryItem as _ProjCstLineItm on _ProjCstLineItm.ProjectInternalID = Project.ProjectInternalID
inner join I_ControllingArea as _ContArea on _ContArea.ControllingArea = _ProjCstLineItm.ControllingArea
// inner join R_ProjectSemTagGLAccount as _SemTagGL on _SemTagGL.HierarchyNodeVal = _ProjCstLineItm.GLAccount
// and _ProjCstLineItm.ChartOfAccounts = _SemTagGL.HierarchyNodeClass
inner join P_PROJECTSEMTAGACC as _SemTagGL on _ProjCstLineItm.ControllingArea = _SemTagGL.ControllingArea
and _ProjCstLineItm.GLAccount = _SemTagGL.HierarchyNodeVal
and _ProjCstLineItm.ChartOfAccounts = _SemTagGL.HierarchyNodeClass
inner join P_GetRlvtSemanticTagForProj as _AllCost on _AllCost.ProjectInternalID = _ProjCstLineItm.ProjectInternalID
// left outer join I_ProjectBasicData as _ProjectBasicData on _ProjCstLineItm.ProjectInternalID = _ProjectBasicData.ProjectInternalID
left outer join I_WBSElementBasicData as _WBSElementBasicData on _ProjCstLineItm.WBSElementInternalID = _WBSElementBasicData.WBSElementInternalID
left outer join I_EnterpriseProject as _ProjectSummary on _ProjectSummary.ProjectInternalID = _ProjCstLineItm.ProjectInternalID
association [0..1] to I_FiscalPeriodForVariant as _FiscalPeriod on $projection.LedgerFiscalYear = _FiscalPeriod.FiscalYear
and $projection.FiscalPeriod = _FiscalPeriod.FiscalPeriod
and $projection.FiscalYearVariant = _FiscalPeriod.FiscalYearVariant
{
key SourceLedger,
key Ledger,
key case
when _ProjCstLineItm.CompanyCode is initial or _ProjCstLineItm.CompanyCode is null
then _WBSElementBasicData.CompanyCode
else _ProjCstLineItm.CompanyCode end as CompanyCode,
key FiscalYear,
key AccountingDocument,
key FinancialPlanningReqTransSqnc,
key FinancialPlanningDataPacket,
key ActualPlanJournalEntryItem,
LedgerFiscalYear,
LedgerGLLineItem,
FinancialPlanningEntryItem,
_ProjCstLineItm.GLAccount,
_ProjCstLineItm.ChartOfAccounts,
AccountingDocCreatedByUser,
_SemTagGL.GLAccountHierarchy,
BusinessArea,
_ProjCstLineItm.CostCenter,
_ProjCstLineItm.BudgetProcess, // S/4 Hana- CE2108- Inclusion of Budget Process
// S/4 Hana CE2302- Field Deprecation - Begin
//PartnerOrder,
_ProjCstLineItm.PartnerOrder_2 as PartnerOrder,
// S/4 Hana CE2302- Field Deprecation - Begin
PartnerOrderCategory,
// S/4 Hana CE2302- Field Deprecation - Begin
//PartnerWBSElement,
_ProjCstLineItm.PartnerWBSElementExternalID as PartnerWBSElement,
//PartnerProject,
_ProjCstLineItm.PartnerProjectExternalID as PartnerProject,
// S/4 Hana CE2302- Field Deprecation - End
BusinessTransactionType,
DebitCreditCode,
ControllingDebitCreditCode,
case
when _ProjCstLineItm.ProfitCenter is initial or _ProjCstLineItm.ProfitCenter is null
then _WBSElementBasicData.ProfitCenter
else _ProjCstLineItm.ProfitCenter end as ProfitCenter,
_WBSElementBasicData.ProfitCenter as WBSElementProfitCenter,
_WBSElementBasicData.WBSDescription,
//_WBSElementBasicData.WBSElementInternalID, //Commented in CE1908
_WBSElementBasicData.WBSElementObject as ProjectObjectNode,
//_WBSElementBasicData.WBSElement,
// S/4 Hana CE2302- Field Deprecation - Begin
//_ProjCstLineItm.WBSElement,
_ProjCstLineItm.WBSElementExternalID as WBSElement,
// S/4 Hana CE2302- Field Deprecation - end
_WBSElementBasicData.ResponsibleCostCenter,
// CE2005 Project type as filter
// _WBSElementBasicData.ProjectType,
_ProjectSummary.EnterpriseProjectType as ProjectType,
_ProjCstLineItm.WBSElementInternalID, //CE1908
Project.ControllingArea,
//Project.Project,
// S/4 Hana CE2302- Field Deprecation - Begin
//_ProjCstLineItm.Project,
_ProjCstLineItm.ProjectExternalID as Project,
// S/4 Hana CE2302- Field Deprecation - end
_ProjCstLineItm.ProjectInternalID,
_ProjCstLineItm.ProjectExternalID, // added for testing : Architecture changes for conversion exit
Project.ProjectDescription,
Project.ProjectProfileCode,
Project.ProjectObject,
Project.AvailabilityControlProfile,
Project.AvailabilityControlIsActive,
Project._AvailabilityCtrlProfile._SemanticTag.SemanticTag as ParentSemanticTag,
Project._AvailabilityCtrlProfile.AvailyCtrlTimeRangeType,
Project._AvailabilityCtrlProfile.BudgetCurrencyRole,
Project.ProjectCurrency, //Ce1911 changes add project currency field
_ProjectSummary.ProjectSummaryTaskUUID,
'6' as ProjectCategory,
_ProjectSummary.ProjectUUID,
_ProjectSummary.ProcessingStatus,
_ProjectSummary.ProjectSummaryTaskUUID as TaskUUID, //CE1911
_ProjCstLineItm.CreationDate,
_ProjCstLineItm.FunctionalArea,
CostCtrActivityType,
@Semantics.currencyCode: true
ControllingObjectCurrency,
@DefaultAggregation: #SUM
@Semantics.amount.currencyCode: 'ControllingObjectCurrency'
AmountInObjectCurrency,
@Semantics.currencyCode:true
TransactionCurrency,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'TransactionCurrency'} }
AmountInTransactionCurrency,
@Semantics.currencyCode:true
CompanyCodeCurrency,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'CompanyCodeCurrency'} }
AmountInCompanyCodeCurrency,
@Semantics.currencyCode:true
GlobalCurrency,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'GlobalCurrency'} }
AmountInGlobalCurrency,
// S/4 HANA -CE2108- INCLUSION OF FUNCTIONAL CURRENCY- BEGIN
@Semantics.currencyCode:true
_ProjCstLineItm.FunctionalCurrency,
@Semantics: { amount : {currencyCode: 'FunctionalCurrency'} }
@DefaultAggregation: #SUM
_ProjCstLineItm.AmountInFunctionalCurrency,
// S/4 HANA -CE2108- INCLUSION OF FUNCTIONAL CURRENCY- END
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'GlobalCurrency'} }
case
when PlanningCategory = 'ACT01' and IsCommitment != 'X'
then AmountInGlobalCurrency
end as ActualAmountInGlobalCurrency,
@DefaultAggregation: #SUM
@Semantics: { amount : {currencyCode: 'ControllingObjectCurrency'} }
case
when PlanningCategory = 'ACT01' and IsCommitment != 'X'
then AmountInObjectCurrency
end as ActlCostInProjCrcy,
case
when IsCommitment = 'X'
then 'CMTMT'
else PlanningCategory
end as PlanningCategory,
PostingDate,
DocumentDate,
FiscalPeriod,
FiscalYearPeriod,
_ProjCstLineItm.FiscalYearVariant,
case
when ControllingDebitCreditCode = 'A'
then ''
when ControllingDebitCreditCode = 'S' and
(BusinessTransactionType = 'KOAO' or BusinessTransactionType = 'KOAE') and
( PartnerProject = ' ' and PartnerOrder = ' ' and PartnerSalesDocument = ' ' and PartnerProjectNetwork = ' ' and PartnerProjectNetworkActivity = ' ' and PartnerBusinessProcess = ' ' and PartnerCostObject = ' ')
then ''
when ControllingDebitCreditCode = 'S' and (BusinessTransactionType = 'KOAO' or BusinessTransactionType = 'KOAE') and
(PartnerProject = _ProjCstLineItm.Project)
then ''
else 'X'
end as IsSettled,
SourceReferenceDocumentType,
SourceLogicalSystem,
SourceReferenceDocumentCntxt,
SourceReferenceDocument,
SourceReferenceDocumentItem,
SourceReferenceDocSubitem,
IsCommitment,
_SemTagGL.SemanticTag,
_AllCost.SemanticTagIsBudgetRelevant,
_AllCost.SemanticTagIsBudgetRelevant as ObjectIsBudgeted, //This is for the new column to be added in PBRLI
_AllCost.ProjectIsBudgetRelevant,
//CE1911 memory allocation dump
//_Project,
//_WBSElement,
_FiscalPeriod
}
where
_SemTagGL.GLAccountHierarchy = _ContArea.CtrlgStdFinStatementVersion
//added for memory allocation exception and for perfo rmance improovement: 1911 fix
and _ContArea.CtrlgStdFinStatementVersion is not initial
and(
_ProjCstLineItm.Ledger = _ProjCstLineItm.SourceLedger
or _ProjCstLineItm.SourceLedger = '' // needed for plan data
)
and(
_Ledger.IsLeadingLedger = 'X'
or IsCommitment = 'X'
)
and Project.Project != ''
and(
_SemTagGL.ValidityStartDate <= $session.system_date
and _SemTagGL.ValidityEndDate >= $session.system_date
)
and _SemTagGL.SemanticTag = _AllCost.SemanticTag
and _AllCost.FinancialStatementVariant = _ContArea.CtrlgStdFinStatementVersion
and Project.ProjectProfileCode <> 'YP01'
and _ProjectSummary.ProjectInternalID = _ProjCstLineItm.ProjectInternalID
and(
(
_WBSElementBasicData.CompanyCode = _ProjCstLineItm.CompanyCode
and(
PlanningCategory = 'ACT01'
or IsCommitment = 'X'
)
)
or(
PlanningCategory != 'ACT01'
or IsCommitment != 'X'
)
)
//S/4HANA CE2108 - Excluding Maintenance Order records-Begin
and _ProjCstLineItm.AccountAssignmentType != 'OR'
//S/4HANA CE2108 - Excluding Maintenance Order records-End
// S/4 HANA - CE2108 - EXCLUSION OF cutback costs in budget calculation for JVA customers - BEGIN
and _ProjCstLineItm.JointVentureAccountingActivity != 'CI'
// S/4 HANA - CE2108 - EXCLUSION OF cutback costs in budget calculation for JVA customers - END
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ACTUALPLANJOURNALENTRYITEM",
"I_AVAILABILITYCTRLPROFILE",
"I_AVAILYCTRLPROFILESEMANTICTAG",
"I_CONTROLLINGAREA",
"I_ENTERPRISEPROJECT",
"I_LEDGER",
"I_WBSELEMENTBASICDATA",
"P_GETRLVTSEMANTICTAGFORPROJ",
"P_PROJECTSEMTAGACC",
"P_PROJECTSWITHPROJCAT6"
],
"ASSOCIATED":
[
"I_FISCALPERIODFORVARIANT"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/