@AbapCatalog.sqlViewName : 'PGRINVQTYIND'
@VDM.private: true
@VDM.viewType: #CONSUMPTION
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #PRIVILEGED_ONLY
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.serviceQuality: #A
@ObjectModel.usageType.sizeCategory: #L
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
define view P_GrInvQtyInd
as select from I_PurchaseOrderHistory as PDHistory
{
key PDHistory.PurchaseOrder as PurchaseOrder,
key PDHistory.PurchaseOrderItem as PurchaseOrderItem,
key PDHistory.PurchaseOrderTransactionType as PurchaseOrderTransactionType,
key PDHistory.MaterialDocument as MaterialDocument,
key PDHistory.MaterialDocumentYear as MaterialDocumentYear,
key PDHistory.MaterialDocumentItem as MaterialDocumentItem,
key PDHistory.AccountAssignmentNumber as AccountAssignmentNumber,
PDHistory.GdsRcptBlkdStkQtyInOrdQtyUnit,
/*Goods Receipt Quantity MENGE for Transaction Type - 1*/
case PurchaseOrderTransactionType
when '1' /*Goods Receipt */
then case PDHistory.DebitCreditCode
when 'S'
then PDHistory.Quantity
else (-1 * PDHistory.Quantity)
end
else 0
end as GoodsReceiptQty,
/*Invoice Receipt Quantity MENGE for Transaction Type - Invoice Receipt - 2*/
case PurchaseOrderTransactionType
when '2' /*Invoice Receipt */
then case PDHistory.DebitCreditCode
when 'S'
then PDHistory.Quantity
else (-1 * PDHistory.Quantity)
end
else 0
end as InvoiceReceiptQuantity ,
//Added the below code for Suplr Conf
case when PurchaseOrderTransactionType = '2'
then
case when DebitCreditCode = 'S'
then Quantity
else (-1 * Quantity)
end
else cast (0 as abap.quan (13, 3))
end as InvoiceReceiptQty,
case when PurchaseOrderTransactionType = '1' and PurchaseOrderAmount is not null
then
case when DebitCreditCode = 'S'
then PurchaseOrderAmount
else -abs(PurchaseOrderAmount)
end
else 0
end as PurchaseOrderAmount
// case when (PurchaseOrderTransactionType = '2' or PurchaseOrderTransactionType = '3')
// then
// case when DebitCreditCode = 'S'
// then
// cast (currency_conversion(
// amount => PurchaseOrderAmount,
// source_currency => Currency,
// round => 'X',
// target_currency => $parameters .P_DisplayCurrency,
// exchange_rate_date => PostingDate,
// error_handling => 'SET_TO_NULL'
// ) as abap.curr (15,2))
// else
// (-1 * cast (currency_conversion(
// amount => PurchaseOrderAmount,
// source_currency => Currency,
// round => 'X',
// target_currency => $parameters .P_DisplayCurrency,
// exchange_rate_date => PostingDate,
// error_handling => 'SET_TO_NULL'
// ) as abap.curr (15,2)))
// end
// else cast (0 as abap.curr (15,2))
// end as InvoiceReceiptAmount
}
where
( PurchaseOrderTransactionType = '1'
or PurchaseOrderTransactionType = '2' )
and _PurchaseOrderItem.PurchaseOrderItemCategory <> '9' //3074796
/*+[internal] {
"BASEINFO":
{
"FROM ":
[
"I_PURCHASEORDERHISTORY",
"I_PURCHASEORDERITEM"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/
Depth:
1
2
3
4
5
All
Reload