@AbapCatalog.sqlViewName : 'PSDSI4TD01'
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.private: true
@VDM.viewType: #COMPOSITE
// Raw data from billing document item
// 1. Filter out the billing amount which is null or 0.
// 2. Restrict the data in specified time frame (for better performance).
// 3. Standard filters applied for billing document item.
define view P_SI4_TrainingData01
as select from I_BillingDocExtdItemBasic
left outer join P_SI3_Period as P
on P.CalendarDate = P.CalendarDate
{
key BillingDocument,
key BillingDocumentItem,
BillingDocumentDate as BD_Date,
SoldToParty,
CustomerGroup,
SalesOrganization,
DistributionChannel,
Division,
Material,
MaterialGroup,
cast ( 'USD' as vdm_v_display_currency) as DisplayCurrency,
TransactionCurrency,
NetAmount,
case
when ( SDDocumentCategory = 'M'
or SDDocumentCategory = 'P'
or SDDocumentCategory = 'S'
or SDDocumentCategory = '5'
)
then
cast ( ABS( NetAmount) as netwr )
when ( SDDocumentCategory = 'O'
or SDDocumentCategory = 'N'
or SDDocumentCategory = '6'
)
then
cast ( -1 * ABS( NetAmount) as netwr )
end
as Amount
}
where StatisticalValueControl = ''
and BillingDocumentCategory != 'P'
and BillingDocumentIsTemporary = ''
and OverallBillingStatus <> 'C'
and ( SDDocumentCategory = 'M' // Invoice
or SDDocumentCategory = 'N' // Invoice Canceled
or SDDocumentCategory = 'O' // Credit Memo
or SDDocumentCategory = 'P' // Debit Memo
or SDDocumentCategory = 'S' // Credit Memo Canceled
or SDDocumentCategory = 'U' // Pro Forma Invoice
or SDDocumentCategory = '5' // Intercompany Invoice
or SDDocumentCategory = '6' // Intercompany Credit Memo
)
and BillingDocumentDate >= P.StartCalendarDate
and BillingDocumentDate <= P.EndCalendarDate
and NetAmount != 0
and NetAmount is not null
/*+[internal] {
"BASEINFO":
{
"FROM ":
[
"I_BILLINGDOCEXTDITEMBASIC",
"P_SI3_PERIOD"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/
Depth:
1
2
3
4
5
All
Reload
P_SI4_TrainingData01 view