@VDM.private:true //= @VDM.private
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck: #NOT_REQUIRED
//@EndUserText.label: 'WIP Detail for WBS elements'
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass: #MIXED
//Used for WIP detail app
//Selects from P_Wipdetailbasic1, prps, proj, rka01, cobk, t001 and P_Projwipdetpernr
//... no 1
define view entity P_Projectwipdetailbasic
as
select from I_WorkInProcessDetail as wip
inner join I_WBSElement as WBSElement on WBSElement.WBSElementObject = wip.ControllingObject // I_WBSElementBasicData missing ControllingObjectClass
inner join KKAG_DIPRA_WBS ( p_client : $session.client ) as x on WBSElement.WBSElementInternalID = x.pspnr
inner join I_ProjectBasicData as Project on Project.ProjectInternalID = WBSElement.ProjectInternalID
//will be needed in case of I_WBSElementBasicData usage
//left outer to one join I_CostCenter as CostCenter on WBSElement.ControllingArea = CostCenter.ControllingArea
// and WBSElement.CostCenter = CostCenter.CostCenter
//left outer to one join I_EntProjectResponsiblePerson as EntProjectResponsiblePerson on WBSElement.WBSElementInternalID = EntProjectResponsiblePerson.WBSElementInternalID
left outer to one join I_PersonWorkAgreement_1 as ProjectEmployeeAgreement on wip.PersonnelNumber = ProjectEmployeeAgreement.PersonWorkAgreement
// association [0..1] to I_Employment as _EmploymentResPers on c.ResponsiblePerson = _EmploymentResPers.EmploymentInternalID
// and _EmploymentResPers.StartDate <= $session.system_date
// and _EmploymentResPers.EndDate >= $session.system_date
//
// association [0..1] to I_Employment as _Employment on $projection.PersonnelNumber = _Employment.EmploymentInternalID
// and _Employment.StartDate <= $session.system_date
// and _Employment.EndDate >= $session.system_date
{
cast ( wip.PostingPeriod as fis_jahrper_conv preserving type ) as PostingPeriod,
wip.CostElement,
wip.CostCenter,
wip.CostCtrActivityType,
wip.Material,
wip.BusinessProcess,
wip.PersonnelNumber, //pernr, Employee
// c.ResponsiblePerson, //I_Project, vernr, Project Manager
// cast( case
// when c.ResponsiblePerson = '00000000' or c.ResponsiblePerson is null
// then c._EntProjProjectRespPersn.PersonWorkAgreement
// else c.ResponsiblePerson
// end as persno preserving type ) as ResponsiblePerson, --> not used
cast ( case when ProjectEmployeeAgreement.PersonFullName is null then '' else ProjectEmployeeAgreement.PersonFullName end as fins_trr_employee_name ) as EmployeeFullName,
cast ( wip.ManualInvoiceItem as pro_dw_man_item ) as ManualInvoiceItem,
wip.ControllingObject,
wip.BillingDocumentCategory,
wip.BillingPlanItemUsage,
wip.WorkItem,
wip.EngagementProjectServiceOrg,
wip.AccountingIndicatorCode,
wip.CostAnalysisResource,
wip.CalendarMonth,
wip.TimeSheetOvertimeCategory,
wip.ControllingDocument,
wip.ControllingDocumentItem,
cast ( case when wip.SalesDocumentItemCurrency is null then WBSElement._CompanyCode.Currency
when wip.SalesDocumentItemCurrency = ' 'then WBSElement._CompanyCode.Currency
else wip.SalesDocumentItemCurrency end as waerk ) as SalesDocumentItemCurrency,
cast ( case when wip.TransactionCurrency is null then WBSElement._CompanyCode.Currency
when wip.TransactionCurrency = ' ' then WBSElement._CompanyCode.Currency
else wip.TransactionCurrency end as twaer ) as TransactionCurrency,
cast ( case when wip.UnitOfMeasure is null then 'H'
when wip.UnitOfMeasure = ' ' then 'H'
else wip.UnitOfMeasure end as co_meinh ) as UnitOfMeasure,
cast ( case when wip.ControllingObjectCurrency is null then WBSElement._CompanyCode.Currency // todo: xwbuk nicht existiert in I_ControllingArea, and b._ControllingArea.xwbuk = 'X'
when wip.ControllingObjectCurrency = ' ' then WBSElement._CompanyCode.Currency // todo: xwbuk nicht existiert in I_ControllingArea , and b._ControllingArea.xwbuk = 'X'
else wip.ControllingObjectCurrency end as hwaer ) as ControllingObjectCurrency,
cast ( case when wip.ControllingAreaCurrency is null then WBSElement._ControllingArea.ControllingAreaCurrency
when wip.ControllingAreaCurrency = ' ' then WBSElement._ControllingArea.ControllingAreaCurrency
else wip.ControllingAreaCurrency end as kwaer ) as ControllingAreaCurrency,
cast ( case when wip.TransacCurrencyInvoiceSimln is null then WBSElement._ControllingArea.ControllingAreaCurrency
when wip.TransacCurrencyInvoiceSimln = ' ' then WBSElement._ControllingArea.ControllingAreaCurrency
else wip.TransacCurrencyInvoiceSimln end as pro_dw_revsim_waers ) as TransacCurrencyInvoiceSimln,
@Semantics.amount.currencyCode: 'TransactionCurrency'
cast ( ( wip.TransacCrcyForInvoiceAmount - wip.TransacCrcyInvoicedAmount ) as pro_dw_in_wtgbtr ) as BillableAmountInTransacCrcy,
@Semantics.amount.currencyCode: 'ControllingObjectCurrency'
cast ( ( wip.ObjectCrcyForInvoiceAmount - wip.ObjectCrcyInvoicedAmount ) as pro_dw_in_wogbtr ) as BillableAmountInCtrlgObjCrcy,
@Semantics.amount.currencyCode: 'ControllingAreaCurrency'
cast ( ( wip.CtrlgAreaCrcyForInvoiceAmount - wip.CtrlgAreaCrcyInvoicedAmount ) as pro_dw_in_wkgbtr ) as BillableAmountInCtrlgAreaCrcy,
@Semantics.quantity.unitOfMeasure: 'UnitOfMeasure'
cast ( ( wip.ForInvoiceQuantity - wip.InvoicedQuantity ) as pro_dw_in_quantity ) as BillableQuantity,
// Amount not to be invoiced, "Not Billable Cost":
@Semantics.amount.currencyCode: 'TransactionCurrency'
cast ( wip.TransacCrcyForRjcnAmount as pro_dw_no_wtgbtr ) as NonBillableAmountInTransacCrcy,
@Semantics.amount.currencyCode: 'ControllingObjectCurrency'
cast ( wip.ObjectCrcyForRjcnAmount as pro_dw_no_wogbtr ) as NonBllbleAmtInCtrlgObjCurrency,
@Semantics.amount.currencyCode: 'ControllingAreaCurrency'
cast ( wip.CtrlgAreaCrcyForRjcnAmount as pro_dw_no_wkgbtr ) as NonBillableAmtInCtrlgAreaCrcy,
@Semantics.quantity.unitOfMeasure: 'UnitOfMeasure'
cast ( wip.ForRjcnQuantity as pro_dw_no_quantity ) as NonBillableQuantity,
// Already billed costs, "Billed Cost":
@Semantics.amount.currencyCode: 'TransactionCurrency'
cast ( wip.TransacCrcyInvoicedAmount as pro_dw_ain_wtgbtr ) as TransacCrcyInvoicedAmount,
@Semantics.amount.currencyCode: 'ControllingObjectCurrency'
cast ( wip.ObjectCrcyInvoicedAmount as pro_dw_ain_wogbtr ) as ObjectCrcyInvoicedAmount,
@Semantics.amount.currencyCode: 'ControllingAreaCurrency'
cast ( wip.CtrlgAreaCrcyInvoicedAmount as ad01abc_wkg ) as CtrlgAreaCrcyInvoicedAmount,
@Semantics.quantity.unitOfMeasure: 'UnitOfMeasure'
cast ( wip.InvoicedQuantity as pro_dw_ain_quantity ) as InvoicedQuantity,
@Semantics.amount.currencyCode: 'TransactionCurrency'
cast ( wip.RejectedAmtInTransCrcy as pro_dw_ano_wtgbtr ) as RejectedAmtInTransCrcy,
@Semantics.amount.currencyCode: 'ControllingObjectCurrency'
cast ( wip.RejectedAmountInObjectCurrency as pro_dw_ano_wogbtr ) as RejectedAmountInObjectCurrency,
@Semantics.amount.currencyCode: 'ControllingAreaCurrency'
cast ( wip.RejectedAmountInCtrlgAreaCrcy as ad01noc_wkg ) as RejectedAmountInCtrlgAreaCrcy,
@Semantics.quantity.unitOfMeasure: 'UnitOfMeasure'
cast ( wip.RejectedQuantity as pro_dw_ano_quantity ) as RejectedQuantity,
// Not yet billed costs (WIP costs), "Unbilled Cost":
@Semantics.amount.currencyCode: 'TransactionCurrency'
cast ( wip.TransacCrcyWIPAmount as pro_dw_wip_wtgbtr ) as TransacCrcyWIPAmount,
@Semantics.amount.currencyCode: 'ControllingObjectCurrency'
cast ( wip.ObjectCrcyWIPAmount as pro_dw_wip_wogbtr ) as ObjectCrcyWIPAmount,
@Semantics.amount.currencyCode: 'ControllingAreaCurrency'
cast ( wip.CtrlgAreaCrcyWIPAmount as ad01tbc_wkg ) as CtrlgAreaCrcyWIPAmount,
@Semantics.quantity.unitOfMeasure: 'UnitOfMeasure'
cast ( wip.WIPQuantity as pro_dw_wip_quantity ) as WIPQuantity,
// Revenue to be billed/simulated revenue (total), "Billable Revenue":
@Semantics.amount.currencyCode: 'TransacCurrencyInvoiceSimln'
cast ( wip.TotTransacCrcyInvoiceSimlnAmt as pro_dw_revsim_wtgbtr ) as TotTransacCrcyInvoiceSimlnAmt,
@Semantics.amount.currencyCode: 'ControllingObjectCurrency'
cast ( wip.TotObjectCrcyInvoiceSimlnAmt as pro_dw_revsim_wogbtr ) as TotObjectCrcyInvoiceSimlnAmt,
@Semantics.amount.currencyCode: 'ControllingAreaCurrency'
cast ( wip.TotCtrlgAreaCrcyInvcSimlnAmt as ad01rev_wkg ) as TotCtrlgAreaCrcyInvcSimlnAmt,
cast ( wip.RevenueCostElement as pro_dw_rev_kstar ) as RevenueCostElement,
cast ( wip.SoldMaterial as pro_dw_rev_matnr ) as SoldMaterial,
// Revenue to be billed/simulated revenue (per revenue element):
@Semantics.amount.currencyCode: 'TransacCurrencyInvoiceSimln'
cast ( wip.TransacCrcyInvoiceSimlnAmt as ad01rev_wtg ) as TransacCrcyInvoiceSimlnAmt,
@Semantics.amount.currencyCode: 'ControllingObjectCurrency'
cast ( wip.ObjectCrcyInvoiceSimlnAmt as ad01rev_wog ) as ObjectCrcyInvoiceSimlnAmt,
@Semantics.amount.currencyCode: 'ControllingAreaCurrency'
cast ( wip.CtrlgAreaCrcyInvoiceSimlnAmt as ad01rev_wkg ) as CtrlgAreaCrcyInvoiceSimlnAmt,
wip.ResultAnalysisVersion,
wip.ServicesRenderedDate as ServicesRenderedDate,
WBSElement.WBSElementInternalID as WBSElementInternalID,
WBSElement.WBSElement as WBSElement,
WBSElement.WBSDescription as WBSDescription,
Project.ProjectInternalID as ProjectInternalID,
Project.Project as Project,
Project.ProjectDescription as ProjectDescription,
WBSElement.CompanyCode as CompanyCode,
WBSElement.BusinessArea as BusinessArea, // pgsbr nicht existiert in I_WBSElementBasicData
WBSElement.ControllingArea as ControllingArea,
WBSElement.ProfitCenter as ProfitCenter,
cast (WBSElement.ResultAnalysisInternalID as fins_trr_recgnkey ) as ResultAnalysisInternalID, // abgsl nicht existiert in I_WBSElementBasicData
WBSElement.Plant as Plant,
WBSElement.ControllingObjectClass as ControllingObjectClass, // scope nicht existiert in I_WBSElementBasicData
WBSElement.FunctionalArea as FunctionalArea,
WBSElement.CreationDate as CreationDate, // erdat nicht existiert in I_WBSElementBasicData
//cast ( c.ResponsiblePerson as fins_trr_project_manager ) as ProjectManager, // vernr nicht existiert in I_ProjectBasicData
//ResponsiblePerson is already used above AS ResponsiblePerson, dont know reason behind duplicate field under different name so keeping both
// cast( case
// when c.ResponsiblePerson = '00000000' or c.ResponsiblePerson is null
// then c._EntProjProjectRespPersn.PersonWorkAgreement
// else c.ResponsiblePerson
// end as fins_trr_project_manager preserving type ) as ProjectManager,
//cast ( ProjectManagerAgreement.PersonFullName as fins_trr_projmng_name ) as ProjectManagerName,
WBSElement._EntProjectResponsiblePerson.PersonWorkAgreement as ProjectManager,
// cast( case
// when c.ResponsiblePerson = '00000000' or c.ResponsiblePerson is null
// then c._EntProjProjectRespPersn._WorkforcePerson.PersonFullName
// else c.ResponsiblePersonName
// end as fins_trr_projmng_name preserving type ) as ProjectManagerName,
WBSElement._EntProjectResponsiblePerson._WorkforcePerson.PersonFullName as ProjectManagerName,
//for aceess control
// c._ResponsiblePerson,
// c.ResponsiblePerson as ProjectResponsiblePerson,
// c._EntProjProjectRespPersn
WBSElement._EntProjectResponsiblePerson
// _EmploymentResPers,
// _Employment
}
where
x.tadat = '00000000';
//Simulation details from P_Projectwiprevdetailbasic are not displayed