I_OpenUtilsBillgDocAndOrd

DDL: I_OPENUTILSBILLGDOCANDORD SQL: IEOPENBILLGS Type: view COMPOSITE

Open Utilities Billing Document and Order

I_OpenUtilsBillgDocAndOrd is a Composite CDS View (Cube) that provides data about "Open Utilities Billing Document and Order" in SAP S/4HANA. It reads from 3 data sources (I_ContractAccountPartner, I_MtrRsnCorrespgToBillgRsn, I_OpenUtilsBillgDocAndOrdData) and exposes 43 fields with key fields UtilitiesContract, UtilitiesInstallation, ScheduledUtilitiesBillingDate, UtilitiesBillingReason, UtilsInstHistValidityEndDate. It has 5 associations to related views.

Data Sources (3)

SourceAliasJoin Type
I_ContractAccountPartner ContractAccountPartner inner
I_MtrRsnCorrespgToBillgRsn MtrRsnCorrespgToBillgRsn inner
I_OpenUtilsBillgDocAndOrdData OpenUtilsBillgDocAndOrdData from

Associations (5)

CardinalityTargetAliasCondition
[0..*] I_UtilsInstIntAndExtPtOfDeliv _UtilsInstIntAndExtPtOfDeliv $projection.UtilitiesInstallation = _UtilsInstIntAndExtPtOfDeliv.UtilitiesInstallation and _UtilsInstIntAndExtPtOfDeliv.UtilsPoDAllocValidityEndDate = '99991231' and _UtilsInstIntAndExtPtOfDeliv.UtilsPoDAllocValidityEndTime = '235959'
[0..1] I_ImplsblMtrRdngResultsCntr _ImplsblMtrRdngResultsCntr $projection.UtilitiesInstallation = _ImplsblMtrRdngResultsCntr.UtilitiesInstallation and $projection.MeterReadingReason = _ImplsblMtrRdngResultsCntr.MeterReadingReason and $projection.ScheduledUtilitiesBillingDate = _ImplsblMtrRdngResultsCntr.ScheduledUtilitiesBillingDate
[0..1] I_MissingMtrRdngResultsCntr _MissingMtrRdngResultsCntr $projection.UtilitiesInstallation = _MissingMtrRdngResultsCntr.UtilitiesInstallation and $projection.MeterReadingReason = _MissingMtrRdngResultsCntr.MeterReadingReason and $projection.ScheduledUtilitiesBillingDate = _MissingMtrRdngResultsCntr.ScheduledUtilitiesBillingDate and $projection.ScheduledMeterReadingDate = _MissingMtrRdngResultsCntr.ScheduledMeterReadingDate and $projection.MeterReadingUnit = _MissingMtrRdngResultsCntr.MeterReadingUnit
[1..1] I_OpnUtilsBillgDocAndOrdType _OpnUtilsBillgDocAndOrdType $projection.OpnUtilsBillgDocAndOrdType = _OpnUtilsBillgDocAndOrdType.OpnUtilsBillgDocAndOrdType
[1..1] I_MeterReadingStsGrp _MeterReadingStsGrp $projection.MeterReadingStatusGroup = _MeterReadingStsGrp.MeterReadingStatusGroup

Annotations (10)

NameValueLevelField
EndUserText.label Open Utilities Billing Document and Order view
VDM.viewType #COMPOSITE view
Analytics.dataCategory #CUBE view
AbapCatalog.sqlViewName IEOPENBILLGS 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
Metadata.allowExtensions true view

Fields (43)

KeyFieldSource TableSource FieldDescription
KEY UtilitiesContract I_OpenUtilsBillgDocAndOrdData UtilitiesContract
KEY UtilitiesInstallation I_OpenUtilsBillgDocAndOrdData UtilitiesInstallation
KEY ScheduledUtilitiesBillingDate I_OpenUtilsBillgDocAndOrdData ScheduledUtilitiesBillingDate
KEY UtilitiesBillingReason I_OpenUtilsBillgDocAndOrdData UtilitiesBillingReason
KEY UtilsInstHistValidityEndDate I_OpenUtilsBillgDocAndOrdData UtilsInstHistValidityEndDate
KEY ContractAccount I_ContractAccountPartner ContractAccount
KEY BusinessPartner I_ContractAccountPartner BusinessPartner
UtilitiesPortion I_OpenUtilsBillgDocAndOrdData UtilitiesPortion
ScheduledMeterReadingDate I_OpenUtilsBillgDocAndOrdData ScheduledMeterReadingDate
CompanyCode I_OpenUtilsBillgDocAndOrdData CompanyCode
Division I_OpenUtilsBillgDocAndOrdData Division
UtilsBillgBlockReason I_OpenUtilsBillgDocAndOrdData UtilsBillgBlockReason
UtilsBillgUnblockReason I_OpenUtilsBillgDocAndOrdData UtilsBillgUnblockReason
MeterReadingUnit I_OpenUtilsBillgDocAndOrdData MeterReadingUnit
UtilitiesRateCategory I_OpenUtilsBillgDocAndOrdData UtilitiesRateCategory
UtilitiesBillingClass I_OpenUtilsBillgDocAndOrdData UtilitiesBillingClass
UtilsPortionScheduleRecordDate I_OpenUtilsBillgDocAndOrdData UtilsPortionScheduleRecordDate
MeterReadingReason I_MtrRsnCorrespgToBillgRsn MeterReadingReason
UtilitiesMoveInDate I_OpenUtilsBillgDocAndOrdData UtilitiesMoveInDate
UtilitiesMoveOutDate I_OpenUtilsBillgDocAndOrdData UtilitiesMoveOutDate
UtilitiesAccountDetnCode I_OpenUtilsBillgDocAndOrdData UtilitiesAccountDetnCode
OpnUtilsBillgDocAndOrdType
AuthorizationGroup I_OpenUtilsBillgDocAndOrdData AuthorizationGroup
NrOfOpenUtilsBillgDocsAndOrds
_UtilitiesInstallation I_OpenUtilsBillgDocAndOrdData _UtilitiesInstallation
_UtilitiesBillingReason I_OpenUtilsBillgDocAndOrdData _UtilitiesBillingReason
_UtilitiesPortion I_OpenUtilsBillgDocAndOrdData _UtilitiesPortion
_CompanyCode I_OpenUtilsBillgDocAndOrdData _CompanyCode
_Division I_OpenUtilsBillgDocAndOrdData _Division
_UtilsBillgBlockReason I_OpenUtilsBillgDocAndOrdData _UtilsBillgBlockReason
_UtilsBillgUnblockReason I_OpenUtilsBillgDocAndOrdData _UtilsBillgUnblockReason
_MeterReadingUnit I_OpenUtilsBillgDocAndOrdData _MeterReadingUnit
_UtilitiesRateCategory I_OpenUtilsBillgDocAndOrdData _UtilitiesRateCategory
_UtilsBillingClass I_OpenUtilsBillgDocAndOrdData _UtilsBillingClass
_MeterReadingReason I_MtrRsnCorrespgToBillgRsn _MeterReadingReason
_UtilsAccountDetnCode I_OpenUtilsBillgDocAndOrdData _UtilsAccountDetnCode
_ContrAcc I_ContractAccountPartner _ContrAcc
_BusinessPartner I_ContractAccountPartner _BusinessPartner
_UtilsInstIntAndExtPtOfDeliv _UtilsInstIntAndExtPtOfDeliv
_ImplsblMtrRdngResultsCntr _ImplsblMtrRdngResultsCntr
_MissingMtrRdngResultsCntr _MissingMtrRdngResultsCntr
_OpnUtilsBillgDocAndOrdType _OpnUtilsBillgDocAndOrdType
_MeterReadingStsGrp _MeterReadingStsGrp
@EndUserText.label: 'Open Utilities Billing Document and Order'
@VDM.viewType: #COMPOSITE
@Analytics.dataCategory: #CUBE
@AbapCatalog.sqlViewName: 'IEOPENBILLGS'
@AccessControl.authorizationCheck: #CHECK
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.dataClass: #MIXED
@AccessControl.personalData.blocking: #('TRANSACTIONAL_DATA')
@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.allowExtensions:true
define view I_OpenUtilsBillgDocAndOrd
  as select from I_OpenUtilsBillgDocAndOrdData as OpenUtilsBillgDocAndOrdData
    inner join   I_ContractAccountPartner      as ContractAccountPartner   on ContractAccountPartner.ContractAccount = OpenUtilsBillgDocAndOrdData.ContractAccount
    inner join   I_MtrRsnCorrespgToBillgRsn    as MtrRsnCorrespgToBillgRsn on OpenUtilsBillgDocAndOrdData.UtilitiesBillingReason = MtrRsnCorrespgToBillgRsn.UtilitiesBillingReason
  // Cardinality is 0..1 but due to ATC checks is set to 0..*

  association [0..*] to I_UtilsInstIntAndExtPtOfDeliv as _UtilsInstIntAndExtPtOfDeliv on  $projection.UtilitiesInstallation                         = _UtilsInstIntAndExtPtOfDeliv.UtilitiesInstallation
                                                                                      and _UtilsInstIntAndExtPtOfDeliv.UtilsPoDAllocValidityEndDate = '99991231'
                                                                                      and _UtilsInstIntAndExtPtOfDeliv.UtilsPoDAllocValidityEndTime = '235959'
  //Interim Solution because of performance problems: access with timestamp (31.12.9999, 23:59) instead of move out date

  // and (

  //        (

  //           $projection.UtilitiesMoveOutDate <  _UtilsInstIntAndExtPtOfDeliv.UtilsPoDAllocValidityEndDate and

  //           $projection.UtilitiesMoveOutDate >= _UtilsInstIntAndExtPtOfDeliv.UtilsPoDAllocValidityStartDate

  //        ) or

  //        (

  //           $projection.UtilitiesMoveOutDate = _UtilsInstIntAndExtPtOfDeliv.UtilsPoDAllocValidityEndDate and

  //           _UtilsInstIntAndExtPtOfDeliv.UtilsPoDAllocValidityEndTime ='235959'

  //        )

  //)

  association [0..1] to I_ImplsblMtrRdngResultsCntr   as _ImplsblMtrRdngResultsCntr   on  $projection.UtilitiesInstallation         = _ImplsblMtrRdngResultsCntr.UtilitiesInstallation
                                                                                      and $projection.MeterReadingReason            = _ImplsblMtrRdngResultsCntr.MeterReadingReason
                                                                                      and $projection.ScheduledUtilitiesBillingDate = _ImplsblMtrRdngResultsCntr.ScheduledUtilitiesBillingDate
  association [0..1] to I_MissingMtrRdngResultsCntr   as _MissingMtrRdngResultsCntr   on  $projection.UtilitiesInstallation         = _MissingMtrRdngResultsCntr.UtilitiesInstallation
                                                                                      and $projection.MeterReadingReason            = _MissingMtrRdngResultsCntr.MeterReadingReason
                                                                                      and $projection.ScheduledUtilitiesBillingDate = _MissingMtrRdngResultsCntr.ScheduledUtilitiesBillingDate
                                                                                      and $projection.ScheduledMeterReadingDate     = _MissingMtrRdngResultsCntr.ScheduledMeterReadingDate
                                                                                      and $projection.MeterReadingUnit              = _MissingMtrRdngResultsCntr.MeterReadingUnit
  association [1..1] to I_OpnUtilsBillgDocAndOrdType  as _OpnUtilsBillgDocAndOrdType  on  $projection.OpnUtilsBillgDocAndOrdType = _OpnUtilsBillgDocAndOrdType.OpnUtilsBillgDocAndOrdType
  association [1..1] to I_MeterReadingStsGrp          as _MeterReadingStsGrp          on  $projection.MeterReadingStatusGroup = _MeterReadingStsGrp.MeterReadingStatusGroup

{
  key OpenUtilsBillgDocAndOrdData.UtilitiesContract,

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

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

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

  key OpenUtilsBillgDocAndOrdData.UtilsInstHistValidityEndDate,

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

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

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

      @Semantics.businessDate.at: true
      OpenUtilsBillgDocAndOrdData.ScheduledMeterReadingDate,

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

      @ObjectModel.foreignKey.association:'_Division'
      OpenUtilsBillgDocAndOrdData.Division,

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

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

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

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

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

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

      @ObjectModel.foreignKey.association: '_MeterReadingReason'
      MtrRsnCorrespgToBillgRsn.MeterReadingReason,

      OpenUtilsBillgDocAndOrdData.UtilitiesMoveInDate,

      OpenUtilsBillgDocAndOrdData.UtilitiesMoveOutDate,

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

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

      //      ContractAccountPartner.ContractAccount,


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

      //      ContractAccountPartner.BusinessPartner,


      @ObjectModel.foreignKey.association: '_OpnUtilsBillgDocAndOrdType'
      cast ( OpenUtilsBillgDocAndOrdData.OpnUtilsBillgDocAndOrdType as e_opnbllgdocandord_vdm ) as OpnUtilsBillgDocAndOrdType,

      @ObjectModel.foreignKey.association: '_MeterReadingStsGrp'
      case
        when OpenUtilsBillgDocAndOrdData.OpnUtilsBillgDocAndOrdType = '01'
          then
            case
              when (_MissingMtrRdngResultsCntr.UtilitiesInstallation is not null and _ImplsblMtrRdngResultsCntr.UtilitiesInstallation is null)
                 then cast( '06' as e_mrstatus_group_vdm )  //Missing

              when (_MissingMtrRdngResultsCntr.UtilitiesInstallation is not null and _ImplsblMtrRdngResultsCntr.UtilitiesInstallation is not null)
                 then cast( '07' as e_mrstatus_group_vdm )  //Missing and Implausible

              when (_MissingMtrRdngResultsCntr.UtilitiesInstallation is null and _ImplsblMtrRdngResultsCntr.UtilitiesInstallation is not null)
                 then cast( '08' as e_mrstatus_group_vdm )  //Implausible

            end
        when OpenUtilsBillgDocAndOrdData.OpnUtilsBillgDocAndOrdType <> '01'
          then cast( '09' as e_mrstatus_group_vdm )  //Plausible

      end                                                                                       as MeterReadingStatusGroup,

      case
        when OpnUtilsBillgDocAndOrdType = '01' and _ImplsblMtrRdngResultsCntr.NmbrOfImplausibleMtrRdngRslts is not null
             then _ImplsblMtrRdngResultsCntr.NmbrOfImplausibleMtrRdngRslts
        when OpnUtilsBillgDocAndOrdType = '01' and _ImplsblMtrRdngResultsCntr.NmbrOfImplausibleMtrRdngRslts is null
             then 0
      end                                                                                       as NmbrOfImplausibleMtrRdngRslts,

      OpenUtilsBillgDocAndOrdData.AuthorizationGroup,

      @DefaultAggregation: #SUM
      cast(1 as e_opbbillgdocsandords_nmbr_vdm)                                                 as NrOfOpenUtilsBillgDocsAndOrds,

      @Aggregation: { default: #COUNT_DISTINCT, referenceElement:  [ 'UtilitiesContract' ] }
      case
        when (OpenUtilsBillgDocAndOrdData.UtilsBillgBlockReason <> '' and OpenUtilsBillgDocAndOrdData.UtilsBillgUnblockReason = '')
          then cast(1 as e_nrofutilscontr_vdm)
      end                                                                                       as NmbrOfUtilsContrBlkdForBillg,


      /* Associations */
      OpenUtilsBillgDocAndOrdData._UtilitiesInstallation,
      OpenUtilsBillgDocAndOrdData._UtilitiesBillingReason,
      OpenUtilsBillgDocAndOrdData._UtilitiesPortion,
      OpenUtilsBillgDocAndOrdData._CompanyCode,
      OpenUtilsBillgDocAndOrdData._Division,
      OpenUtilsBillgDocAndOrdData._UtilsBillgBlockReason,
      OpenUtilsBillgDocAndOrdData._UtilsBillgUnblockReason,
      OpenUtilsBillgDocAndOrdData._MeterReadingUnit,
      OpenUtilsBillgDocAndOrdData._UtilitiesRateCategory,
      OpenUtilsBillgDocAndOrdData._UtilsBillingClass,
      MtrRsnCorrespgToBillgRsn._MeterReadingReason,
      OpenUtilsBillgDocAndOrdData._UtilsAccountDetnCode,
      ContractAccountPartner._ContrAcc,
      ContractAccountPartner._BusinessPartner,
      _UtilsInstIntAndExtPtOfDeliv,
      _ImplsblMtrRdngResultsCntr,
      _MissingMtrRdngResultsCntr,
      _OpnUtilsBillgDocAndOrdType,
      _MeterReadingStsGrp
}
where
      OpenUtilsBillgDocAndOrdData.UtilitiesContractIsActive  = 'X' //Contract is Active

  and OpenUtilsBillgDocAndOrdData.UtilsInstTimeSliceIsValid  = 'X' //Installation Time Slice is Valid

  and ContractAccountPartner._RelshpOfBP.CABPIsAccountHolder = 'X' //Business Partner is Contract Account Holder

/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CONTRACCTPRTNRELSHPTYPE",
"I_CONTRACTACCOUNTPARTNER",
"I_IMPLSBLMTRRDNGRESULTSCNTR",
"I_MISSINGMTRRDNGRESULTSCNTR",
"I_MTRRSNCORRESPGTOBILLGRSN",
"I_OPENUTILSBILLGDOCANDORDDATA"
],
"ASSOCIATED":
[
"I_BUSINESSPARTNER",
"I_COMPANYCODE",
"I_CONTRACTACCOUNTHEADER",
"I_DIVISION",
"I_IMPLSBLMTRRDNGRESULTSCNTR",
"I_METERREADINGREASON",
"I_METERREADINGSTSGRP",
"I_METERREADINGUNIT",
"I_MISSINGMTRRDNGRESULTSCNTR",
"I_OPNUTILSBILLGDOCANDORDTYPE",
"I_UTILITIESBILLINGREASON",
"I_UTILITIESINSTALLATION",
"I_UTILITIESPORTION",
"I_UTILITIESRATECATEGORY",
"I_UTILSACCOUNTDETNCODE",
"I_UTILSBILLGBLOCKREASON",
"I_UTILSBILLGUNBLOCKREASON",
"I_UTILSBILLINGCLASS",
"I_UTILSINSTINTANDEXTPTOFDELIV"
],
"BASE":
[
"I_CONTRACTACCOUNTPARTNER",
"I_MTRRSNCORRESPGTOBILLGRSN",
"I_OPENUTILSBILLGDOCANDORDDATA"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/