@AbapCatalog: {
sqlViewName: 'PSDSALESFORPROJ',
preserveKey: true ,
compiler.compareFilter: true
}
@AccessControl: {
authorizationCheck: #NOT_REQUIRED,
personalData.blocking: #NOT_REQUIRED
}
@ClientHandling.algorithm: #SESSION_VARIABLE
//@EndUserText.label : 'Billing Receivables - Sales generated in Projects'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType: {
serviceQuality: #B,
sizeCategory: #L,
dataClass: #TRANSACTIONAL
}
@VDM: {
private: true ,
lifecycle.contract.type: #NONE,
viewType: #COMPOSITE
}
define view P_SalesDocumentsForProjects
as select from I_SalesDocumentItem as A
inner join I_WBSElementBasicData as B on A.WBSElement = B.WBSElementInternalID
{
/* SDDocumentCategory = 'C' => sales order
SDDocumentCategory = 'L => debit memo request
SDDocumentRejectionStatus = 'C' => rejected */
case when A.SDDocumentCategory = 'C' then A.SalesDocument
when A.ReferenceSDDocumentCategory = 'C' then A.ReferenceSDDocument
else '' end as SalesOrder,
case when A.SDDocumentCategory = 'C' then A.SalesDocumentItem
when A.ReferenceSDDocumentCategory = 'C' then A.ReferenceSDDocumentItem
else '' end as SalesOrderItem,
case when A.SDDocumentCategory = 'L' and A.ReferenceSDDocumentCategory = 'C' then A.SalesDocument
else '' end as DebitMemoRequest,
case when A.SDDocumentCategory = 'L' and A.ReferenceSDDocumentCategory = 'C' then A.SalesDocumentItem
else '' end as DebitMemoRequestItem,
case when A.SDDocumentCategory = 'C' then A.NetAmount
else 0 end as SalesOrderNetAmount,
case when A.SDDocumentCategory = 'L' and A.ReferenceSDDocumentCategory = 'C' then A.NetAmount
else 0 end as DebitMemoRequestNetAmount,
case when A.SDDocumentCategory = 'L' and A.ReferenceSDDocumentCategory = 'C' and A.OrderRelatedBillingStatus = 'C'
then A.NetAmount
else 0 end as InvcdDebitMemoReqAmtInprojCrcy,
case when A.SDDocumentCategory = 'L' and A.ReferenceSDDocumentCategory = 'C'
and A.OrderRelatedBillingStatus = 'A' and A.BillingDocumentDate >= $session.system_date then A.NetAmount
else 0 end as OpenBillingRequestAmount,
case when A.SDDocumentCategory = 'L' and A.ReferenceSDDocumentCategory = 'C'
and A.OrderRelatedBillingStatus = 'A' and A.BillingDocumentDate < $session.system_date then A.NetAmount
else 0 end as BillingRequestOverdueAmount,
case when A.TransactionCurrency = '' then B._Project.ProjectCurrency
else A.TransactionCurrency end as ProjectCurrency,
$session.system_date as CurrentDate,
A.FiscalPeriod,
A.FiscalYear,
A.Product as Material,
A.BillingPlan,
A.SalesDocumentItemCategory,
A.SDDocumentCategory,
A.ReferenceSDDocumentCategory,
A.SDDocumentRejectionStatus,
A.OrderRelatedBillingStatus,
A.BillingDocumentDate,
B._Project.Project,
B._Project.ProjectProfileCode,
B.WBSElement
}
where
(
A.SDDocumentCategory = 'C'
or A.SDDocumentCategory = 'L'
)
and A.SDDocumentRejectionStatus <> 'C'
// and B._Project.ProjectProfileCode = 'P001'
Depth:
1
2
3
4
5
All
Reload
P_SalesDocumentsForProjects view