@AbapCatalog: { sqlViewName: 'PCOLLSP2PDR',
compiler: { compareFilter: true },
preserveKey: true }
@AccessControl: { authorizationCheck: #NOT_REQUIRED,
personalData: { blocking: #BLOCKED_DATA_EXCLUDED },
privilegedAssociations: [ '_DraftAdministrativeData' ] }
@VDM: { viewType: #COMPOSITE,
private: true }
@ClientHandling: { algorithm: #SESSION_VARIABLE }
@ObjectModel: { usageType: { serviceQuality: #A,
sizeCategory: #L,
dataClass: #TRANSACTIONAL },
representativeKey: 'PromiseToPayUUID' }
define view P_CollsPromiseToPayDraft
as select from I_CollsPromiseToPay
// VDM Associations
// Case Attributes
association [0..1] to I_CaseAttribute as _CaseAttribute on $projection.PromiseToPayUUID = _CaseAttribute.CaseUniqueID
// CompanyCode
association [0..1] to I_CompanyCode as _CompanyCode on $projection.CompanyCode = _CompanyCode.CompanyCode
// Customer
association [0..1] to I_Customer as _Customer on $projection.Customer = _Customer.Customer
// Country
association [0..1] to I_Country as _Country on $projection.ContactPersonFaxCountry = _Country.Country
// Promise to Pay Status
association [0..1] to I_CollsPromiseToPayStatus as _CollsPromiseToPayStatus on $projection.PromiseToPayStatus = _CollsPromiseToPayStatus.PromiseToPayStatus
// Created by Contact Card
association [0..1] to I_UserContactCard as _CreatedByContactCard on $projection.CaseCreatedBy = _CreatedByContactCard.ContactCardID
// Changed by Contact Card
association [0..1] to I_UserContactCard as _ChangedByContactCard on $projection.CaseLastChangedBy = _ChangedByContactCard.ContactCardID
// Closed by Contact Card
association [0..1] to I_UserContactCard as _ClosedByContactCard on $projection.CaseClosedBy = _ClosedByContactCard.ContactCardID
// Currency
association [0..1] to I_Currency as _Currency on $projection.Currency = _Currency.Currency
// Draft
association [0..1] to I_CollsPromiseToPayDraft as _PromiseToPayDraft on $projection.PromiseToPayUUID = _PromiseToPayDraft.PromiseToPayUUID
// Draft Admin Table
association [0..1] to I_DraftAdministrativeData as _DraftAdministrativeData on $projection.draftadministrativedatauuid = _DraftAdministrativeData.DraftUUID
and _DraftAdministrativeData.DraftEntityType = 'R_COLLSPROMISETOPAYTP'
{
// VDM Fields
key PromiseToPayUUID,
_PromiseToPayDraft.DraftUUID as DraftUUID,
case
when _PromiseToPayDraft.DraftUUID is null
then CompanyCode
else _PromiseToPayDraft.CompanyCode
end as CompanyCode,
case
when _PromiseToPayDraft.DraftUUID is null
then Customer
else _PromiseToPayDraft.Customer
end as Customer,
case
when _PromiseToPayDraft.DraftUUID is null
then ObjectType
else _PromiseToPayDraft.ObjectType
end as ObjectType,
case
when _PromiseToPayDraft.DraftUUID is null
then LinkedInvoiceKey
else _PromiseToPayDraft.LinkedInvoiceKey
end as LinkedInvoiceKey,
case
when _PromiseToPayDraft.DraftUUID is null
then PromisedAmount
else _PromiseToPayDraft.PromisedAmount
end as PromisedAmount,
case
when _PromiseToPayDraft.DraftUUID is null
then PaidAmount
else _PromiseToPayDraft.PaidAmount
end as PaidAmount,
case
when _PromiseToPayDraft.DraftUUID is null
then Currency
else _PromiseToPayDraft.Currency
end as Currency,
case
when _PromiseToPayDraft.DraftUUID is null
then DueDate
else _PromiseToPayDraft.DueDate
end as DueDate,
case
when _PromiseToPayDraft.DraftUUID is null
then PromiseToPayDate
else _PromiseToPayDraft.PromiseToPayDate
end as PromiseToPayDate,
case
when _PromiseToPayDraft.DraftUUID is null
then LastPaymentDate
else _PromiseToPayDraft.LastPaymentDate
end as LastPaymentDate,
case
when _PromiseToPayDraft.DraftUUID is null
then PromiseToPayStatus
else _PromiseToPayDraft.PromiseToPayStatus
end as PromiseToPayStatus,
case
when _PromiseToPayDraft.DraftUUID is null
then PromiseToPayLevel
else _PromiseToPayDraft.PromiseToPayLevel
end as PromiseToPayLevel,
case
when _PromiseToPayDraft.DraftUUID is null
then PromiseToPayGivenByPersonName
else _PromiseToPayDraft.PromiseToPayGivenByPersonName
end as PromiseToPayGivenByPersonName,
case
when _PromiseToPayDraft.DraftUUID is null
then ContactPersonEmailAddress
else _PromiseToPayDraft.ContactPersonEmailAddress
end as ContactPersonEmailAddress,
case
when _PromiseToPayDraft.DraftUUID is null
then ContactPersonPhoneNumber
else _PromiseToPayDraft.ContactPersonPhoneNumber
end as ContactPersonPhoneNumber,
case
when _PromiseToPayDraft.DraftUUID is null
then ContactPersonFaxNumber
else _PromiseToPayDraft.ContactPersonFaxNumber
end as ContactPersonFaxNumber,
case
when _PromiseToPayDraft.DraftUUID is null
then ContactPersonFaxCountry
else _PromiseToPayDraft.ContactPersonFaxCountry
end as ContactPersonFaxCountry,
case
when _PromiseToPayDraft.DraftUUID is null
then ContactPerson
else _PromiseToPayDraft.ContactPerson
end as ContactPerson,
case
when _PromiseToPayDraft.DraftUUID is null
then NumberOfInstallments
else _PromiseToPayDraft.NumberOfInstallments
end as NumberOfInstallments,
case
when _PromiseToPayDraft.DraftUUID is null
then PaidOnScheduleAmount
else _PromiseToPayDraft.PaidOnScheduleAmount
end as PaidOnScheduleAmount,
case
when _PromiseToPayDraft.DraftUUID is null
then PaidOffScheduleAmount
else _PromiseToPayDraft.PaidOffScheduleAmount
end as PaidOffScheduleAmount,
case
when _PromiseToPayDraft.DraftUUID is null
then NextInstallmentDueDate
else _PromiseToPayDraft.NextInstallmentDueDate
end as NextInstallmentDueDate,
case
when _PromiseToPayDraft.DraftUUID is null
then NextInstallmentAmount
else _PromiseToPayDraft.NextInstallmentAmount
end as NextInstallmentAmount,
case
when _PromiseToPayDraft.DraftUUID is null
then Prms2PToInvoiceGroupRefUUID
else _PromiseToPayDraft.Prms2PToInvoiceGroupRefUUID
end as Prms2PToInvoiceGroupRefUUID,
case
when _PromiseToPayDraft.DraftUUID is null
then CaseID
else _PromiseToPayDraft.CaseID
end as CaseID,
case
when _PromiseToPayDraft.DraftUUID is null
then CaseExternalReference
else _PromiseToPayDraft.CaseExternalReference
end as CaseExternalReference,
case
when _PromiseToPayDraft.DraftUUID is null
then CaseCreatedBy
else _PromiseToPayDraft.CaseCreatedBy
end as CaseCreatedBy,
case
when _PromiseToPayDraft.DraftUUID is null
then CaseCreatedOn
else _PromiseToPayDraft.CaseCreatedOn
end as CaseCreatedOn,
case
when _PromiseToPayDraft.DraftUUID is null
then CaseLastChangedBy
else _PromiseToPayDraft.CaseLastChangedBy
end as CaseLastChangedBy,
case
when _PromiseToPayDraft.DraftUUID is null
then CaseLastChangedOn
else _PromiseToPayDraft.CaseLastChangedOn
end as CaseLastChangedOn,
case
when _PromiseToPayDraft.DraftUUID is null
then CaseClosedBy
else _PromiseToPayDraft.CaseClosedBy
end as CaseClosedBy,
case
when _PromiseToPayDraft.DraftUUID is null
then CaseClosedTime
else _PromiseToPayDraft.CaseClosedTime
end as CaseClosedTime,
cast( case
when _PromiseToPayDraft.DraftUUID is null
then 'X'
else ''
end as boolean ) as IsActiveEntity,
cast ( 'X' as boolean ) as HasActiveEntity,
cast( case
when _PromiseToPayDraft.DraftUUID is null
then 0
else _PromiseToPayDraft.DraftCreationDateTime
end as sdraft_created_at ) as DraftCreationDateTime,
cast( case
when _PromiseToPayDraft.DraftUUID is null
then 0
else _PromiseToPayDraft.DraftLastChangedDateTime
end as sdraft_last_changed_at ) as DraftLastChangedDateTime,
_PromiseToPayDraft.DraftAdministrativeDataUUID,
_CaseAttribute.CaseType,
case
when _PromiseToPayDraft.DraftUUID is null
then IsCleared
else _PromiseToPayDraft.IsCleared
end as IsCleared,
// Exposed Associations
_CaseAttribute,
_ChangedByContactCard,
_ClosedByContactCard,
_CollsPromiseToPayStatus,
_CompanyCode,
_Country,
_CreatedByContactCard,
_Currency,
_Customer,
_DraftAdministrativeData
}
union all select from I_CollsPromiseToPayDraft
// Draft Admin Table
association [0..1] to I_DraftAdministrativeData as _DraftAdministrativeData on $projection.DraftAdministrativeDataUUID = _DraftAdministrativeData.DraftUUID
and _DraftAdministrativeData.DraftEntityType = 'R_COLLSPROMISETOPAYTP'
{
// VDM Fields
key PromiseToPayUUID,
DraftUUID,
CompanyCode,
Customer,
ObjectType,
LinkedInvoiceKey,
PromisedAmount,
PaidAmount,
Currency,
DueDate,
PromiseToPayDate,
LastPaymentDate,
PromiseToPayStatus,
PromiseToPayLevel,
PromiseToPayGivenByPersonName,
ContactPersonEmailAddress,
ContactPersonPhoneNumber,
ContactPersonFaxNumber,
ContactPersonFaxCountry,
ContactPerson,
NumberOfInstallments,
PaidOnScheduleAmount,
PaidOffScheduleAmount,
NextInstallmentDueDate,
NextInstallmentAmount,
Prms2PToInvoiceGroupRefUUID,
CaseID,
CaseExternalReference,
CaseCreatedBy,
CaseCreatedOn,
CaseLastChangedBy,
CaseLastChangedOn,
CaseClosedBy,
CaseClosedTime,
'' as IsActiveEntity,
HasActiveEntity,
DraftCreationDateTime,
DraftLastChangedDateTime,
DraftAdministrativeDataUUID,
CaseType,
IsCleared,
// Exposed Associations
_CaseAttribute,
_ChangedByContactCard,
_ClosedByContactCard,
_CollsPromiseToPayStatus,
_CompanyCode,
_Country,
_CreatedByContactCard,
_Currency,
_Customer,
_DraftAdministrativeData
}
where
HasActiveEntity <> 'X'
and _DraftAdministrativeData.DraftIsCreatedByMe = 'X'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CASEATTRIBUTE",
"I_COLLSPROMISETOPAY",
"I_COLLSPROMISETOPAYDRAFT",
"I_DRAFTADMINISTRATIVEDATA"
],
"ASSOCIATED":
[
"I_CASEATTRIBUTE",
"I_COLLSPROMISETOPAYDRAFT",
"I_COLLSPROMISETOPAYSTATUS",
"I_COMPANYCODE",
"I_COUNTRY",
"I_CURRENCY",
"I_CUSTOMER",
"I_DRAFTADMINISTRATIVEDATA",
"I_USERCONTACTCARD"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/