@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #XL
@VDM.private: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #COMPOSITE
@AbapCatalog.sqlViewName: 'PSOFAPROCF20'
define view P_SOFAProcFlow20
as select from P_SOFAProcFlow10 as Level1
inner join I_SDDocumentProcessFlow as Level2
on
Level1.Level1Document = Level2.PrecedingDocument
and Level1.Level1DocumentCategory = Level2.PrecedingDocumentCategory
and Level1.Level1DocumentItem = Level2.PrecedingDocumentItem
and ( Level2.SubsequentDocumentCategory = 'M' or --> Invoice
Level2.SubsequentDocumentCategory = 'U' or --> Pro Forma Invoice
Level2.SubsequentDocumentCategory = 'P' ) --> Debit Memo
left outer to one join
I_BillingDocument as BillingDocument
on Level2.SubsequentDocument = BillingDocument.BillingDocument and
Level2.SubsequentDocumentCategory = BillingDocument.SDDocumentCategory
{
//SalesOrder
key SalesDocument,
key Level1.SDDocumentCategory,
key Level1Document,
key Level1DocumentItem,
key Level1DocumentCategory,
key Level2.SubsequentDocument as Level2Document,
key Level2.SubsequentDocumentItem as Level2DocumentItem,
key Level2.SubsequentDocumentCategory as Level2DocumentCategory,
Level1.SalesDocumentType,
//Organization
Level1.SalesOrganization,
Level1.DistributionChannel,
Level1.OrganizationDivision,
Level1.OverallSDProcessStatus,
Level1.OverallTotalDeliveryStatus,
Level1.OverallOrdReltdBillgStatus,
//Misc
Level1.RequestedDeliveryDate,
--OverallSDProcessStatus,
Level1.SalesDocumentDate,
Level1.SalesGroup,
Level1.SalesOffice,
Level1.SoldToParty,
Level1.PurchaseOrderByCustomer,
case
when
BillingDocument.BillingDocumentIsCancelled = 'X'
then 'X'
else ''
end as BillingDocumentIsCancelled
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_BILLINGDOCUMENT",
"I_SDDOCUMENTPROCESSFLOW",
"P_SOFAPROCFLOW10"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/