//@AbapCatalog.sqlViewName: 'IPRJBLGELMTP'
//@ClientHandling.algorithm: #SESSION_VARIABLE
//@ClientHandling.type: #CLIENT_DEPENDENT
@VDM.viewType: #TRANSACTIONAL
@VDM.lifecycle.contract.type: #SAP_INTERNAL_API
//@AbapCatalog.compiler.compareFilter: true
//@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Details of Billing Element'
//@AccessControl.privilegedAssociations: ['_SalesBillingPlanDueDate']
@AccessControl.personalData.blocking: #NOT_REQUIRED
@ObjectModel.usageType: {
sizeCategory: #XL,
dataClass: #TRANSACTIONAL,
serviceQuality: #C
}
@ObjectModel.sapObjectNodeType.name: 'ProjectBillingElement'
define root view entity I_ProjectBillingElementTP
as select from I_ProjectBillingElement as ProjectBillingElement
// This is a temporary workaround tried out below : FXU
// Need to change once associations are supported in projection view - changes are done in line 23 to 32
// added extra inner join (upto line 31) just because we were getting several errors while accessing
// This is not correct way to do associations/joins: Currently this is only done to improve performance in below view
// I_ProjectBillingElement - The service quality can now be changed to A from C
//added by FXU
-- inner join I_WBSElementBasicData as _WBSData on ProjectBillingElement.BillingWBSElementInternalID = _WBSData.WBSElementInternalID
// inner join I_ProjectBasicData as _Proj on _WBSData.ProjectInternalID = _Proj.ProjectInternalID
// inner join I_EngagementProjectItem as _EngProjItem on _Proj.ProjectObject = _EngProjItem.EngagementProjectItem
// and _EngProjItem.EngagementProjectItemType = '0PD'
// inner join I_EngagementProject as EngProj on _EngProjItem.EngagementProject = EngProj.EngagementProject
// left outer join P_CUSTPROJSLSORDITMBYUSER as _CUSTPROJSLSORDITMBYUSER on _CUSTPROJSLSORDITMBYUSER.WBSElement = ProjectBillingElement.BillingWBSElementInternalID
// and _CUSTPROJSLSORDITMBYUSER.UserID = $session.user
--YD association [0..*] to P_CUSTPROJSLSORDITMBYUSER as _CUSTPROJSLSORDITMBYUSER on _CUSTPROJSLSORDITMBYUSER.WBSElement = ProjectBillingElement.BillingWBSElementInternalID
--YD and _CUSTPROJSLSORDITMBYUSER.UserID = $session.user
-- association [0..1] to I_MyProjectBillingElements as _MyProjectBillingElements on _MyProjectBillingElements.BillingWBSElementInternalID = ProjectBillingElement.BillingWBSElementInternalID
-- and _MyProjectBillingElements.UserID = $session.user
association [0..1] to P_ProjBillgElmntSalesDets as _ProjBillgElmntSalesDets on $projection.BillingWBSElementInternalID = _ProjBillgElmntSalesDets.BillingWBSElementInternalID
// association [1..1] to I_EnterpriseProject as _EnterpriseProject on _WBSData.ProjectInternalID = _EnterpriseProject.ProjectInternalID
--association [1..1] to I_EnterpriseProject as _EnterpriseProject on $projection.ProjectInternalID = _EnterpriseProject.ProjectInternalID
// association [1..1] to I_EngagementProjectItem as _EngProjItem1 on $projection.ProjectObject = _EngProjItem1.EngagementProjectItem
// and _EngProjItem1.EngagementProjectItemType = '0PD'
// and $projection.project = _EngProjItem1.EngagementProject
association [1..1] to I_EnterpriseProjectElement as _EnterpriseProjectElement on $projection.BillingWBSElementInternalID = _EnterpriseProjectElement.WBSElementInternalID
and _EnterpriseProjectElement.WBSElementIsBillingElement = 'X'
--association [1..1] to I_SalesOrderItem as _SalesOrderItem on $projection.BillingWBSElementInternalID = _SalesOrderItem.WBSElementInternalID
-- association [1..1] to I_SalesOrder as _SalesOrder on $projection.salesorder = _SalesOrder.SalesOrder
--association [1..1] to I_SalesDocItemBillingPlan as _SalesDocItemBillPlan on $projection.billingplan = _SalesDocItemBillPlan.BillingPlan
association [1..*] to I_ProjectBillingDocDetails as _ProjectBillingDocDetails on $projection.BillingWBSElementInternalID = _ProjectBillingDocDetails.WBSElementInternalID
// association [0..1] to I_WBSElementBasicData as _WBSElement on $projection.BillingWBSElementInternalID = _WBSElement.WBSElementInternalID
// association [1..*] to I_ProjectBillgRequestRevnCube as _ProjectBillgRequestRevnCube on $projection.ProjectBillingElementUUID = _ProjectBillgRequestRevnCube.ProjectBillingElementUUID
association [1..1] to I_TmpProjectBillingRequest as _TmpProjectBillingRequest on $projection.ProjectBillingElementUUID = _TmpProjectBillingRequest.ProjectBillingElementUUID
and _TmpProjectBillingRequest.ProjectBillingRequestStatus = 'C'
association [0..*] to I_ProjectBillingRequestItemTP as _ProjectBillingRequestItemTP on $projection.ProjectBillingElementUUID = _ProjectBillingRequestItemTP.ProjectBillingElementUUID
// association [0..1] to I_CostCenter as _CostCenter on $projection.responsiblecostcenter = _CostCenter.CostCenter
// and $projection.controllingarea = _CostCenter.ControllingArea
// and $projection.projectstartdate <= _CostCenter.ValidityEndDate
// and $projection.projectstartdate >= _CostCenter.ValidityStartDate
// association [0..1] to I_CostCenterText as _CostCenterText //on $projection.costcenter = _CostCenterText.CostCenter
// on $projection.responsiblecostcenter = _CostCenterText.CostCenter
// and $projection.controllingarea = _CostCenterText.ControllingArea
// and $projection.projectstartdate <= _CostCenterText.ValidityEndDate
// and $projection.projectstartdate >= _CostCenterText.ValidityStartDate
//// and $projection.plannedstartdate <= _CostCenterText.ValidityEndDate
//// and $projection.plannedstartdate >= _CostCenterText.ValidityStartDate
// and _CostCenterText.Language = $session.system_language
association [0..1] to I_ProfitCenterText as _ProfitCenterText on $projection.profitcenter = _ProfitCenterText.ProfitCenter
and $projection.ControllingArea = _ProfitCenterText.ControllingArea
and $projection.projectstartdate <= _ProfitCenterText.ValidityEndDate
and $projection.projectstartdate >= _ProfitCenterText.ValidityStartDate
// and $projection.plannedstartdate <= _ProfitCenterText.ValidityEndDate
// and $projection.plannedstartdate >= _ProfitCenterText.ValidityStartDate
and _ProfitCenterText.Language = $session.system_language
association [0..1] to I_ProfitCenterText as _ProfitCenterName on $projection.WBSElementProfitCenter = _ProfitCenterName.ProfitCenter
and $projection.ControllingArea = _ProfitCenterName.ControllingArea
and $projection.projectstartdate <= _ProfitCenterName.ValidityEndDate
and $projection.projectstartdate >= _ProfitCenterName.ValidityStartDate
// and $projection.plannedstartdate <= _ProfitCenterName.ValidityEndDate
// and $projection.plannedstartdate >= _ProfitCenterName.ValidityStartDate
and _ProfitCenterName.Language = $session.system_language
--association [0..1] to I_ProjectBillingElmntDueDate as _ProjBillingDueDate on $projection.BillingWBSElementInternalID = _ProjBillingDueDate.WBSElementInternalID
//on $projection.billingplan = _ProjBillingDueDate.BillingPlan
association [1..1] to I_Customer as _Customer on $projection.Customer = _Customer.Customer
association [0..*] to I_PrjBlgElmEntrForPrepayment as _PrjBlgElmEntrForPrepayment on $projection.ProjectBillingElementUUID = _PrjBlgElmEntrForPrepayment.ProjectBillingElementUUID
and _PrjBlgElmEntrForPrepayment.PlndPrepaymentAmtInProjCrcy > 0
association [0..1] to I_EngagementProjectSrvcOrgText as _ServiceOrganizationText on _ServiceOrganizationText.EngagementProjectServiceOrg = $projection.EngagementProjectServiceOrg
and _ServiceOrganizationText.Language = $session.system_language
//Extensibility
association [0..1] to E_ProjectBillingElement as _Extension on $projection.ProjectBillingElementUUID = _Extension.ProjectBillingElementUUID
// association [0..1] to I_PrjBlgElmPrepaymentAmount as _PrjBlgElmPrepaymentAmount on $projection.ProjectBillingElementUUID = _PrjBlgElmPrepaymentAmount.ProjectBillingElementUUID
// association [0..1] to I_PrjBlgElmOverduePrepayment as _PrjBlgElmOverduePrepayment on $projection.ProjectBillingElementUUID = _PrjBlgElmOverduePrepayment.ProjectBillingElementUUID
//
composition [0..*] of I_ProjectBillingElementEntryTP as _ProjectBillingElementEntry
{
key ProjectBillingElement.ProjectBillingElementUUID,
ProjectBillingElement.BillingWBSElementInternalID,
ProjectBillingElement.DocumentCurrency,
// ProjectBillingElement.OriginalRevenueAmtInDocCrcy,
ProjectBillingElement.BilledRevenueAmtInDocCrcy,
ProjectBillingElement.WrittenOffRevenueAmtInDocCrcy,
// Admin Fields data
@Semantics.user.createdBy: true
ProjectBillingElement.ProjBillgElmntCreatedByUser,
@Semantics.systemDateTime.createdAt: true
ProjectBillingElement.ProjBillgElmntCreatedAtDteTme,
@Semantics.user.lastChangedBy: true
ProjectBillingElement.ProjBillgElmntLastChgdByUser,
@Semantics.systemDateTime.lastChangedAt: true
ProjectBillingElement.ProjBillgElmntLastChgdAtDteTme,
// The below is referred in association for P_CUSTPROJSLSORDITMBYUSER(My billing elements) and hence cannot be moved up
// _WBSElement.WBSElementExternalID as WBSElement,
--_WBSData.WBSElementExternalID as WBSElementExternalID, // WBSElement, //
_WBSElement.WBSElementExternalID as WBSElementExternalID,
// _WBSData.ProjectInternalID,
--cast ( _WBSData.ProjectInternalID as ps_s4_proj_pspnr preserving type ) as ProjectInternalID,
_EnterpriseProjectElement._Project.ProjectInternalID as ProjectInternalID,
// The below field is referred in I_CostCenterText and I_ProfitCenterText ;hence cannot be moved up
// EngProj.CostCenter,
// The below field is referred in I_CostCenterText and I_ProfitCenterText ;hence cannot be moved up
// EngProj.ControllingArea,
// The below field is used in I_EngagementProject and hence cannot be moved up
// EngProj.EngagementProject,
// The below field is referred in I_ProfitCenterText ;hence cannot be moved up
// EngProj.ProfitCenter,
//Tried moving up,it threw error
// EngProj.EngagementProjectStage as EngagementProjectStage,
// The below field is used in I_EngagementProjectItem and hence cannot be moved up
//_WBSElement._Project.ProjectObject as ProjectObject, //ProjectObject,
-- Don't find where it's used
-- _WBSData._Project.ProjectObject as ProjectObject,
// The below field is used in I_EngagementProjectItem and hence cannot be moved up
//_Proj.Project,
// _WBSData._Project.Project,
// The below is introduced to be used in asscoiation of view I_ProfitCenterText
// _Proj.PlannedStartDate as PlannedStartDate,
// Exposed for my billing element dcl changes. Since its a inner join we cannot use it in dcl without exposing in tp view
// EngProj.EngagementProjectServiceOrg,
// Customer field is moved in this view as the contact card view works on direct fetched fields from underlying view
// EngProj.Customer as Customer,
// The below field is used in I_SlsDocItemBillingPlan and I_SlsDocItemBillingPlanDueDate ; hence cannot be moved up
--_SalesOrderItem.BillingPlan,
_ProjBillgElmntSalesDets.BillingPlan,
// The below field is used in I_ProfitCenterText and hence cannot be moved up
//_WBSElement.ProfitCenter as WBSElementProfitCenter,
--_WBSData.ProfitCenter as WBSElementProfitCenter,
_WBSElement.ProfitCenter as WBSElementProfitCenter,
// The below field cannot be removed as its being used in view : I_ProjectBillingElementEntryTP which inturn uses this view
@Semantics.amount.currencyCode: 'DocumentCurrency'
--_SalesOrderItem.CappedNetAmount as CappedNetAmount,
_ProjBillgElmntSalesDets._SalesOrderItem.CappedNetAmount as CappedNetAmount,
// _EnterpriseProject._ProjectElement.CostCenter,
//_EnterpriseProject.ResponsibleCostCenter, // as CostCenter,
// _EnterpriseProject.ControllingArea as ControllingArea,
// _EnterpriseProject.Project as Project,
// _EnterpriseProject.ProfitCenter,
// _EnterpriseProject.ProcessingStatus, // as EngagementProjectStage,
// _EnterpriseProject.ProjectStartDate,
// _EnterpriseProject.ProjectEndDate,
// -- is needed for service org name retrieval on C-view
// _EnterpriseProject.EnterpriseProjectServiceOrg as EngagementProjectServiceOrg,
_EnterpriseProjectElement.ProjectUUID,
_EnterpriseProjectElement._Project.ControllingArea as ControllingArea,
_EnterpriseProjectElement._Project.Project as Project,
_EnterpriseProjectElement._Project.ProfitCenter,
_EnterpriseProjectElement._Project.ProcessingStatus, // as EngagementProjectStage,
_EnterpriseProjectElement._Project.ProjectStartDate,
_EnterpriseProjectElement._Project.ProjectEndDate,
_EnterpriseProjectElement._Project.EnterpriseProjectServiceOrg as EngagementProjectServiceOrg,
-- _EnterpriseProject.ProjectDescription,
// _EnterpriseProject.EnterpriseProjectServiceOrg as EngagementProjectServiceOrg,
-- Is needed is C-view for on-condition in association to the Customer contact card
--_SalesOrderItem._SalesOrder.SoldToParty as Customer,
_ProjBillgElmntSalesDets._SalesOrder.SoldToParty as Customer,
// _Customer.CustomerName as CustomerName,
// _SalesOrder.SalesOrganization,
// _SalesOrder.DistributionChannel,
//
// My Billing element related changes
-- moved to consumption view
// case
// when _MyProjectBillingElements.UserID = $session.user
// then cast ('X' as boolean)
// else cast ('' as boolean)
// end as IsMyProjectBillingElement,
--_MyProjectBillingElements,
_ProjBillgElmntSalesDets.UserID,
// _CUSTPROJSLSORDITMBYUSER.IsMyProjectBillingElement as IsMyProjectBillingElement,
//IsMyProjectBillingElement,
// This field cannot be moved to up view as this comes from P-view so association cannot be exposed and used
//_CUSTPROJSLSORDITMBYUSER.UserID,
// All Revenue cube fields
_TmpProjectBillingRequest.ProjectBillingRequest,
_TmpProjectBillingRequest.ProjectBillingRequestUUID,
// _ProjectBillgRequestRevnCube.ProjectBillingRequest, //Draft ID
// _ProjectBillgRequestRevnCube.ProjectBillingRequestUUID,
-- not used
-- _WBSData._Project.ProjectCurrency,
// @Semantics.amount.currencyCode: 'ProjectCurrency'
--_SalesOrderItem.SalesOrder,
-- used in C-view in where clause
--_SalesOrderItem.BillingBlockStatus,
_ProjBillgElmntSalesDets._SalesOrderItem.BillingBlockStatus,
-- used in C-view in where clause
--_SalesOrderItem._SalesOrder.TotalBlockStatus,
_ProjBillgElmntSalesDets._SalesOrderItem._SalesOrder.TotalBlockStatus,
_ProjectBillingDocDetails,
_ServiceOrganizationText,
_ProfitCenterText,
_ProfitCenterName,
// _EngProjItem1,
// _ProjBillingDueDate,
// _ProjBillingDueDate(P_BillingPlanItemUsage: '1').DueBillingDate as DueBillingDate,
// _ProjBillingDueDate(P_BillingPlanItemUsage: '').DueBillingDate as BillingPlanBillingDate,
--_ProjBillingDueDate.DueBillingDate as BillingPlanBillingDate,
_ProjBillgElmntSalesDets.DueBillingDate as BillingPlanBillingDate,
// case
// when _ProjBillingDueDate(P_BillingPlanItemUsage: '1').DueBillingDate = '00000000' //is initial
// then cast(_ProjBillingDueDate(P_BillingPlanItemUsage: '1').DueBillingDate as fkdat)
// else cast(_ProjBillingDueDate(P_BillingPlanItemUsage: '1').DueBillingDate as fkdat)
// end as DueBillingDate,
_PrjBlgElmEntrForPrepayment,
--_SalesDocItemBillPlan,
_ProjBillgElmntSalesDets.SalesOrder,
_ProjBillgElmntSalesDets.SalesOrderItem,
_ProjBillgElmntSalesDets._SalesDocItemBillPlan,
--_SalesOrderItem,
_ProjBillgElmntSalesDets._SalesOrderItem,
-- used in C-view in where clause
--_SalesOrderItem._BillingPlan.BillingPlanUsageCategory as BillingPlanUsageCategory,
_ProjBillgElmntSalesDets._SalesDocItemBillPlan.BillingPlanUsageCategory as BillingPlanUsageCategory,
-- _SalesOrder,
_ProjectBillingElementEntry,
ProjectBillingElement._WBSElement,
_ProjectBillingRequestItemTP,
_Customer,
_EnterpriseProjectElement._Project as _EnterpriseProject,
_EnterpriseProjectElement,
//_CostCenterText,
-- used in C-view in where clause
--_SalesOrderItem.SDDocumentRejectionStatus as SDDocumentRejectionStatus
_ProjBillgElmntSalesDets.SDDocumentRejectionStatus as SDDocumentRejectionStatus
//_PrjBlgElmOverduePrepayment.PrjBlgElmPlndPrepaymentIsOvrd,
// @Semantics.amount.currencyCode: 'DocumentCurrency'
// _PrjBlgElmPrepaymentAmount.PlndPrepaymentAmtInProjCrcy
//ProjectBillingElement.RootDraftUUID
//_ProjectBillingElemAdminData
//_CostCenter
}