@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: 'PSOFAPROCF10'
define view P_SOFAProcFlow10
as select from P_SOFAProcFlow00 as SalesDocument --> Level 0
inner join I_SDDocumentProcessFlow as Level1 --> Level 1
on SalesDocument.SalesDocument = Level1.PrecedingDocument
and (
Level1.SubsequentDocumentCategory = 'J' or --> Delivery
Level1.SubsequentDocumentCategory = 'T' or --> Returns Delivery
Level1.SubsequentDocumentCategory = 'M' or --> Invoice
Level1.SubsequentDocumentCategory = 'O' or --> Credit memo
Level1.SubsequentDocumentCategory = 'P' or --> Debit memo
Level1.SubsequentDocumentCategory = 'U' or --> Pro Forma Invoice
Level1.SubsequentDocumentCategory = 'L' ) --> Debit Memo Request
left outer to one join
I_BillingDocument as BillingDocument
on Level1.SubsequentDocument = BillingDocument.BillingDocument and
Level1.SubsequentDocumentCategory = BillingDocument.SDDocumentCategory
{
key SalesDocument,
key SalesDocument.SDDocumentCategory,
key Level1.SubsequentDocument as Level1Document,
key Level1.SubsequentDocumentItem as Level1DocumentItem,
key Level1.SubsequentDocumentCategory as Level1DocumentCategory,
// double entries for credit debit memos should be no problem
SalesDocumentType,
//Organization
SalesDocument.SalesOrganization,
SalesDocument.DistributionChannel,
SalesDocument.OrganizationDivision,
SalesDocument.OverallSDProcessStatus,
SalesDocument.OverallTotalDeliveryStatus,
SalesDocument.OverallOrdReltdBillgStatus,
//Misc
SalesDocument.RequestedDeliveryDate,
--OverallSDProcessStatus,
SalesDocument.SalesDocumentDate,
SalesDocument.SalesGroup,
SalesDocument.SalesOffice,
SalesDocument.SoldToParty,
SalesDocument.PurchaseOrderByCustomer,
case
when
BillingDocument.BillingDocumentIsCancelled = 'X'
then 'X'
else ''
end as BillingDocumentIsCancelled
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_BILLINGDOCUMENT",
"I_SDDOCUMENTPROCESSFLOW",
"P_SOFAPROCFLOW00"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/