P_PPM_PrjActCostLineitems

DDL: P_PPM_PRJACTCOSTLINEITEMS Type: view COMPOSITE Package: VDM_PPM_OBJECTS_ANALYTICS

Project Cost Line Items with Planning Category Costs

P_PPM_PrjActCostLineitems is a Composite CDS View that provides data about "Project Cost Line Items with Planning Category Costs" in SAP S/4HANA. It reads from 2 data sources (I_GLAccountLineItemRawData, I_WBSElementBasicData) and exposes 12 fields with key fields Ledger, CompanyCode, ProjectInternalID, ControllingArea, BusinessArea. It has 3 associations to related views. Part of development package VDM_PPM_OBJECTS_ANALYTICS.

Data Sources (2)

SourceAliasJoin Type
I_GLAccountLineItemRawData ProjCstLineItm from
I_WBSElementBasicData Task inner

Associations (3)

CardinalityTargetAliasCondition
[0..1] I_ControllingArea _ControllingArea $projection.ControllingArea = _ControllingArea.ControllingArea
[0..1] I_Ledger _Ledger $projection.Ledger = _Ledger.Ledger
[1] I_CompanyCode _CompanyCode $projection.CompanyCode = _CompanyCode.CompanyCode

Annotations (12)

NameValueLevelField
AbapCatalog.sqlViewName PPMPRJBYACTCST view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.dataMaintenance #RESTRICTED view
AccessControl.authorizationCheck #CHECK view
AccessControl.personalData.blocking #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.private true view
VDM.viewType #COMPOSITE view
ObjectModel.representativeKey ProjectInternalID view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.sizeCategory #XL view

Fields (12)

KeyFieldSource TableSource FieldDescription
KEY Ledger I_GLAccountLineItemRawData SourceLedger
KEY CompanyCode I_GLAccountLineItemRawData CompanyCode
KEY ProjectInternalID I_GLAccountLineItemRawData ProjectInternalID
KEY ControllingArea I_GLAccountLineItemRawData ControllingArea
KEY BusinessArea I_GLAccountLineItemRawData BusinessArea
KEY ProfitCenter I_GLAccountLineItemRawData ProfitCenter
KEY YearMonth _CalendarDate YearMonth
GlobalCurrency I_GLAccountLineItemRawData GlobalCurrency
AmountInGlobalCurrency
_CompanyCode _CompanyCode
_ControllingArea _ControllingArea
_Ledger _Ledger
/* !!!
   !!! DONOTUSE - This CDS view is erroneous - Replaced by P_PPM_PrjActCstLineItemsSemTag 
*/

//@EndUserText.label: 'Project Cost Line Items with Planning Category Costs'


@AbapCatalog: {
    sqlViewName: 'PPMPRJBYACTCST',
    compiler.compareFilter: true,
    dataMaintenance: #RESTRICTED
}

@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #NOT_REQUIRED

@ClientHandling.algorithm: #SESSION_VARIABLE

//@Consumption.semanticObject: 'EnterpriseProject'


@VDM: {
//  lifecycle.contract.type:  #SAP_INTERNAL_API,

  private: true,
  viewType: #COMPOSITE
}


@ObjectModel: {
//   semanticKey:       [ 'Project' ],

   representativeKey: 'ProjectInternalID',
   supportedCapabilities: [ #SQL_DATA_SOURCE, #CDS_MODELING_DATA_SOURCE, #CDS_MODELING_ASSOCIATION_TARGET ],   
   usageType: {
     serviceQuality:  #D,
     dataClass:       #MIXED,
     sizeCategory:    #XL
   }
}

/* !!!
   !!! DONOTUSE - This CDS view is erroneous - Replaced by P_PPM_PrjActCstLineItemsSemTag 
   !!! view is out of maintenance, incorrect by intention, no usage and private view. Can be deleteted? (12/2022)
*/
define view P_PPM_PrjActCostLineitems
  as select from I_GLAccountLineItemRawData as ProjCstLineItm
    inner join   I_WBSElementBasicData        as Task         on   ProjCstLineItm.ProjectInternalID    = Task.ProjectInternalID
                                                               and ProjCstLineItm.WBSElementInternalID = Task.WBSElementInternalID                                                         

  association [0..1] to I_ControllingArea              as _ControllingArea               on  $projection.ControllingArea = _ControllingArea.ControllingArea
  association [0..1] to I_Ledger                       as _Ledger                        on  $projection.Ledger = _Ledger.Ledger
  association [1]    to I_CompanyCode                  as _CompanyCode                   on  $projection.CompanyCode = _CompanyCode.CompanyCode


{
  @ObjectModel.foreignKey.association: '_Ledger'  
  key  ProjCstLineItm.SourceLedger                                as Ledger, // change based on cleanup of I_GLAccountLineItem 30.11.2022

  @ObjectModel.foreignKey.association: '_CompanyCode'
  key  ProjCstLineItm.CompanyCode,
  key  ProjCstLineItm.ProjectInternalID,
  @ObjectModel.foreignKey.association: '_ControllingArea'
  key  ProjCstLineItm.ControllingArea,                
  key  ProjCstLineItm.BusinessArea,
  key  ProjCstLineItm.ProfitCenter,                   
  key  _CalendarDate.YearMonth                                     as YearMonth,

       @Semantics.currencyCode:true
       ProjCstLineItm.GlobalCurrency,
       @DefaultAggregation: #SUM
       @Semantics: { amount : {currencyCode: 'GlobalCurrency'} }
       sum( ProjCstLineItm.AmountInGlobalCurrency ) as AmountInGlobalCurrency,
       
  _CompanyCode,
  _ControllingArea,
  _Ledger  

}
where   ProjCstLineItm.ProjectInternalID = Task.ProjectInternalID
  and ProjCstLineItm.CompanyCode       = Task.CompanyCode
  and IsCommitment != 'X'
  and _Ledger.IsLeadingLedger = 'X'
/* Adjustment to have the same cost displayed by P_ProjectCostLineItems with filter IsSettled = 'X'      
   I.e. shows all costs "To Project" and exclude costs "From Project" like Settlement Cost.   
   This adjustment leads to the absence of Settlement Costs in the display. */ 
    and not (      ControllingDebitCreditCode = 'A' 
              or (       ControllingDebitCreditCode = 'S' 
                   and ( BusinessTransactionType = 'KOAO' or BusinessTransactionType = 'KOAE' ) 
                   and ( (     PartnerProject = ' '                and PartnerOrder = ' '           and PartnerSalesDocument = ' ' and PartnerProjectNetwork = ' '   
                           and PartnerProjectNetworkActivity = ' ' and PartnerBusinessProcess = ' ' and PartnerCostObject = ' ' ) 
                         or PartnerProject = Project )
                 )
             )        
    and GlobalCurrency    <> ''   
    and PostingDate        > '00000000'
//  and ProjCstLineItm.ProjectInternalID = Project.ProjectInternalID

group by SourceLedger, ProjCstLineItm.CompanyCode, ProjCstLineItm.ProjectInternalID, ProjCstLineItm.ControllingArea, BusinessArea, 
          ProjCstLineItm.ProfitCenter, _CalendarDate.YearMonth, GlobalCurrency