@AbapCatalog.sqlViewName : 'PPOITMHISTCALC'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType : #CONSUMPTION
@VDM.private: true
define view P_POItemHistoryCalc
as select from I_PurchasingDocumentHistory
{
key PurchasingDocument as PurchaseOrder,
key PurchasingDocumentItem as PurchaseOrderItem,
sum( case when PurchasingHistoryDocumentType = '2' and Quantity is not null
then
case when DebitCreditCode = 'S' then Quantity
else -abs(Quantity)
end
else 0
end ) as InvoiceReceiptQty,
sum( case when PurchasingHistoryDocumentType = '2' and PurOrdAmountInCompanyCodeCrcy is not null
then
case when DebitCreditCode = 'S' then PurOrdAmountInCompanyCodeCrcy
else -abs(PurOrdAmountInCompanyCodeCrcy)
end
else 0
end ) as InvoiceRcptAmtInCoCodeCrcy,
sum(case when PurchasingHistoryDocumentType = '1' and PurchaseOrderAmount is not null
then
case when DebitCreditCode = 'S' then PurchaseOrderAmount
else -abs(PurchaseOrderAmount)
end
else 0
end ) as GoodsReceiptAmount
}
where
PurchasingHistoryDocumentType = '1'
or PurchasingHistoryDocumentType = '2' // PurchasingHistoryDocumentType = '1' -> Goods Receipt Indicator
// PurchasingHistoryDocumentType = '2' -> Invoice Receipt Indicator
group by
PurchasingDocument,
PurchasingDocumentItem
/*+[internal] {
"BASEINFO":
{
"FROM ":
[
"I_PURCHASINGDOCUMENTHISTORY"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/
Depth:
1
2
3
4
5
All
Reload