@EndUserText.label: 'Locked Contract to Be Invoiced'
@VDM.viewType: #COMPOSITE
@Analytics.dataCategory: #CUBE
@AbapCatalog.sqlViewName: 'IELCONTRTBINVCD'
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #('TRANSACTIONAL_DATA')
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #XXL
@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.allowExtensions:true
define view I_LockedUtilsContrToBeInvcd
as select from I_UtilsContrToBeBlldData as UtilsContrToBeBlldData
left outer join P_SuppressedUtilsBillingOrder as SuppressedUtilsBillingOrder on SuppressedUtilsBillingOrder.UtilitiesContract = UtilsContrToBeBlldData.UtilitiesContract
and SuppressedUtilsBillingOrder.UtilitiesInstallation = UtilsContrToBeBlldData.UtilitiesInstallation
and SuppressedUtilsBillingOrder.SuppressedUtilsSchedldBillgDte = UtilsContrToBeBlldData.ScheduledUtilitiesBillingDate
and SuppressedUtilsBillingOrder.SuppressedUtilsBillgReason = '01'
left outer join I_ActvUtilsCAInvcgLockRsn as ActvUtilsCAInvcgLockRsn on ActvUtilsCAInvcgLockRsn.ContractAccount = UtilsContrToBeBlldData.ContractAccount
left outer join I_ActvUtilsContrInvcgLockRsn as ActvUtilsContrInvcgLockRsn on ActvUtilsContrInvcgLockRsn.CABusinessLockObject = UtilsContrToBeBlldData.UtilitiesContract
inner join I_ContractAccountPartner as ContractAccountPartner on ContractAccountPartner.ContractAccount = UtilsContrToBeBlldData.ContractAccount
association [0..1] to I_CAInvcgLockReason as _CAInvcgLockReason on $projection.CABusinessLockReason = _CAInvcgLockReason.CAInvcgLockReason
{
key UtilsContrToBeBlldData.UtilitiesContract,
@Semantics.businessDate.at: true
key UtilsContrToBeBlldData.ScheduledUtilitiesBillingDate,
@ObjectModel.foreignKey.association: '_UtilitiesPortion'
key UtilsContrToBeBlldData.UtilitiesPortion,
@Semantics.businessDate.at: true
key UtilsContrToBeBlldData.ScheduledMeterReadingDate,
@ObjectModel.foreignKey.association: '_BusinessPartner'
ContractAccountPartner.BusinessPartner,
UtilsContrToBeBlldData.ContractAccount,
@ObjectModel.foreignKey.association: '_CompanyCode'
UtilsContrToBeBlldData.CompanyCode,
@ObjectModel.foreignKey.association: '_Division'
UtilsContrToBeBlldData.Division,
@ObjectModel.foreignKey.association: '_UtilitiesInstallation'
UtilsContrToBeBlldData.UtilitiesInstallation,
@ObjectModel.foreignKey.association: '_UtilsAccountDetnCode'
UtilsContrToBeBlldData.UtilitiesAccountDetnCode,
@ObjectModel.foreignKey.association: '_AcctDetnCode'
cast(ContractAccountPartner.CAAccountDeterminationCode as e_kofiz_ca_vdm preserving type) as CAAccountDeterminationCode,
@ObjectModel.foreignKey.association: '_UtilitiesRateCategory'
UtilsContrToBeBlldData.UtilitiesRateCategory,
@ObjectModel.foreignKey.association: '_UtilsBillingClass'
UtilsContrToBeBlldData.UtilitiesBillingClass,
@ObjectModel.foreignKey.association: '_AltvContrAcc'
cast(ContractAccountPartner.AltvContractAcctForCollvBills as e_collvbillacct_vdm preserving type) as AltvContractAcctForCollvBills,
@ObjectModel.foreignKey.association: '_CAInvcgLockReason'
case
when ActvUtilsCAInvcgLockRsn.CABusinessLockObject is not null
and (
ActvUtilsContrInvcgLockRsn.CABusinessLockObject is not null
or ActvUtilsContrInvcgLockRsn.CABusinessLockObject is null
)
then cast(ActvUtilsCAInvcgLockRsn._UtilsCAInvcgLockRsn.CABusinessLockReason as e_invcglockreason_vdm preserving type) //Contract Account Lock
when ActvUtilsCAInvcgLockRsn.CABusinessLockObject is null
and ActvUtilsContrInvcgLockRsn.CABusinessLockObject is not null
then cast(ActvUtilsContrInvcgLockRsn._UtilsCAInvcgLockRsn.CABusinessLockReason as e_invcglockreason_vdm preserving type) //Contract Lock
end as CABusinessLockReason,
UtilsContrToBeBlldData.AuthorizationGroup,
@DefaultAggregation: #SUM
cast(1 as e_nrofutilscontr_vdm) as NmbrOfUtilsContrLockedForInvcg,
/* Associations */
UtilsContrToBeBlldData._UtilitiesPortion,
ContractAccountPartner._BusinessPartner,
UtilsContrToBeBlldData._CompanyCode,
UtilsContrToBeBlldData._Division,
UtilsContrToBeBlldData._UtilitiesInstallation,
UtilsContrToBeBlldData._UtilsAccountDetnCode,
ContractAccountPartner._AcctDetnCode,
UtilsContrToBeBlldData._UtilitiesRateCategory,
UtilsContrToBeBlldData._UtilsBillingClass,
ContractAccountPartner._AltvContrAcc,
_CAInvcgLockReason
}
where
SuppressedUtilsBillingOrder.UtilitiesContract is null //Not Suppressed
and UtilsContrToBeBlldData.UtilitiesContractIsActive = 'X' //Contract is Active
and UtilsContrToBeBlldData.UtilsInstTimeSliceIsValid = 'X' //Installation Time Slice is Valid
and ContractAccountPartner._RelshpOfBP.CABPIsAccountHolder = 'X' //Acocunt Holder
and(
ActvUtilsCAInvcgLockRsn.CABusinessLockObject is not null //Contract Account lock is not empty OR
or ActvUtilsContrInvcgLockRsn.CABusinessLockObject is not null //Contract lock is not empty
)