P_ProjectActualCostLineItem

DDL: P_PROJECTACTUALCOSTLINEITEM SQL: PPROJACTCOSTITEM Type: view COMPOSITE

P_ProjectActualCostLineItem is a Composite CDS View in SAP S/4HANA. It reads from 5 data sources (P_ProjectObject_2, I_GLAccountLineItemRawData, I_GLAccountLineItemRawData, I_ProjectData_2, I_WBSElementData_2) and exposes 192 fields with key fields SourceLedger, Ledger, CompanyCode, FiscalYear, AccountingDocument. It has 1 association to related views.

Data Sources (5)

SourceAliasJoin Type
P_ProjectObject_2 _hierachyData inner
I_GLAccountLineItemRawData _ProjCstLineItm from
I_GLAccountLineItemRawData _ProjCstLineItm union_all
I_ProjectData_2 Project inner
I_WBSElementData_2 WBSElement inner

Parameters (1)

NameTypeDefault
P_ProjectObjectRootNode j_objnr

Associations (1)

CardinalityTargetAliasCondition
[0..*] I_VirtualPlanningCategory _VirtualPlanningCategory $projection.PlanningCategory = _VirtualPlanningCategory.SourcePlanningCategory

Annotations (12)

NameValueLevelField
AbapCatalog.sqlViewName PPROJACTCOSTITEM view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #NOT_REQUIRED view
AbapCatalog.buffering.status #NOT_ALLOWED view
Metadata.ignorePropagatedAnnotations true view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #D view
VDM.viewType #COMPOSITE view
VDM.private true view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (192)

KeyFieldSource TableSource FieldDescription
KEY SourceLedger I_GLAccountLineItemRawData SourceLedger
KEY Ledger I_GLAccountLineItemRawData SourceLedger
KEY CompanyCode I_GLAccountLineItemRawData CompanyCode
KEY FiscalYear I_GLAccountLineItemRawData FiscalYear
KEY AccountingDocument I_GLAccountLineItemRawData AccountingDocument
FinancialPlanningReqTransSqnc
FinancialPlanningDataPacket
ActualPlanJournalEntryItem
LedgerFiscalYear I_GLAccountLineItemRawData LedgerFiscalYear
LedgerGLLineItem I_GLAccountLineItemRawData LedgerGLLineItem
FinancialPlanningEntryItem
ActualPlanCode
AccountingDocCreatedByUser I_GLAccountLineItemRawData AccountingDocCreatedByUser
BusinessArea I_GLAccountLineItemRawData BusinessArea
PartnerOrder I_GLAccountLineItemRawData PartnerOrder
OrderID I_GLAccountLineItemRawData OrderID
OrderOperation I_GLAccountLineItemRawData OrderOperation
OrderSuboperation I_GLAccountLineItemRawData OrderSuboperation
MaintenanceOrderDesc
PartnerAccountAssignmentType I_GLAccountLineItemRawData PartnerAccountAssignmentType
OperationDescription
PartnerOrderCategory I_GLAccountLineItemRawData PartnerOrderCategory
ProjectObjectType P_ProjectObject_2 ProjectObjectType
PartnerProjectNetwork I_GLAccountLineItemRawData PartnerProjectNetwork
OrderIDelseendasInternalOrder
PartnerProject I_GLAccountLineItemRawData PartnerProject
BusinessTransactionType I_GLAccountLineItemRawData BusinessTransactionType
DebitCreditCode I_GLAccountLineItemRawData DebitCreditCode
ControllingDebitCreditCode I_GLAccountLineItemRawData ControllingDebitCreditCode
WBSElement P_ProjectObject_2 WBSElement
ProjectNetwork I_GLAccountLineItemRawData ProjectNetwork
NetworkActivity _NetworkActivity NetworkActivity
NetworkActivityElement _NetworkActivity NetworkActivityElement
ProjectObjectExternalID P_ProjectObject_2 ProjectObjectExternalID
Project P_ProjectObject_2 Project
ProjectInternalID I_GLAccountLineItemRawData ProjectInternalID
ProjectNetworkendasObjectInternalID
ControllingArea I_GLAccountLineItemRawData ControllingArea
GLAccount I_GLAccountLineItemRawData GLAccount
ChartOfAccounts I_GLAccountLineItemRawData ChartOfAccounts
CostCenter I_GLAccountLineItemRawData CostCenter
ProfitCenter I_GLAccountLineItemRawData ProfitCenter
CreationDate I_GLAccountLineItemRawData CreationDate
FunctionalArea I_GLAccountLineItemRawData FunctionalArea
CostCtrActivityType I_GLAccountLineItemRawData CostCtrActivityType
ControllingObjectCurrency I_GLAccountLineItemRawData ControllingObjectCurrency
AmountInObjectCurrency I_GLAccountLineItemRawData AmountInObjectCurrency
TransactionCurrency I_GLAccountLineItemRawData TransactionCurrency
AmountInTransactionCurrency I_GLAccountLineItemRawData AmountInTransactionCurrency
CompanyCodeCurrency I_GLAccountLineItemRawData CompanyCodeCurrency
AmountInCompanyCodeCurrency I_GLAccountLineItemRawData AmountInCompanyCodeCurrency
GlobalCurrency I_GLAccountLineItemRawData GlobalCurrency
AmountInGlobalCurrency I_GLAccountLineItemRawData AmountInGlobalCurrency
FunctionalCurrency I_GLAccountLineItemRawData FunctionalCurrency
ActualAmountInFunctionalCrcy I_GLAccountLineItemRawData AmountInFunctionalCurrency
FreeDefinedCurrency1 I_GLAccountLineItemRawData FreeDefinedCurrency1
AmountInFreeDefinedCurrency1 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency1
FreeDefinedCurrency2 I_GLAccountLineItemRawData FreeDefinedCurrency2
AmountInFreeDefinedCurrency2 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency2
FreeDefinedCurrency3 I_GLAccountLineItemRawData FreeDefinedCurrency3
AmountInFreeDefinedCurrency3 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency3
FreeDefinedCurrency4 I_GLAccountLineItemRawData FreeDefinedCurrency4
AmountInFreeDefinedCurrency4 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency4
FreeDefinedCurrency5 I_GLAccountLineItemRawData FreeDefinedCurrency5
AmountInFreeDefinedCurrency5 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency5
FreeDefinedCurrency6 I_GLAccountLineItemRawData FreeDefinedCurrency6
AmountInFreeDefinedCurrency6 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency6
FreeDefinedCurrency7 I_GLAccountLineItemRawData FreeDefinedCurrency7
AmountInFreeDefinedCurrency7 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency7
FreeDefinedCurrency8 I_GLAccountLineItemRawData FreeDefinedCurrency8
AmountInFreeDefinedCurrency8 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency8
ActualAmountInGlobalCurrency I_GLAccountLineItemRawData AmountInGlobalCurrency
ActlCostInProjCrcy I_GLAccountLineItemRawData AmountInObjectCurrency
ActualAmountInFreeDfndCrcy1 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency1
ActualAmountInFreeDfndCrcy2 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency2
ActualAmountInFreeDfndCrcy3 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency3
ActualAmountInFreeDfndCrcy4 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency4
ActualAmountInFreeDfndCrcy5 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency5
ActualAmountInFreeDfndCrcy6 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency6
ActualAmountInFreeDfndCrcy7 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency7
ActualAmountInFreeDfndCrcy8 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency8
SourceReferenceDocumentType I_GLAccountLineItemRawData SourceReferenceDocumentType
SourceLogicalSystem I_GLAccountLineItemRawData SourceLogicalSystem
SourceReferenceDocumentCntxt I_GLAccountLineItemRawData SourceReferenceDocumentCntxt
SourceReferenceDocument I_GLAccountLineItemRawData SourceReferenceDocument
SourceReferenceDocumentItem I_GLAccountLineItemRawData SourceReferenceDocumentItem
SourceReferenceDocSubitem I_GLAccountLineItemRawData SourceReferenceDocSubitem
IsCommitment I_GLAccountLineItemRawData IsCommitment
PartnerProfitCenter I_GLAccountLineItemRawData PartnerProfitCenter
PartnerCompanyCode I_GLAccountLineItemRawData PartnerCompanyCode
PlanningCategory
PostingDate I_GLAccountLineItemRawData PostingDate
DocumentDate I_GLAccountLineItemRawData DocumentDate
FiscalPeriod I_GLAccountLineItemRawData FiscalPeriod
FiscalYearPeriod I_GLAccountLineItemRawData FiscalYearPeriod
FiscalYearVariant I_GLAccountLineItemRawData FiscalYearVariant
MaintenanceOrderIsSelected
ProjectObjectProfitCenter P_ProjectObject_2 ProjectObjectProfitCenter
ProjectObjectDescription P_ProjectObject_2 ProjectObjectDescription
ProjectObjectNode P_ProjectObject_2 ProjectObjectNode
ProjectObjectRootNode P_ProjectObject_2 ProjectObjectRootNode
ResponsibleCostCenter P_ProjectObject_2 ResponsibleCostCenter
ProjectType P_ProjectObject_2 ProjectType
OrderType P_ProjectObject_2 OrderType
_VirtualPlanningCategory _VirtualPlanningCategory
_WBSElement _WBSElement
_ProjectNetwork _ProjectNetwork
_NetworkActivity _NetworkActivity
_PMOrder _PMOrder
SourceLedger
KEY Ledger I_GLAccountLineItemRawData SourceLedger
KEY CompanyCode I_GLAccountLineItemRawData CompanyCode
KEY FiscalYear I_GLAccountLineItemRawData FiscalYear
KEY AccountingDocument I_GLAccountLineItemRawData AccountingDocument
FinancialPlanningReqTransSqnc
FinancialPlanningDataPacket
ActualPlanJournalEntryItem
LedgerFiscalYear I_GLAccountLineItemRawData LedgerFiscalYear
LedgerGLLineItem I_GLAccountLineItemRawData LedgerGLLineItem
FinancialPlanningEntryItem
ActualPlanCode
AccountingDocCreatedByUser I_GLAccountLineItemRawData AccountingDocCreatedByUser
BusinessArea I_GLAccountLineItemRawData BusinessArea
PartnerOrder I_GLAccountLineItemRawData PartnerOrder
OrderID I_GLAccountLineItemRawData OrderID
OrderOperation I_GLAccountLineItemRawData OrderOperation
OrderSuboperation I_GLAccountLineItemRawData OrderSuboperation
MaintenanceOrderDesc
PartnerAccountAssignmentType I_GLAccountLineItemRawData PartnerAccountAssignmentType
OperationDescription
PartnerOrderCategory I_GLAccountLineItemRawData PartnerOrderCategory
ProjectObjectType
ProjectPartnerObject I_GLAccountLineItemRawData PartnerWBSElement
PartnerProjectNetwork I_GLAccountLineItemRawData PartnerProjectNetwork
PartnerProjectNetworkActivity
InternalOrder
PartnerProject I_GLAccountLineItemRawData PartnerProject
BusinessTransactionType I_GLAccountLineItemRawData BusinessTransactionType
DebitCreditCode I_GLAccountLineItemRawData DebitCreditCode
ControllingDebitCreditCode I_GLAccountLineItemRawData ControllingDebitCreditCode
WBSElement I_GLAccountLineItemRawData WBSElement
ProjectNetwork I_GLAccountLineItemRawData ProjectNetwork
NetworkActivity
NetworkActivityElement
ProjectObjectExternalID I_WBSElementData_2 WBSElementExternalID
ProjectNetworkActivity
Project _Project Project
ProjectInternalID I_WBSElementData_2 ProjectInternalID
ObjectInternalID I_GLAccountLineItemRawData WBSElementInternalID
ControllingArea I_GLAccountLineItemRawData ControllingArea
GLAccount I_GLAccountLineItemRawData GLAccount
ChartOfAccounts I_GLAccountLineItemRawData ChartOfAccounts
CostCenter I_GLAccountLineItemRawData CostCenter
ProfitCenter I_GLAccountLineItemRawData ProfitCenter
CreationDate I_GLAccountLineItemRawData CreationDate
FunctionalArea I_GLAccountLineItemRawData FunctionalArea
CostCtrActivityType I_GLAccountLineItemRawData CostCtrActivityType
ControllingObjectCurrency I_GLAccountLineItemRawData ControllingObjectCurrency
AmountInObjectCurrency I_GLAccountLineItemRawData AmountInObjectCurrency
TransactionCurrency I_GLAccountLineItemRawData TransactionCurrency
AmountInTransactionCurrency I_GLAccountLineItemRawData AmountInTransactionCurrency
CompanyCodeCurrency I_GLAccountLineItemRawData CompanyCodeCurrency
AmountInCompanyCodeCurrency I_GLAccountLineItemRawData AmountInCompanyCodeCurrency
GlobalCurrency I_GLAccountLineItemRawData GlobalCurrency
AmountInGlobalCurrency I_GLAccountLineItemRawData AmountInGlobalCurrency
FunctionalCurrency I_GLAccountLineItemRawData FunctionalCurrency
ActualAmountInFunctionalCrcy I_GLAccountLineItemRawData AmountInFunctionalCurrency
FreeDefinedCurrency1 I_GLAccountLineItemRawData FreeDefinedCurrency1
AmountInFreeDefinedCurrency1 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency1
FreeDefinedCurrency2 I_GLAccountLineItemRawData FreeDefinedCurrency2
AmountInFreeDefinedCurrency2 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency2
FreeDefinedCurrency3 I_GLAccountLineItemRawData FreeDefinedCurrency3
AmountInFreeDefinedCurrency3 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency3
FreeDefinedCurrency4 I_GLAccountLineItemRawData FreeDefinedCurrency4
AmountInFreeDefinedCurrency4 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency4
FreeDefinedCurrency5 I_GLAccountLineItemRawData FreeDefinedCurrency5
AmountInFreeDefinedCurrency5 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency5
FreeDefinedCurrency6 I_GLAccountLineItemRawData FreeDefinedCurrency6
AmountInFreeDefinedCurrency6 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency6
FreeDefinedCurrency7 I_GLAccountLineItemRawData FreeDefinedCurrency7
AmountInFreeDefinedCurrency7 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency7
FreeDefinedCurrency8 I_GLAccountLineItemRawData FreeDefinedCurrency8
AmountInFreeDefinedCurrency8 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency8
ActualAmountInGlobalCurrency I_GLAccountLineItemRawData AmountInGlobalCurrency
ActlCostInProjCrcy I_GLAccountLineItemRawData AmountInObjectCurrency
ActualAmountInFreeDfndCrcy1 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency1
ActualAmountInFreeDfndCrcy2 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency2
ActualAmountInFreeDfndCrcy3 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency3
ActualAmountInFreeDfndCrcy4 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency4
ActualAmountInFreeDfndCrcy5 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency5
ActualAmountInFreeDfndCrcy6 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency6
ActualAmountInFreeDfndCrcy7 I_GLAccountLineItemRawData AmountInFreeDefinedCurrency7
@AbapCatalog.sqlViewName: 'PPROJACTCOSTITEM'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@AbapCatalog.buffering.status: #NOT_ALLOWED
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.dataClass:  #MIXED
@ObjectModel.usageType.serviceQuality: #D
@VDM.viewType: #COMPOSITE
@VDM.private: true
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_ProjectActualCostLineItem
  with parameters
    P_ProjectObjectRootNode : j_objnr
  as select from I_GLAccountLineItemRawData as _ProjCstLineItm
    inner join   P_ProjectObject_2          as _hierachyData on  _ProjCstLineItm.ControllingObject   =  _hierachyData.ProjectObjectNode
                                                             and _ProjCstLineItm.ControllingObject   <> ''
                                                             and _hierachyData.ProjectObjectRootNode = $parameters.P_ProjectObjectRootNode

  association [0..*] to I_VirtualPlanningCategory      as _VirtualPlanningCategory on $projection.PlanningCategory = _VirtualPlanningCategory.SourcePlanningCategory
  association        to I_WBSElementData_2             as _WBSElement              on _hierachyData.ProjectObjectNode = _WBSElement.WBSElementObject
  association        to I_NetworkActivityForCostReport as _NetworkActivity         on _hierachyData.ProjectObjectNode = _NetworkActivity.NetworkActivityObject
  association        to I_ProjectNetwork               as _ProjectNetwork          on _hierachyData.ProjectObjectNode = _ProjectNetwork.ProjectNetworkObject
  association        to I_ProjectNetwork               as _PartnerProjectNetwork   on $projection.PartnerProjectNetwork = _PartnerProjectNetwork.ProjectNetwork
  association        to I_MaintenanceOrder             as _PMOrder                 on _hierachyData.ProjectObjectNode = _PMOrder.MaintenanceOrderInternalID
  association        to I_MaintenanceOrder             as _PartnerPMOrder          on $projection.PartnerOrder = _PartnerPMOrder.MaintenanceOrder
  association        to I_InternalOrder                as _PartnerIOrder           on $projection.PartnerOrder = _PartnerIOrder.InternalOrder
  association        to I_InternalOrder                as _InternalOrder           on $projection.InternalOrder = _InternalOrder.InternalOrder
{

  key _ProjCstLineItm.SourceLedger,
  key _ProjCstLineItm.SourceLedger                                                    as Ledger,
  key _ProjCstLineItm.CompanyCode,
  key _ProjCstLineItm.FiscalYear,
  key _ProjCstLineItm.AccountingDocument,
      cast(cast( '00000000000000000000000' as abap.numc (23)) as fis_fp_request_tsn ) as FinancialPlanningReqTransSqnc,
      cast(cast( '000000' as abap.numc (6)) as fis_fp_data_packet )                   as FinancialPlanningDataPacket,
      cast( LedgerGLLineItem as fis_act_pln_docln)                                    as ActualPlanJournalEntryItem,
      _ProjCstLineItm.LedgerFiscalYear,
      _ProjCstLineItm.LedgerGLLineItem,
      @Aggregation.default: #NONE
      cast(cast( 0 as abap.int4 ) as fis_fp_entry_item )                              as FinancialPlanningEntryItem,
      cast(cast( 'A' as abap.char (1)) as fis_actual_plan_code)                       as ActualPlanCode,
      _ProjCstLineItm.AccountingDocCreatedByUser,
      _ProjCstLineItm.BusinessArea,
      _ProjCstLineItm.PartnerOrder,
      //      _ProjCstLineItm.OrderID,

      case
      when _hierachyData.ProjectObjectType = 'OR'
      then
      _ProjCstLineItm.OrderID
      else
      ''
      end                                                                             as OrderID,
      _ProjCstLineItm.OrderOperation,
      _ProjCstLineItm.OrderSuboperation,
      ' '                                                                             as MaintenanceOrderDesc,
      _ProjCstLineItm.PartnerAccountAssignmentType,
      ''                                                                              as OperationDescription,
      _ProjCstLineItm.PartnerOrderCategory,
      _hierachyData.ProjectObjectType                                                 as ProjectObjectType,

      case
      when _hierachyData.ProjectObjectType = 'PR'
      then _ProjCstLineItm.PartnerWBSElement
      when  _hierachyData.ProjectObjectType = 'OR'
      then _ProjCstLineItm.PartnerOrder
      when _hierachyData.ProjectObjectType = 'NV' or _hierachyData.ProjectObjectType = 'EL'
      or _hierachyData.ProjectObjectType = 'NP'
      then _ProjCstLineItm.PartnerProjectNetwork
      end                                                                             as ProjectPartnerObject,

      _ProjCstLineItm.PartnerProjectNetwork,

      case
      when _hierachyData.ProjectObjectType = 'PR' or _hierachyData.ProjectObjectType = 'OR'
      or _hierachyData.ProjectObjectType = 'NP'
      then ''
      when _hierachyData.ProjectObjectType = 'NV' or _hierachyData.ProjectObjectType = 'EL'
      then _hierachyData.ProjectObjectType
      end                                                                             as PartnerProjectNetworkActivity,

      case
      when _hierachyData.ProjectObjectType = 'IO'
      then
      _ProjCstLineItm.OrderID
      else
      ''
      end                                                                             as InternalOrder,

      case
      when _hierachyData.ProjectObjectType = 'PP'
      then
      _ProjCstLineItm.OrderID
      else
      ''
      end                                                                             as ProductionOrder,

      _ProjCstLineItm.Product,

      case
      when _hierachyData.ProjectObjectType = 'SV'
      then
      _ProjCstLineItm.ServiceDocument
      else
      ''
      end                                                                             as ServiceOrder,

      case
      when _hierachyData.ProjectObjectType = 'SV'
      then
      _ProjCstLineItm.ServiceDocumentItem
      else
      ''
      end                                                                             as ServiceOrderItem,

      case
      when _hierachyData.ProjectObjectType = 'SC'
      then
      _ProjCstLineItm.ServiceDocument
      else
      ''
      end                                                                             as ServiceContract,

      case
      when _hierachyData.ProjectObjectType = 'SC'
      then
      _ProjCstLineItm.ServiceDocumentItem
      else
      ''
      end                                                                             as ServiceContractItem,


      _ProjCstLineItm.PartnerProject,
      _ProjCstLineItm.BusinessTransactionType,
      _ProjCstLineItm.DebitCreditCode,
      _ProjCstLineItm.ControllingDebitCreditCode,

      _hierachyData.WBSElement,

      _ProjCstLineItm.ProjectNetwork                                                  as ProjectNetwork,

      _NetworkActivity.NetworkActivity,
      _NetworkActivity.NetworkActivityElement                                         as NetworkActivityElement,

      _hierachyData.ProjectObjectExternalID,

      case
      when _hierachyData.ProjectObjectType = 'PR' or _hierachyData.ProjectObjectType = 'OR' or
      _hierachyData.ProjectObjectType = 'NP'
      then ''
      when _hierachyData.ProjectObjectType = 'NV' or _hierachyData.ProjectObjectType = 'EL'
      then _ProjCstLineItm.RelatedNetworkActivity
      end                                                                             as ProjectNetworkActivity,

      _hierachyData.Project,

      _ProjCstLineItm.ProjectInternalID,


      case
      when _hierachyData.ProjectObjectType = 'PR'
      then _ProjCstLineItm.WBSElementInternalID
      when _hierachyData.ProjectObjectType = 'OR' or _hierachyData.ProjectObjectType = 'PP'
      then _ProjCstLineItm.OrderID
      when _hierachyData.ProjectObjectType= 'NV' or _hierachyData.ProjectObjectType = 'EL'
      or _hierachyData.ProjectObjectType = 'NP'
      then _ProjCstLineItm.ProjectNetwork
      end                                                                             as ObjectInternalID,

      _ProjCstLineItm.ControllingArea,
      _ProjCstLineItm.GLAccount,
      _ProjCstLineItm.ChartOfAccounts,
      _ProjCstLineItm.CostCenter,
      _ProjCstLineItm.ProfitCenter,
      _ProjCstLineItm.CreationDate,
      _ProjCstLineItm.FunctionalArea,
      _ProjCstLineItm.CostCtrActivityType,
      _ProjCstLineItm.OriginCostCtrActivityType,
      _ProjCstLineItm.OriginCostCenter,
      @Semantics.currencyCode: true
      _ProjCstLineItm.ControllingObjectCurrency,
      @Aggregation.default: #SUM
      @Semantics.amount.currencyCode: 'ControllingObjectCurrency'
      _ProjCstLineItm.AmountInObjectCurrency,

      @Semantics.currencyCode:true
      _ProjCstLineItm.TransactionCurrency,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'TransactionCurrency'} }
      _ProjCstLineItm.AmountInTransactionCurrency,

      @Semantics.currencyCode:true
      _ProjCstLineItm.CompanyCodeCurrency,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'CompanyCodeCurrency'} }
      _ProjCstLineItm.AmountInCompanyCodeCurrency,

      @Semantics.currencyCode:true
      _ProjCstLineItm.GlobalCurrency,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'GlobalCurrency'} }
      _ProjCstLineItm.AmountInGlobalCurrency,

      @Semantics.currencyCode: true
      _ProjCstLineItm.FunctionalCurrency,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FunctionalCurrency'} }
      _ProjCstLineItm.AmountInFunctionalCurrency                                      as ActualAmountInFunctionalCrcy,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency1,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency1'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency1,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency2,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency2'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency2,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency3,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency3'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency3,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency4,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency4'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency4,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency5,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency5'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency5,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency6,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency6'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency6,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency7,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency7'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency7,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency8,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency8'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency8,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'GlobalCurrency'} }
      _ProjCstLineItm.AmountInGlobalCurrency                                          as ActualAmountInGlobalCurrency,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'ControllingObjectCurrency'} }
      _ProjCstLineItm.AmountInObjectCurrency                                          as ActlCostInProjCrcy,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency1'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency1                                    as ActualAmountInFreeDfndCrcy1,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency2'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency2                                    as ActualAmountInFreeDfndCrcy2,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency3'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency3                                    as ActualAmountInFreeDfndCrcy3,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency4'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency4                                    as ActualAmountInFreeDfndCrcy4,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency5'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency5                                    as ActualAmountInFreeDfndCrcy5,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency6'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency6                                    as ActualAmountInFreeDfndCrcy6,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency7'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency7                                    as ActualAmountInFreeDfndCrcy7,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency8'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency8                                    as ActualAmountInFreeDfndCrcy8,

      _ProjCstLineItm.SourceReferenceDocumentType,
      _ProjCstLineItm.SourceLogicalSystem,
      _ProjCstLineItm.SourceReferenceDocumentCntxt,
      _ProjCstLineItm.SourceReferenceDocument,
      _ProjCstLineItm.SourceReferenceDocumentItem,
      _ProjCstLineItm.SourceReferenceDocSubitem,
      _ProjCstLineItm.IsCommitment,
      _ProjCstLineItm.PartnerProfitCenter,
      _ProjCstLineItm.PartnerCompanyCode,

      case
      when ControllingDebitCreditCode  = 'A'
      then cast( '' as ps_s4_considersettlement preserving type )

      when ControllingDebitCreditCode = 'S' and
      (BusinessTransactionType = 'KOAO' or BusinessTransactionType = 'KOAE') and
      ( _PartnerProjectNetwork._Project.ProjectObject = _hierachyData.ProjectObjectRootNode )
      or ( _PartnerPMOrder._Project.ProjectObject = _hierachyData.ProjectObjectRootNode )
      or ( _PartnerIOrder._WBSElementBasicData._Project.ProjectObject = _hierachyData.ProjectObjectRootNode )
      then cast( '' as ps_s4_considersettlement preserving type )

      when ControllingDebitCreditCode = 'S' and
      (BusinessTransactionType = 'KOAO' or BusinessTransactionType = 'KOAE') and
      ( PartnerProject = ' '  and PartnerOrder = ' ' and PartnerSalesDocument = ' ' and PartnerProjectNetwork = ' '
        and PartnerProjectNetworkActivity = ' ' and PartnerBusinessProcess = ' ' and PartnerCostObject = ' '
        and PartnerAccountAssignment = ' ')
      then cast( '' as ps_s4_considersettlement preserving type )

      when ControllingDebitCreditCode = 'S' and (BusinessTransactionType = 'KOAO' or BusinessTransactionType = 'KOAE') and
      (PartnerProject = _ProjCstLineItm.Project)
      then cast( '' as ps_s4_considersettlement preserving type )

      when ControllingDebitCreditCode = 'S' and (BusinessTransactionType = 'KOAO' or BusinessTransactionType = 'KOAE') and
      (PartnerAccountAssignmentType = 'OR') and (PartnerProject = _ProjCstLineItm.Project)
      then cast( '' as ps_s4_considersettlement preserving type )

      else cast( 'X' as ps_s4_considersettlement preserving type )
      end                                                                             as IsSettled,

      cast( cast( 'ACT01' as abap.char( 10  )) as fcom_category)                      as PlanningCategory,

      _ProjCstLineItm.PostingDate,
      _ProjCstLineItm.DocumentDate,
      _ProjCstLineItm.FiscalPeriod,
      _ProjCstLineItm.FiscalYearPeriod,
      _ProjCstLineItm.FiscalYearVariant,

      cast( 'X' as boolean )                                                          as MaintenanceOrderIsSelected,

      case
      when _hierachyData.ProjectObjectType = 'PR'
      then _hierachyData.ProjectObjectType
      when _hierachyData.ProjectObjectType = 'OR' or _hierachyData.ProjectObjectType = 'OV'
      then  cast( 'OR' as ps_s4_projselobj )
      when _hierachyData.ProjectObjectType = 'NV' or _hierachyData.ProjectObjectType = 'EL' or
      _hierachyData.ProjectObjectType = 'NP'
      then cast( 'ZZ' as ps_s4_projselobj )
      when _hierachyData.ProjectObjectType = 'IO'
      then _hierachyData.ProjectObjectType
      when _hierachyData.ProjectObjectType = 'SV'
      then _hierachyData.ProjectObjectType
      when _hierachyData.ProjectObjectType = 'SC'
      then _hierachyData.ProjectObjectType
      when _hierachyData.ProjectObjectType = 'PP'
      then _hierachyData.ProjectObjectType
      end                                                                             as ProjectSelectedObject,


      _hierachyData.ProjectObjectProfitCenter,

      _hierachyData.ProjectObjectDescription,
      //      _ProjCstLineItm.ControllingObject as ProjectObjectNode,

      _hierachyData.ProjectObjectNode,
      _hierachyData.ProjectObjectRootNode,

      _hierachyData.ResponsibleCostCenter,

      _hierachyData.ProjectType,
      _hierachyData.OrderType,

      _VirtualPlanningCategory,
      //_Project,

      _WBSElement,
      _ProjectNetwork,
      _NetworkActivity,
      _PMOrder,
      _InternalOrder

}
where
  ProjectObjectRootNode = $parameters.P_ProjectObjectRootNode
//  and _ProjCstLineItm.BusinessTransactionType <> 'TBRR'


//

//StatisticalWBSElement Logic

union all select from I_GLAccountLineItemRawData as _ProjCstLineItm

  inner join          I_WBSElementData_2         as WBSElement on  WBSElement.WBSElementInternalID       =  _ProjCstLineItm.WBSElementInternalID
                                                               and WBSElement.WBSIsStatisticalWBSElement =  'X'
                                                               and _ProjCstLineItm.WBSElementInternalID  <> '00000000'
  inner join          I_ProjectData_2            as Project    on  WBSElement.ProjectInternalID = Project.ProjectInternalID
                                                               and Project.ProjectObject        = $parameters.P_ProjectObjectRootNode

association [0..*] to I_VirtualPlanningCategory      as _VirtualPlanningCategory on $projection.PlanningCategory = _VirtualPlanningCategory.SourcePlanningCategory
association        to I_WBSElementData_2             as _WBSElement              on WBSElement.WBSElementObject = _WBSElement.WBSElementObject
association        to I_NetworkActivityForCostReport as _NetworkActivity         on WBSElement.WBSElementObject = _NetworkActivity.NetworkActivityObject
association        to I_ProjectNetwork               as _ProjectNetwork          on WBSElement.WBSElementObject = _ProjectNetwork.ProjectNetworkObject

association        to I_MaintenanceOrder             as _PMOrder                 on WBSElement.WBSElementObject = _PMOrder.MaintenanceOrderInternalID
association        to I_InternalOrder                as _InternalOrder           on $projection.InternalOrder = _InternalOrder.InternalOrder
{

  key _ProjCstLineItm.SourceLedger,
  key _ProjCstLineItm.SourceLedger                                                    as Ledger,
  key _ProjCstLineItm.CompanyCode,
  key _ProjCstLineItm.FiscalYear,
  key _ProjCstLineItm.AccountingDocument,
      cast(cast( '00000000000000000000000' as abap.numc (23)) as fis_fp_request_tsn ) as FinancialPlanningReqTransSqnc,
      cast(cast( '000000' as abap.numc (6)) as fis_fp_data_packet )                   as FinancialPlanningDataPacket,
      cast( LedgerGLLineItem as fis_act_pln_docln)                                    as ActualPlanJournalEntryItem,
      _ProjCstLineItm.LedgerFiscalYear,
      _ProjCstLineItm.LedgerGLLineItem,
      @Aggregation.default: #NONE
      cast(cast( 0 as abap.int4 ) as fis_fp_entry_item )                              as FinancialPlanningEntryItem,
      cast(cast( 'A' as abap.char (1)) as fis_actual_plan_code)                       as ActualPlanCode,
      _ProjCstLineItm.AccountingDocCreatedByUser,
      _ProjCstLineItm.BusinessArea,
      _ProjCstLineItm.PartnerOrder,
      _ProjCstLineItm.OrderID,
      _ProjCstLineItm.OrderOperation,
      _ProjCstLineItm.OrderSuboperation,
      ' '                                                                             as MaintenanceOrderDesc,
      _ProjCstLineItm.PartnerAccountAssignmentType,
      ''                                                                              as OperationDescription,
      _ProjCstLineItm.PartnerOrderCategory,
      cast('PR' as abap.char(2))                                                      as ProjectObjectType,


      _ProjCstLineItm.PartnerWBSElement                                               as ProjectPartnerObject,

      _ProjCstLineItm.PartnerProjectNetwork,

      ''                                                                              as PartnerProjectNetworkActivity,
      ''                                                                              as InternalOrder,
      ''                                                                              as ProductionOrder,
      _ProjCstLineItm.Product,
      ''                                                                              as ServiceOrder,
      ''                                                                              as ServiceOrderItem,
      ''                                                                              as ServiceContract,
      ''                                                                              as ServiceContractItem,

      _ProjCstLineItm.PartnerProject,
      _ProjCstLineItm.BusinessTransactionType,
      _ProjCstLineItm.DebitCreditCode,
      _ProjCstLineItm.ControllingDebitCreditCode,

      _ProjCstLineItm.WBSElement,
      _ProjCstLineItm.ProjectNetwork                                                  as ProjectNetwork,

      ''                                                                              as NetworkActivity,
      ''                                                                              as NetworkActivityElement,
      WBSElement.WBSElementExternalID                                                 as ProjectObjectExternalID,
      ''                                                                              as ProjectNetworkActivity,

      _Project.Project,

      WBSElement.ProjectInternalID,

      _ProjCstLineItm.WBSElementInternalID                                            as ObjectInternalID,

      _ProjCstLineItm.ControllingArea,
      _ProjCstLineItm.GLAccount,
      _ProjCstLineItm.ChartOfAccounts,
      _ProjCstLineItm.CostCenter,
      _ProjCstLineItm.ProfitCenter,
      _ProjCstLineItm.CreationDate,
      _ProjCstLineItm.FunctionalArea,
      _ProjCstLineItm.CostCtrActivityType,
      _ProjCstLineItm.OriginCostCtrActivityType,
      _ProjCstLineItm.OriginCostCenter,
      @Semantics.currencyCode: true
      _ProjCstLineItm.ControllingObjectCurrency,
      @Aggregation.default: #SUM
      @Semantics.amount.currencyCode: 'ControllingObjectCurrency'
      _ProjCstLineItm.AmountInObjectCurrency,

      @Semantics.currencyCode:true
      _ProjCstLineItm.TransactionCurrency,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'TransactionCurrency'} }
      _ProjCstLineItm.AmountInTransactionCurrency,

      @Semantics.currencyCode:true
      _ProjCstLineItm.CompanyCodeCurrency,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'CompanyCodeCurrency'} }
      _ProjCstLineItm.AmountInCompanyCodeCurrency,

      @Semantics.currencyCode:true
      _ProjCstLineItm.GlobalCurrency,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'GlobalCurrency'} }
      _ProjCstLineItm.AmountInGlobalCurrency,

      @Semantics.currencyCode: true
      _ProjCstLineItm.FunctionalCurrency,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FunctionalCurrency'} }
      _ProjCstLineItm.AmountInFunctionalCurrency                                      as ActualAmountInFunctionalCrcy,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency1,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency1'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency1,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency2,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency2'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency2,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency3,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency3'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency3,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency4,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency4'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency4,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency5,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency5'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency5,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency6,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency6'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency6,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency7,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency7'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency7,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency8,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency8'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency8,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'GlobalCurrency'} }
      _ProjCstLineItm.AmountInGlobalCurrency                                          as ActualAmountInGlobalCurrency,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'ControllingObjectCurrency'} }
      _ProjCstLineItm.AmountInObjectCurrency                                          as ActlCostInProjCrcy,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency1'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency1                                    as ActualAmountInFreeDfndCrcy1,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency2'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency2                                    as ActualAmountInFreeDfndCrcy2,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency3'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency3                                    as ActualAmountInFreeDfndCrcy3,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency4'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency4                                    as ActualAmountInFreeDfndCrcy4,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency5'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency5                                    as ActualAmountInFreeDfndCrcy5,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency6'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency6                                    as ActualAmountInFreeDfndCrcy6,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency7'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency7                                    as ActualAmountInFreeDfndCrcy7,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency8'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency8                                    as ActualAmountInFreeDfndCrcy8,

      _ProjCstLineItm.SourceReferenceDocumentType,
      _ProjCstLineItm.SourceLogicalSystem,
      _ProjCstLineItm.SourceReferenceDocumentCntxt,
      _ProjCstLineItm.SourceReferenceDocument,
      _ProjCstLineItm.SourceReferenceDocumentItem,
      _ProjCstLineItm.SourceReferenceDocSubitem,
      _ProjCstLineItm.IsCommitment,
      _ProjCstLineItm.PartnerProfitCenter,
      _ProjCstLineItm.PartnerCompanyCode,
      cast('X' as boolean)                                                            as IsSettled,

      cast( cast( 'ACT01' as abap.char( 10  )) as fcom_category)                      as PlanningCategory,

      _ProjCstLineItm.PostingDate,
      _ProjCstLineItm.DocumentDate,
      _ProjCstLineItm.FiscalPeriod,
      _ProjCstLineItm.FiscalYearPeriod,
      _ProjCstLineItm.FiscalYearVariant,

      cast( 'X' as boolean )                                                          as MaintenanceOrderIsSelected,


      cast( 'PR' as ps_s4_projselobj )                                                as ProjectSelectedObject,

      WBSElement.ProfitCenter                                                         as ProjectObjectProfitCenter,

      WBSElement.WBSDescription                                                       as ProjectObjectDescription,

      WBSElement.WBSElementObject                                                     as ProjectObjectNode,

      WBSElement._Project.ProjectObject                                               as ProjectObjectRootNode,

      WBSElement.ResponsibleCostCenter                                                as ResponsibleCostCenter,

      WBSElement.ProjectType                                                          as ProjectType,
      cast( '' as aufart )                                                            as OrderType,

      _VirtualPlanningCategory,

      _WBSElement,
      _ProjectNetwork,
      _NetworkActivity,
      _PMOrder,
      _InternalOrder

}
//where

//  _ProjCstLineItm.BusinessTransactionType <> 'TBRR'




//Statistical Internal Orders

union all select from I_GLAccountLineItemRawData as _ProjCstLineItm

  inner join          I_InternalOrder            as InternalOrder on  InternalOrder.InternalOrder      =  _ProjCstLineItm.OrderID
                                                                  and _ProjCstLineItm.OrderID          <> ''
                                                                  and InternalOrder.IsStatisticalOrder =  'X'

  inner join          I_WBSElementData_2         as WBSElement    on InternalOrder.WBSElementInternalID = WBSElement.WBSElementInternalID

  inner join          I_ProjectData_2            as Project       on  WBSElement.ProjectInternalID = Project.ProjectInternalID
                                                                  and Project.ProjectObject        = $parameters.P_ProjectObjectRootNode


association [0..*] to I_VirtualPlanningCategory      as _VirtualPlanningCategory on $projection.PlanningCategory = _VirtualPlanningCategory.SourcePlanningCategory
association        to I_WBSElementData_2             as _WBSElement              on InternalOrder.ControllingObject = _WBSElement.WBSElementObject
association        to I_NetworkActivityForCostReport as _NetworkActivity         on InternalOrder.ControllingObject = _NetworkActivity.NetworkActivityObject
association        to I_ProjectNetwork               as _ProjectNetwork          on InternalOrder.ControllingObject = _ProjectNetwork.ProjectNetworkObject

association        to I_MaintenanceOrder             as _PMOrder                 on InternalOrder.ControllingObject = _PMOrder.MaintenanceOrderInternalID
association        to I_InternalOrder                as _InternalOrder           on $projection.InternalOrder = _InternalOrder.InternalOrder
{

  key _ProjCstLineItm.SourceLedger,
  key _ProjCstLineItm.SourceLedger                                                    as Ledger,
  key _ProjCstLineItm.CompanyCode,
  key _ProjCstLineItm.FiscalYear,
  key _ProjCstLineItm.AccountingDocument,
      cast(cast( '00000000000000000000000' as abap.numc (23)) as fis_fp_request_tsn ) as FinancialPlanningReqTransSqnc,
      cast(cast( '000000' as abap.numc (6)) as fis_fp_data_packet )                   as FinancialPlanningDataPacket,
      cast( LedgerGLLineItem as fis_act_pln_docln)                                    as ActualPlanJournalEntryItem,
      _ProjCstLineItm.LedgerFiscalYear,
      _ProjCstLineItm.LedgerGLLineItem,
      @Aggregation.default: #NONE
      cast(cast( 0 as abap.int4 ) as fis_fp_entry_item )                              as FinancialPlanningEntryItem,
      cast(cast( 'A' as abap.char (1)) as fis_actual_plan_code)                       as ActualPlanCode,
      _ProjCstLineItm.AccountingDocCreatedByUser,
      _ProjCstLineItm.BusinessArea,
      _ProjCstLineItm.PartnerOrder,
      _ProjCstLineItm.OrderID,
      _ProjCstLineItm.OrderOperation,
      _ProjCstLineItm.OrderSuboperation,
      ' '                                                                             as MaintenanceOrderDesc,
      _ProjCstLineItm.PartnerAccountAssignmentType,
      ''                                                                              as OperationDescription,
      _ProjCstLineItm.PartnerOrderCategory,
      cast('IO' as abap.char(2))                                                      as ProjectObjectType,


      _ProjCstLineItm.PartnerWBSElement                                               as ProjectPartnerObject,

      _ProjCstLineItm.PartnerProjectNetwork,

      ''                                                                              as PartnerProjectNetworkActivity,
      _ProjCstLineItm.OrderID                                                         as InternalOrder,
      ''                                                                              as ProductionOrder,
      _ProjCstLineItm.Product,
      ''                                                                              as ServiceOrder,
      ''                                                                              as ServiceOrderItem,
      ''                                                                              as ServiceContract,
      ''                                                                              as ServiceContractItem,

      _ProjCstLineItm.PartnerProject,
      _ProjCstLineItm.BusinessTransactionType,
      _ProjCstLineItm.DebitCreditCode,
      _ProjCstLineItm.ControllingDebitCreditCode,

      _ProjCstLineItm.WBSElement,
      _ProjCstLineItm.ProjectNetwork                                                  as ProjectNetwork,

      ''                                                                              as NetworkActivity,
      ''                                                                              as NetworkActivityElement,
      InternalOrder.InternalOrder                                                     as ProjectObjectExternalID,
      ''                                                                              as ProjectNetworkActivity,

      InternalOrder._WBSElementBasicData._Project.Project,

      InternalOrder._WBSElementBasicData.ProjectInternalID,

      _ProjCstLineItm.OrderID                                                         as ObjectInternalID,

      _ProjCstLineItm.ControllingArea,
      _ProjCstLineItm.GLAccount,
      _ProjCstLineItm.ChartOfAccounts,
      _ProjCstLineItm.CostCenter,
      _ProjCstLineItm.ProfitCenter,
      _ProjCstLineItm.CreationDate,
      _ProjCstLineItm.FunctionalArea,
      _ProjCstLineItm.CostCtrActivityType,
      _ProjCstLineItm.OriginCostCtrActivityType,
      _ProjCstLineItm.OriginCostCenter,
      @Semantics.currencyCode: true
      _ProjCstLineItm.ControllingObjectCurrency,
      @Aggregation.default: #SUM
      @Semantics.amount.currencyCode: 'ControllingObjectCurrency'
      _ProjCstLineItm.AmountInObjectCurrency,

      @Semantics.currencyCode:true
      _ProjCstLineItm.TransactionCurrency,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'TransactionCurrency'} }
      _ProjCstLineItm.AmountInTransactionCurrency,

      @Semantics.currencyCode:true
      _ProjCstLineItm.CompanyCodeCurrency,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'CompanyCodeCurrency'} }
      _ProjCstLineItm.AmountInCompanyCodeCurrency,

      @Semantics.currencyCode:true
      _ProjCstLineItm.GlobalCurrency,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'GlobalCurrency'} }
      _ProjCstLineItm.AmountInGlobalCurrency,

      @Semantics.currencyCode: true
      _ProjCstLineItm.FunctionalCurrency,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FunctionalCurrency'} }
      _ProjCstLineItm.AmountInFunctionalCurrency                                      as ActualAmountInFunctionalCrcy,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency1,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency1'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency1,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency2,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency2'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency2,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency3,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency3'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency3,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency4,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency4'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency4,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency5,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency5'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency5,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency6,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency6'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency6,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency7,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency7'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency7,

      @Semantics.currencyCode:true
      _ProjCstLineItm.FreeDefinedCurrency8,
      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency8'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency8,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'GlobalCurrency'} }
      _ProjCstLineItm.AmountInGlobalCurrency                                          as ActualAmountInGlobalCurrency,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'ControllingObjectCurrency'} }
      _ProjCstLineItm.AmountInObjectCurrency                                          as ActlCostInProjCrcy,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency1'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency1                                    as ActualAmountInFreeDfndCrcy1,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency2'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency2                                    as ActualAmountInFreeDfndCrcy2,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency3'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency3                                    as ActualAmountInFreeDfndCrcy3,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency4'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency4                                    as ActualAmountInFreeDfndCrcy4,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency5'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency5                                    as ActualAmountInFreeDfndCrcy5,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency6'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency6                                    as ActualAmountInFreeDfndCrcy6,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency7'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency7                                    as ActualAmountInFreeDfndCrcy7,

      @Aggregation.default: #SUM
      @Semantics: { amount : {currencyCode: 'FreeDefinedCurrency8'} }
      _ProjCstLineItm.AmountInFreeDefinedCurrency8                                    as ActualAmountInFreeDfndCrcy8,

      _ProjCstLineItm.SourceReferenceDocumentType,
      _ProjCstLineItm.SourceLogicalSystem,
      _ProjCstLineItm.SourceReferenceDocumentCntxt,
      _ProjCstLineItm.SourceReferenceDocument,
      _ProjCstLineItm.SourceReferenceDocumentItem,
      _ProjCstLineItm.SourceReferenceDocSubitem,
      _ProjCstLineItm.IsCommitment,
      _ProjCstLineItm.PartnerProfitCenter,
      _ProjCstLineItm.PartnerCompanyCode,


      cast('X' as boolean)                                                            as IsSettled,
      //      cast(' ' as boolean)                                                            as IsSettled,

      cast( cast( 'ACT01' as abap.char( 10  )) as fcom_category)                      as PlanningCategory,

      _ProjCstLineItm.PostingDate,
      _ProjCstLineItm.DocumentDate,
      _ProjCstLineItm.FiscalPeriod,
      _ProjCstLineItm.FiscalYearPeriod,
      _ProjCstLineItm.FiscalYearVariant,

      cast( 'X' as boolean )                                                          as MaintenanceOrderIsSelected,


      cast( 'IO' as ps_s4_projselobj )                                                as ProjectSelectedObject,

      InternalOrder.ProfitCenter                                                      as ProjectObjectProfitCenter,

      InternalOrder.InternalOrderDescription                                          as ProjectObjectDescription,

      InternalOrder.ControllingObject                                                 as ProjectObjectNode,

      InternalOrder._WBSElementBasicData._Project.ProjectObject                       as ProjectObjectRootNode,

      InternalOrder.ResponsibleCostCenter                                             as ResponsibleCostCenter,

      cast( '' as ps_prart )                                                          as ProjectType,
      InternalOrder.OrderType                                                         as OrderType,

      _VirtualPlanningCategory,

      _WBSElement,
      _ProjectNetwork,
      _NetworkActivity,
      _PMOrder,
      _InternalOrder
}
//where

//  _ProjCstLineItm.BusinessTransactionType <> 'TBRR'