I_UtilsBillingOrder

DDL: I_UTILSBILLINGORDER SQL: IEINBLLGORDER Type: view COMPOSITE

Utilities Billing Order

I_UtilsBillingOrder is a Composite CDS View that provides data about "Utilities Billing Order" in SAP S/4HANA. It reads from 5 data sources (I_ContractAccountPartner, I_UtilitiesBillingOrder, I_UtilitiesContract, I_UtilitiesInstallationHist, I_UtilitiesPortionScheduleRecd) and exposes 52 fields with key fields UtilitiesContract, UtilitiesInstallation, ScheduledUtilitiesBillingDate, UtilitiesBillingReason, UtilsInstHistValidityEndDate. It has 3 associations to related views.

Data Sources (5)

SourceAliasJoin Type
I_ContractAccountPartner ContractAccountPartner inner
I_UtilitiesBillingOrder UtilitiesBillingOrder from
I_UtilitiesContract UtilitiesContract inner
I_UtilitiesInstallationHist UtilitiesInstallationHist inner
I_UtilitiesPortionScheduleRecd UtilitiesPortionScheduleRecd left_outer

Associations (3)

CardinalityTargetAliasCondition
[0..1] I_NonBllbleUtilsBillgOrderCntr _NonBllbleUtilsBillgOrderCntr $projection.UtilitiesInstallation = _NonBllbleUtilsBillgOrderCntr.UtilitiesInstallation and $projection.UtilitiesContract = _NonBllbleUtilsBillgOrderCntr.UtilitiesContract
[1..1] I_UtilsBillgOrdChkBfrBilling _UtilsBillgOrdChkBfrBilling $projection.UtilsBillgOrdChkBfrBilling = _UtilsBillgOrdChkBfrBilling.UtilsBillgOrdChkBfrBilling
[0..*] I_UtilsInstIntAndExtPtOfDeliv _UtilsInstIntAndExtPtOfDeliv $projection.UtilitiesInstallation = _UtilsInstIntAndExtPtOfDeliv.UtilitiesInstallation and _UtilsInstIntAndExtPtOfDeliv.UtilsPoDAllocValidityEndDate = '99991231' and _UtilsInstIntAndExtPtOfDeliv.UtilsPoDAllocValidityEndTime = '235959'

Annotations (8)

NameValueLevelField
EndUserText.label Utilities Billing Order view
VDM.viewType #COMPOSITE view
AbapCatalog.sqlViewName IEINBLLGORDER view
AccessControl.authorizationCheck #CHECK view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.dataClass #MIXED view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (52)

KeyFieldSource TableSource FieldDescription
KEY UtilitiesContract I_UtilitiesContract UtilitiesContract
KEY UtilitiesInstallation I_UtilitiesBillingOrder UtilitiesInstallation
KEY ScheduledUtilitiesBillingDate I_UtilitiesBillingOrder ScheduledUtilitiesBillingDate
KEY UtilitiesBillingReason I_UtilitiesBillingOrder UtilitiesBillingReason
KEY UtilsInstHistValidityEndDate I_UtilitiesInstallationHist UtilsInstHistValidityEndDate
KEY ContractAccount I_ContractAccountPartner ContractAccount
UtilitiesPortion I_UtilitiesBillingOrder UtilitiesPortion
ScheduledMeterReadingDate I_UtilitiesBillingOrder ScheduledMeterReadingDate
CompanyCode I_UtilitiesContract CompanyCode
Division I_UtilitiesContract UtilitiesDivision
UtilsBillgBlockReason I_UtilitiesContract UtilsBillgBlockReason
UtilsBillgUnblockReason I_UtilitiesContract UtilsBillgUnblockReason
MeterReadingUnit I_UtilitiesBillingOrder MeterReadingUnit
UtilitiesRateCategory I_UtilitiesInstallationHist UtilitiesRateCategory
UtilsContrIsBilledManually
UtilitiesBillingClass I_UtilitiesInstallationHist UtilitiesBillingClass
UtilsPortionScheduleRecordDate I_UtilitiesPortionScheduleRecd UtilsPortionScheduleRecordDate
BusinessPartner I_ContractAccountPartner BusinessPartner
UtilitiesMoveInDate I_UtilitiesContract UtilitiesMoveInDate
UtilitiesMoveOutDate I_UtilitiesContract UtilitiesMoveOutDate
UtilsBillingOrderStatus I_UtilitiesBillingOrder UtilsBillingOrderStatus
UtilsBillingOrderIndicator I_UtilitiesBillingOrder UtilsBillingOrderIndicator
SuppressedUtilsBillgReason I_UtilitiesBillingOrder SuppressedUtilsBillgReason
SuppressedUtilsSchedldBillgDte I_UtilitiesBillingOrder SuppressedUtilsSchedldBillgDte
SuppressedSchedldMtrRdngDte I_UtilitiesBillingOrder SuppressedSchedldMtrRdngDte
UtilsContrSpcfcBdgtBillgCycle I_UtilitiesContract UtilsContrSpcfcBdgtBillgCycle
UtilitiesAccountDetnCode I_UtilitiesContract UtilitiesAccountDetnCode
UtilsBillgOutsortingReason I_UtilitiesContract UtilsBillgOutsortingReason
UtilsExternalPointOfDelivery _UtilsInstIntAndExtPtOfDeliv UtilsExternalPointOfDelivery
AuthorizationGroup I_UtilitiesContract AuthorizationGroup
NrOfUtilitiesBillingOrders
_UtilitiesInstallation I_UtilitiesBillingOrder _UtilitiesInstallation
_UtilitiesBillingReason I_UtilitiesBillingOrder _UtilitiesBillingReason
_UtilitiesPortion I_UtilitiesBillingOrder _UtilitiesPortion
_CompanyCode I_UtilitiesContract _CompanyCode
_Division I_UtilitiesContract _Division
_UtilsBillgBlockReason I_UtilitiesContract _UtilsBillgBlockReason
_UtilsBillgUnblockReason I_UtilitiesContract _UtilsBillgUnblockReason
_MeterReadingUnit I_UtilitiesBillingOrder _MeterReadingUnit
_UtilitiesRateCategory I_UtilitiesInstallationHist _UtilitiesRateCategory
_UtilsBillingClass I_UtilitiesInstallationHist _UtilsBillingClass
_ContrAcc I_ContractAccountPartner _ContrAcc
_BusinessPartner I_ContractAccountPartner _BusinessPartner
_UtilsBillingOrderStatus I_UtilitiesBillingOrder _UtilsBillingOrderStatus
_UtilsBillingOrderIndicator I_UtilitiesBillingOrder _UtilsBillingOrderIndicator
_SuppressedUtilsBillgReason I_UtilitiesBillingOrder _SuppressedUtilsBillgReason
_UtilsContrSpcfcBdgtBillgCyc I_UtilitiesContract _UtilsContrSpcfcBdgtBillgCyc
_UtilsAccountDetnCode I_UtilitiesContract _UtilsAccountDetnCode
_UtilsBillgOutsortingGroup I_UtilitiesContract _UtilsBillgOutsortingGroup
_NonBllbleUtilsBillgOrderCntr _NonBllbleUtilsBillgOrderCntr
_UtilsBillgOrdChkBfrBilling _UtilsBillgOrdChkBfrBilling
_UtilsInstIntAndExtPtOfDeliv _UtilsInstIntAndExtPtOfDeliv
@EndUserText.label: 'Utilities Billing Order'
@VDM.viewType: #COMPOSITE
@AbapCatalog.sqlViewName: 'IEINBLLGORDER'
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #('TRANSACTIONAL_DATA')
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.dataClass: #MIXED
@ClientHandling.algorithm: #SESSION_VARIABLE
define view I_UtilsBillingOrder
  as select from    I_UtilitiesBillingOrder        as UtilitiesBillingOrder
    inner join      I_UtilitiesContract            as UtilitiesContract            on UtilitiesContract.UtilitiesInstallation = UtilitiesBillingOrder.UtilitiesInstallation
  /* If the Billing Order is not Periodic Billing related, all fields from the join will be blank */
    left outer join I_UtilitiesPortionScheduleRecd as UtilitiesPortionScheduleRecd on  UtilitiesPortionScheduleRecd.UtilitiesPortion              = UtilitiesBillingOrder.UtilitiesPortion
                                                                                   and UtilitiesPortionScheduleRecd.ScheduledUtilitiesBillingDate = UtilitiesBillingOrder.ScheduledUtilitiesBillingDate
                                                                                   and UtilitiesPortionScheduleRecd.UtilitiesBillingReason        = UtilitiesBillingOrder.UtilitiesBillingReason
    inner join      I_UtilitiesInstallationHist    as UtilitiesInstallationHist    on UtilitiesInstallationHist.UtilitiesInstallation = UtilitiesBillingOrder.UtilitiesInstallation
    inner join      I_ContractAccountPartner       as ContractAccountPartner       on ContractAccountPartner.ContractAccount = UtilitiesContract.ContractAccount
  association [0..1] to I_NonBllbleUtilsBillgOrderCntr as _NonBllbleUtilsBillgOrderCntr on  $projection.UtilitiesInstallation = _NonBllbleUtilsBillgOrderCntr.UtilitiesInstallation
                                                                                        and $projection.UtilitiesContract     = _NonBllbleUtilsBillgOrderCntr.UtilitiesContract
  association [1..1] to I_UtilsBillgOrdChkBfrBilling   as _UtilsBillgOrdChkBfrBilling   on  $projection.UtilsBillgOrdChkBfrBilling = _UtilsBillgOrdChkBfrBilling.UtilsBillgOrdChkBfrBilling
  /*Cardinality should be 0..1, but due to ATC checks set to 0..n */
  association [0..*] to I_UtilsInstIntAndExtPtOfDeliv  as _UtilsInstIntAndExtPtOfDeliv  on  $projection.UtilitiesInstallation                         = _UtilsInstIntAndExtPtOfDeliv.UtilitiesInstallation
                                                                                        and _UtilsInstIntAndExtPtOfDeliv.UtilsPoDAllocValidityEndDate = '99991231'
                                                                                        and _UtilsInstIntAndExtPtOfDeliv.UtilsPoDAllocValidityEndTime = '235959'
{
  key UtilitiesContract.UtilitiesContract,

      @ObjectModel.foreignKey.association:'_UtilitiesInstallation'
  key UtilitiesBillingOrder.UtilitiesInstallation,

      @Semantics.businessDate.at: true
  key UtilitiesBillingOrder.ScheduledUtilitiesBillingDate,

      @ObjectModel.foreignKey.association:'_UtilitiesBillingReason'
  key UtilitiesBillingOrder.UtilitiesBillingReason,

  key UtilitiesInstallationHist.UtilsInstHistValidityEndDate,

      @ObjectModel.foreignKey.association: '_ContrAcc'
  key ContractAccountPartner.ContractAccount,

      @ObjectModel.foreignKey.association:'_UtilitiesPortion'
      UtilitiesBillingOrder.UtilitiesPortion,

      UtilitiesBillingOrder.ScheduledMeterReadingDate,

      @ObjectModel.foreignKey.association:'_CompanyCode'
      UtilitiesContract.CompanyCode,

      @ObjectModel.foreignKey.association:'_Division'
      UtilitiesContract.UtilitiesDivision                                                          as Division,

      @ObjectModel.foreignKey.association: '_UtilsBillgBlockReason'
      UtilitiesContract.UtilsBillgBlockReason,

      @ObjectModel.foreignKey.association: '_UtilsBillgUnblockReason'
      UtilitiesContract.UtilsBillgUnblockReason,

      @ObjectModel.foreignKey.association:'_MeterReadingUnit'
      UtilitiesBillingOrder.MeterReadingUnit,

      @ObjectModel.foreignKey.association: '_UtilitiesRateCategory'
      UtilitiesInstallationHist.UtilitiesRateCategory,

      cast(UtilitiesContract.UtilsContrIsBilledManually as e_contrisblldmnlly_vdm preserving type) as UtilsContrIsBilledManually,

      @ObjectModel.foreignKey.association: '_UtilsBillingClass'
      UtilitiesInstallationHist.UtilitiesBillingClass,

      @Semantics.businessDate.to: true
      UtilitiesPortionScheduleRecd.UtilsPortionScheduleRecordDate,

      //      @ObjectModel.foreignKey.association: '_ContrAcc'

      //      ContractAccountPartner.ContractAccount,


      @ObjectModel.foreignKey.association: '_BusinessPartner'
      ContractAccountPartner.BusinessPartner,

      UtilitiesContract.UtilitiesMoveInDate,

      UtilitiesContract.UtilitiesMoveOutDate,

      @ObjectModel.foreignKey.association: '_UtilsBillingOrderStatus'
      UtilitiesBillingOrder.UtilsBillingOrderStatus,

      @ObjectModel.foreignKey.association: '_UtilsBillingOrderIndicator'
      UtilitiesBillingOrder.UtilsBillingOrderIndicator,

      @ObjectModel.foreignKey.association: '_SuppressedUtilsBillgReason'
      UtilitiesBillingOrder.SuppressedUtilsBillgReason,

      UtilitiesBillingOrder.SuppressedUtilsSchedldBillgDte,

      UtilitiesBillingOrder.SuppressedSchedldMtrRdngDte,

      @ObjectModel.foreignKey.association: '_UtilsContrSpcfcBdgtBillgCyc'
      UtilitiesContract.UtilsContrSpcfcBdgtBillgCycle,

      @ObjectModel.foreignKey.association: '_UtilsAccountDetnCode'
      UtilitiesContract.UtilitiesAccountDetnCode,

      @ObjectModel.foreignKey.association: '_UtilsBillgOutsortingGroup'
      UtilitiesContract.UtilsBillgOutsortingReason,

      _UtilsInstIntAndExtPtOfDeliv.UtilsExternalPointOfDelivery,

      @ObjectModel.foreignKey.association: '_UtilsBillgOrdChkBfrBilling'
      case
        when UtilitiesContract.UtilsBillgBlockReason != ''
             and UtilitiesContract.UtilsBillgUnblockReason = ''
              then cast('01' as e_prebllgchkbllgord_vdm) // Contract is Blocked

        when (
                UtilitiesContract.UtilsBillgBlockReason  = ''
                or UtilitiesContract.UtilsBillgUnblockReason != ''
             )
             and _NonBllbleUtilsBillgOrderCntr.UtilitiesInstallation is not null
             and _NonBllbleUtilsBillgOrderCntr.ScheduledUtilitiesBillingDate < UtilitiesBillingOrder.ScheduledUtilitiesBillingDate
             and UtilitiesBillingOrder.UtilsBillingOrderStatus = '2'
              then cast('02' as e_prebllgchkbllgord_vdm) // Non-Billable Order Exist (only for billable)

        when (
                UtilitiesContract.UtilsBillgBlockReason  = ''
                or UtilitiesContract.UtilsBillgUnblockReason != ''
             )
             and
             (
                _NonBllbleUtilsBillgOrderCntr.UtilitiesInstallation is null
                or _NonBllbleUtilsBillgOrderCntr.ScheduledUtilitiesBillingDate >= UtilitiesBillingOrder.ScheduledUtilitiesBillingDate
                or UtilitiesBillingOrder.UtilsBillingOrderStatus != '2'
             )
              then ' ' //No Notes

      end                                                                                          as UtilsBillgOrdChkBfrBilling,

      case
        when (UtilitiesBillingOrder.ScheduledUtilitiesBillingDate >= UtilitiesContract.UtilitiesMoveInDate
         and  UtilitiesBillingOrder.ScheduledUtilitiesBillingDate <= UtilitiesContract.UtilitiesMoveOutDate)
            then 'X'
      end                                                                                          as UtilitiesContractIsActive,

      case
        when (UtilitiesBillingOrder.ScheduledMeterReadingDate >= UtilitiesInstallationHist.UtilsInstHistValidityStartDate
         and  UtilitiesBillingOrder.ScheduledMeterReadingDate <= UtilitiesInstallationHist.UtilsInstHistValidityEndDate)
            then 'X'
      end                                                                                          as UtilsInstTimeSliceIsValid,

      UtilitiesContract.AuthorizationGroup,

      @DefaultAggregation: #SUM
      cast(1 as e_billgords_nmbr_vdm)                                                              as NrOfUtilitiesBillingOrders,

      /* Associations */
      UtilitiesBillingOrder._UtilitiesInstallation,
      UtilitiesBillingOrder._UtilitiesBillingReason,
      UtilitiesBillingOrder._UtilitiesPortion,
      UtilitiesContract._CompanyCode,
      UtilitiesContract._Division,
      UtilitiesContract._UtilsBillgBlockReason,
      UtilitiesContract._UtilsBillgUnblockReason,
      UtilitiesBillingOrder._MeterReadingUnit,
      UtilitiesInstallationHist._UtilitiesRateCategory,
      UtilitiesInstallationHist._UtilsBillingClass,
      ContractAccountPartner._ContrAcc,
      ContractAccountPartner._BusinessPartner,
      UtilitiesBillingOrder._UtilsBillingOrderStatus,
      UtilitiesBillingOrder._UtilsBillingOrderIndicator,
      UtilitiesBillingOrder._SuppressedUtilsBillgReason,
      UtilitiesContract._UtilsContrSpcfcBdgtBillgCyc,
      UtilitiesContract._UtilsAccountDetnCode,
      UtilitiesContract._UtilsBillgOutsortingGroup,
      _NonBllbleUtilsBillgOrderCntr,
      _UtilsBillgOrdChkBfrBilling,
      _UtilsInstIntAndExtPtOfDeliv
}
where
  ContractAccountPartner._RelshpOfBP.CABPIsAccountHolder = 'X'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CONTRACCTPRTNRELSHPTYPE",
"I_CONTRACTACCOUNTPARTNER",
"I_NONBLLBLEUTILSBILLGORDERCNTR",
"I_UTILITIESBILLINGORDER",
"I_UTILITIESCONTRACT",
"I_UTILITIESINSTALLATIONHIST",
"I_UTILITIESPORTIONSCHEDULERECD",
"I_UTILSINSTINTANDEXTPTOFDELIV"
],
"ASSOCIATED":
[
"I_BUSINESSPARTNER",
"I_COMPANYCODE",
"I_CONTRACTACCOUNTHEADER",
"I_DIVISION",
"I_METERREADINGUNIT",
"I_NONBLLBLEUTILSBILLGORDERCNTR",
"I_UTILITIESBILLINGREASON",
"I_UTILITIESINSTALLATION",
"I_UTILITIESPORTION",
"I_UTILITIESRATECATEGORY",
"I_UTILSACCOUNTDETNCODE",
"I_UTILSBILLGBLOCKREASON",
"I_UTILSBILLGORDCHKBFRBILLING",
"I_UTILSBILLGOUTSORTINGGROUP",
"I_UTILSBILLGUNBLOCKREASON",
"I_UTILSBILLINGCLASS",
"I_UTILSBILLINGORDERINDICATOR",
"I_UTILSBILLINGORDERSTATUS",
"I_UTILSCONTRSPCFCBDGTBILLGCYC",
"I_UTILSINSTINTANDEXTPTOFDELIV"
],
"BASE":
[
"I_CONTRACTACCOUNTPARTNER",
"I_UTILITIESBILLINGORDER",
"I_UTILITIESCONTRACT",
"I_UTILITIESINSTALLATIONHIST"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/