I_ProjectBillingElmntDueDate

DDL: I_PROJECTBILLINGELMNTDUEDATE SQL: IPRJBILLDUEDATE Type: view_entity COMPOSITE

Billing Due Date of Billing Element

I_ProjectBillingElmntDueDate is a Composite CDS View that provides data about "Billing Due Date of Billing Element" in SAP S/4HANA. It reads from 3 data sources (I_ProjectBillingElement, P_ProjectBillingElmntDueDate, I_SalesOrderItem) and exposes 7 fields with key field ProjectBillingElementUUID. It has 1 association to related views.

Data Sources (3)

SourceAliasJoin Type
I_ProjectBillingElement ProjectBillingElement from
P_ProjectBillingElmntDueDate ProjectBillingElmntDueDate inner
I_SalesOrderItem SalesOrderItem inner

Parameters (1)

NameTypeDefault
P_BillingPlanItemUsage sdbp_item_usage

Associations (1)

CardinalityTargetAliasCondition
[0..1] P_ProjectBillingElmntDueDate _ProjectBillingElmntDueDate SalesOrderItem.BillingPlan = _ProjectBillingElmntDueDate.BillingPlan -- and SalesOrderItem.SalesOrder = _ProjectBillingElmntDueDate.SalesOrder -- and SalesOrderItem.SalesOrderItem = _ProjectBillingElmntDueDate.SalesOrderItem

Annotations (6)

NameValueLevelField
AccessControl.authorizationCheck #CHECK view
EndUserText.label Billing Due Date of Billing Element view
VDM.viewType #COMPOSITE view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #L view

Fields (7)

KeyFieldSource TableSource FieldDescription
KEY ProjectBillingElementUUID I_ProjectBillingElement ProjectBillingElementUUID
WBSElementInternalID I_ProjectBillingElement BillingWBSElementInternalID
DueBillingDate P_ProjectBillingElmntDueDate DueBillingDate
BillingPlan I_SalesOrderItem BillingPlan
SalesOrder I_SalesOrderItem SalesOrder
SalesOrderItem_EnterpriseProjectElement
_SalesOrderItem
//@AbapCatalog.sqlViewName: 'IPRJBILLDUEDATE'

//@AbapCatalog.compiler.compareFilter: true

//@AbapCatalog.preserveKey: true

@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Billing Due Date of Billing Element'
@VDM.viewType: #COMPOSITE
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #L
//@AccessControl.privilegedAssociations: ['_SlsDocItemBillingPlanDueDate' ]

//@AccessControl.personalData.blocking: #BLOCKED_DATA_EXCLUDED

//@ClientHandling.algorithm: #SESSION_VARIABLE


define view entity I_ProjectBillingElmntDueDate --with parameters P_BillingPlanItemUsage : sdbp_item_usage
  as select from I_ProjectBillingElement      as ProjectBillingElement
    inner join   I_SalesOrderItem             as SalesOrderItem on ProjectBillingElement.BillingWBSElementInternalID = SalesOrderItem.WBSElementInternalID
    inner join   P_ProjectBillingElmntDueDate as ProjectBillingElmntDueDate on SalesOrderItem.BillingPlan = ProjectBillingElmntDueDate.BillingPlan
--  association [0..1] to P_ProjectBillingElmntDueDate as _ProjectBillingElmntDueDate on SalesOrderItem.BillingPlan = _ProjectBillingElmntDueDate.BillingPlan
--                                                                                   and SalesOrderItem.SalesOrder  = _ProjectBillingElmntDueDate.SalesOrder
--                                                                                   and SalesOrderItem.SalesOrderItem  = _ProjectBillingElmntDueDate.SalesOrderItem
                                                                                     
{
  key ProjectBillingElement.ProjectBillingElementUUID,
      ProjectBillingElement.BillingWBSElementInternalID as WBSElementInternalID,
      ProjectBillingElmntDueDate.DueBillingDate         as DueBillingDate, 
      SalesOrderItem.BillingPlan,
      SalesOrderItem.SalesOrder,
      SalesOrderItem.SalesOrderItem
      --_EnterpriseProjectElement,
      --_SalesOrderItem

}
      where ProjectBillingElement.BillingWBSElementInternalID is not initial

//  as select from I_ProjectBillingElement    as ProjectBillingElement

//    --inner join   I_EnterpriseProjectElement as EnterpriseProjectElement on ProjectBillingElement.BillingWBSElementInternalID = EnterpriseProjectElement.WBSElementInternalID

//    inner join   I_SalesOrderItem           as SalesOrderItem           on ProjectBillingElement.BillingWBSElementInternalID = SalesOrderItem.WBSElement

//  association [0..1] to P_ProjBillingElmntMaxBillDate as _maxbillingduedate        on  SalesOrderItem.BillingPlan = _maxbillingduedate.BillingPlan

//  association [0..1] to P_ProjBillingElmntMinBillDate as _minbillingduedate        on  SalesOrderItem.BillingPlan = _minbillingduedate.BillingPlan

//  --association [1..1] to I_EnterpriseProjectElement    as _EnterpriseProjectElement on  EnterpriseProjectElement.ProjectElementUUID = _EnterpriseProjectElement.ProjectElementUUID

//  --association [1..1] to I_SalesOrderItem              as _SalesOrderItem           on  SalesOrderItem.SalesOrder     = _SalesOrderItem.SalesOrder

//  --                                                                                 and SalesOrderItem.SalesOrderItem = _SalesOrderItem.SalesOrderItem

//{

//  key ProjectBillingElement.ProjectBillingElementUUID,

//      ProjectBillingElement.BillingWBSElementInternalID as WBSElementInternalID,

//      --EnterpriseProjectElement.ProjectElementUUID,

//      case when _maxbillingduedate.MaxDate is not null then _maxbillingduedate.MaxDate

//           when _minbillingduedate.MinDate is not null then _minbillingduedate.MinDate

//           when _maxbillingduedate.MaxDate is null and _minbillingduedate.MinDate is null then SalesOrderItem.BOMExplosionDate

//      --else EnterpriseProjectElement.PlannedEndDate

//      end                                               as DueBillingDate,

//      SalesOrderItem.BillingPlan,

//      SalesOrderItem.SalesOrder,

//      SalesOrderItem.SalesOrderItem

//      --_EnterpriseProjectElement,

//      --_SalesOrderItem

//}

--where
--  EnterpriseProjectElement.WBSElementIsBillingElement = 'X'

//  as select from I_SalesOrderItem as SalesOrderItem

//  inner join I_SalesDocItemBillingPlan as SalesDocItemBillPlan on SalesOrderItem.BillingPlan = SalesDocItemBillPlan.BillingPlan

//  --association [0..1] to P_ProjBillingElmntBillgDate as _billingduedate on $projection.BillingPlan = _billingduedate.BillingPlan

//  association [1..1] to P_ProjBillingElmntMaxBillDate as _maxbillingduedate on $projection.BillingPlan = _maxbillingduedate.BillingPlan

//  association [0..1] to P_ProjBillingElmntMinBillDate as _minbillingduedate on $projection.BillingPlan = _minbillingduedate.BillingPlan

//// as select from I_SlsDocItemBillingPlan as _salesDocItemDueDate

//// association [0..1] to I_SlsDocItemBillingPlanDueDate as _SlsDocItemBillingPlanDueDate  on  $projection.BillingPlan   = _SlsDocItemBillingPlanDueDate.BillingPlan

////  association [1..1] to P_ProjBillingElmntMaxBillDate as _maxbillingduedate on _salesDocItemDueDate.BillingPlan = _maxbillingduedate.BillingPlan

////  association [0..1] to P_ProjBillingElmntMinBillDate as _minbillingduedate on _salesDocItemDueDate.BillingPlan = _minbillingduedate.BillingPlan

//{

//    key cast(SalesOrderItem.WBSElement as ps_s4_pspnr preserving type ) as WBSElementInternalID,

//    SalesOrderItem.SalesOrder,

//    SalesOrderItem.SalesOrderItem,

//    SalesDocItemBillPlan.BillingPlan as BillingPlan,

////    COALESCE(_maxbillingduedate(P_BillingPlanItemUsage: :P_BillingPlanItemUsage).MaxDate,

////             _minbillingduedate(P_BillingPlanItemUsage: :P_BillingPlanItemUsage).MinDate ) as DueBillingDate

//    case

//      when _maxbillingduedate.MaxDate is not null

//        then cast(_maxbillingduedate.MaxDate as fkdat)

//      when  _minbillingduedate.MinDate is not null

//        then cast(_minbillingduedate.MinDate as fkdat)

//      -- YD perf optimization - avoid "non null preserving" case {

//      -- else cast ('00000000' as fkdat)  //in case there is no open DueBillingDate - for C_ProjectBillingRequestItemTP "where condition" work correctly

//      -- }

//    end as DueBillingDate

//    --min( _billingduedate(P_BillingPlanItemUsage: $parameters.P_BillingPlanItemUsage).BillingDate ) as DueBillingDate

//}

//--group by SalesOrderItem.WBSElement, SalesOrderItem.SalesOrder, SalesOrderItem.SalesOrderItem, SalesDocItemBillPlan.BillingPlan

//

////  key  _salesDocItemDueDate.BillingPlan,

////       _salesDocItemDueDate.BillingPlanUsageCategory,

//

// //      _maxbillingduedate.MaxDate as DueBillingDate

// //     _SlsDocItemBillingPlanDueDate.BillingPlanItemUsage,

//

////        case

////         when _maxbillingduedate(P_BillingPlanItemUsage: :P_BillingPlanItemUsage).MaxDate is not null // and _minbillingduedate.MinDate is not null

////         then cast(_maxbillingduedate(P_BillingPlanItemUsage: :P_BillingPlanItemUsage).MaxDate as fkdat)

////         when  _minbillingduedate(P_BillingPlanItemUsage: :P_BillingPlanItemUsage).MinDate is not null // and _maxbillingduedate.MaxDate is null

////         then cast(_minbillingduedate(P_BillingPlanItemUsage: :P_BillingPlanItemUsage).MinDate as fkdat)

////        when _maxbillingduedate.MaxDate is not null and _minbillingduedate.MinDate is null

////         then cast(_maxbillingduedate.MaxDate as fkdat)

////        else cast ('00000000' as fkdat)

////        end as DueBillingDate

////}

////group by _SalesOrderItem.WBSElement, _SalesDocItemBillPlan.BillingPlan,

////    _maxbillingduedate(P_BillingPlanItemUsage: :P_BillingPlanItemUsage).MaxDate,

////    _minbillingduedate(P_BillingPlanItemUsage: :P_BillingPlanItemUsage).MinDate

/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_PROJECTBILLINGELEMENT",
"I_SALESORDERITEM",
"P_PROJECTBILLINGELMNTDUEDATE"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/