@AbapCatalog.sqlViewName : 'CPOITEMMONICALC'
@AbapCatalog.compiler.compareFilter: true
@VDM.viewType: #CONSUMPTION
@VDM.lifecycle.contract.type : #NONE
@AccessControl.authorizationCheck: #PRIVILEGED_ONLY
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #L
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@EndUserText.label : 'Calculation field for Monitor PO'
define view C_PoItemMoniCalcField
as select from P_PurDocItemCalcField as _CalcField
association [1..1] to I_PurchaseOrderItem as _PurchaseOrderItem on $projection.PurchaseOrder = _PurchaseOrderItem.PurchaseOrder
and $projection.PurchasingDocumentItem = _PurchaseOrderItem.PurchaseOrderItem
{
key _CalcField.PurchaseOrder as PurchaseOrder,
key _CalcField.PurchaseOrderItem as PurchasingDocumentItem,
//Calculate Stock Keeping quantity
/*case _PurchasingDocumentItem.IsReturnsItem
when 'X' then 0 - (_CalcField.GoodsReceiptQty) //StockKeepingQuantity
else _CalcField.GoodsReceiptQty
end as GoodsReceiptQty,
_CalcField.BaseUnit,*/
//Still to Delivered Quantity (Open GR Quantity)
case
when _CalcField.StillToBeDeliveredQuantity < 0
then 0
else
case _PurchasingDocumentItem.IsReturnsItem
when 'X' then 0 -(_CalcField.StillToBeDeliveredQuantity)
else _CalcField.StillToBeDeliveredQuantity
end
end as StillToBeDeliveredQuantity,
@Semantics.currencyCode: true
_PurchaseOrderItem.DocumentCurrency,
//Still to be Delivered Value (Open GR Value)
@Semantics.amount.currencyCode : 'DocumentCurrency'
case
//CS20210001888821 - Keep in sync with MPOI - Limits Material PO Can be 0 - But show values for Service Limits
when _CalcField.StillToBeDeliveredQuantity < 0
and ( _PurchasingDocumentItem.PurchasingDocumentItemCategory = 'A'
and _PurchasingDocumentItem.ProductType = '1')
then 0
else _CalcField.StillToBeDeliveredValue //3284643
end as StillToBeDeliveredValue,
//Still to Invoice Quantity
case
when _CalcField.StillToInvoiceQuantity < 0
then 0
else
case _PurchasingDocumentItem.IsReturnsItem
when 'X' then 0 - (_CalcField.StillToInvoiceQuantity)
else _CalcField.StillToInvoiceQuantity
end
end as StillToInvoiceQuantity,
//Still to Invoice Value
@Semantics.amount.currencyCode : 'DocumentCurrency'
case
when _PurchaseOrderItem.PurchaseOrderItemCategory ='A' //3226992
then _PurchasingDocumentItem.NetAmount - InvoiceReceiptAmount
else
case
when _PurchasingDocumentItem.OrderQuantity <> 0
then
case _PurchasingDocumentItem.IsReturnsItem //3297269
when ''
then
case when _CalcField.GoodsReceiptQty is not null or _CalcField.GoodsReceiptQty !=0 //^2833125
then cast (abs(_CalcField.StillToInvoiceQuantity) *
division (_PurchasingDocumentItem.NetAmount,_PurchasingDocumentItem.OrderQuantity, 3) as abap.curr (15,3)) //2838634
else
cast (_PurchasingDocumentItem.NetAmount as abap.curr (15,3)) //2838634
end
else
case when _CalcField.GoodsReceiptQty is not null or _CalcField.GoodsReceiptQty !=0 //^2833125
then cast (-abs(_CalcField.StillToInvoiceQuantity) *
division (_PurchasingDocumentItem.NetAmount,_PurchasingDocumentItem.OrderQuantity, 3) as abap.curr (15,3)) //2838634
else
cast (-abs(_PurchasingDocumentItem.NetAmount) as abap.curr (15,3)) //2838634
end
end //v2833125
end
end as StillToInvoiceValue
}
/*+[internal] {
"BASEINFO":
{
"FROM ":
[
"I_PURCHASEORDERITEM",
"I_PURCHASINGDOCUMENTITEM",
"P_PURDOCITEMCALCFIELD"
],
"ASSOCIATED":
[
"I_PURCHASEORDERITEM"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/
Depth:
1
2
3
4
5
All
Reload
C_PoItemMoniCalcField view