@AbapCatalog.sqlViewName : 'PODWNCALCFNL'
@AbapCatalog.compiler.compareFilter: true
@EndUserText.label : 'Private View for Status Calculation'
@VDM.private: true
@VDM.viewType: #CONSUMPTION
@AccessControl.authorizationCheck: #PRIVILEGED_ONLY
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #L
define view P_PODOWNPAYTSTSCALCFINAL
with parameters
P_DisplayCurrency : displaycurrency
as select from I_PurchaseOrder as _PurchaseOrder
left outer join I_PurchaseOrderItem as I_PurchaseOrderItem on I_PurchaseOrderItem.PurchaseOrder = _PurchaseOrder.PurchaseOrder
// and P_PurOrdDownPaymentMntr.PurchaseOrderItem = _PurchaseOrder.PurchaseOrderItem
left outer join P_PODOWNPAYTSTSCALCFLD(P_DisplayCurrency: $parameters .P_DisplayCurrency) as _PODOWNPAYTSTSCALCFLD on _PODOWNPAYTSTSCALCFLD.PurchaseOrder = I_PurchaseOrderItem.PurchaseOrder
and _PODOWNPAYTSTSCALCFLD.PurchaseOrderItem = I_PurchaseOrderItem.PurchaseOrderItem
{
key I_PurchaseOrderItem.PurchaseOrder,
key I_PurchaseOrderItem.PurchaseOrderItem,
// case when I_PurchaseOrderItem.PurchaseOrderItem = ''
// then '5'
// else case when _PODOWNPAYTSTSCALCFLD.NetPrice is not null and _PODOWNPAYTSTSCALCFLD.NetPrice >= I_PurchaseOrderItem.DownPaymentAmount
// then '3'
// else case when I_PurchaseOrderItem.DownPaymentDueDate < $session.system_date
// then '1'
// else '2'
// end
// end
// end as PurchasingDocumentStatus
case when I_PurchaseOrderItem.DownPaymentType = ''
then ' '
else case when _PODOWNPAYTSTSCALCFLD.NetPrice is not null and _PODOWNPAYTSTSCALCFLD.NetPrice >= currency_conversion(
amount => I_PurchaseOrderItem.DownPaymentAmount,
source_currency => I_PurchaseOrderItem.DocumentCurrency,
round => 'X',
target_currency => $parameters .P_DisplayCurrency,
exchange_rate_date => PurchaseOrderDate,
error_handling => 'SET_TO_NULL')
then '3'
else case when I_PurchaseOrderItem.DownPaymentDueDate is not null and I_PurchaseOrderItem.DownPaymentDueDate < $session.system_date
and I_PurchaseOrderItem.DownPaymentAmount is not null
and _PODOWNPAYTSTSCALCFLD.NetPrice < currency_conversion(
amount => I_PurchaseOrderItem.DownPaymentAmount,
source_currency => I_PurchaseOrderItem.DocumentCurrency,
round => 'X',
target_currency => $parameters .P_DisplayCurrency,
exchange_rate_date => PurchaseOrderDate,
error_handling => 'SET_TO_NULL')
then '1'
else case when _PODOWNPAYTSTSCALCFLD.NetPrice is not null and _PODOWNPAYTSTSCALCFLD.NetPrice < currency_conversion(
amount => I_PurchaseOrderItem.DownPaymentAmount,
source_currency => I_PurchaseOrderItem.DocumentCurrency,
round => 'X',
target_currency => $parameters .P_DisplayCurrency,
exchange_rate_date => PurchaseOrderDate,
error_handling => 'SET_TO_NULL')
then '2'
else '6'
end
end
end
end as PurchasingDocumentStatus
// case when I_PurchaseOrderItem.PurchaseOrderItem = ''
// then '5'
// else case when _PODOWNPAYTSTSCALCFLD.NetPrice is not null and _PODOWNPAYTSTSCALCFLD.NetPrice >= I_PurchaseOrderItem.DownPaymentAmount
// then '3'
// else case when I_PurchaseOrderItem.DownPaymentDueDate < $session.system_date
// then '1'
// else case when _PODOWNPAYTSTSCALCFLD.NetPrice <= I_PurchaseOrderItem.DownPaymentAmount and I_PurchaseOrderItem.PurchaseOrderItem != '00000' and _PODOWNPAYTSTSCALCFLD.NetPrice > 0
// then '2'
// end
// end
// end
// end as PurchasingDocumentStatus
// case when I_PurchaseOrderItem.PurchaseOrderItem = ''
// then '0'
// else case when _PODOWNPAYTSTSCALCFLD.NetPrice is not null and _PODOWNPAYTSTSCALCFLD.NetPrice >= I_PurchaseOrderItem.DownPaymentAmount
// then '3'
// else case when _PODOWNPAYTSTSCALCFLD.NetPrice <= I_PurchaseOrderItem.DownPaymentAmount and I_PurchaseOrderItem.PurchaseOrderItem != '00000'
// then
// case when _PODOWNPAYTSTSCALCFLD.NetPrice > 0
// then case when I_PurchaseOrderItem.DownPaymentDueDate < $session.system_date
// then '1'
// else '2'
// end
// else '1'
// end
// else case when I_PurchaseOrderItem.PurchaseOrderItem = '00000'
// then '0'
// else '1'
// end
// end
// end
// end as PurchasingDocumentStatus
//
// case when I_PurchaseOrderItem.PurchaseOrderItem = ''
// then '0'
// when (_PurchaseOrder.DownPaymentType = 'V' or _PurchaseOrder.DownPaymentType = 'M') and I_PurchaseOrderItem.DownPaymentType is null and _PODOWNPAYTSTSCALCFLD.NetPrice is null
// then '4'
// else case when _PODOWNPAYTSTSCALCFLD.NetPrice is not null and _PODOWNPAYTSTSCALCFLD.NetPrice >= I_PurchaseOrderItem.DownPaymentAmount
// then '3'
// else case when _PODOWNPAYTSTSCALCFLD.NetPrice <= I_PurchaseOrderItem.DownPaymentAmount and I_PurchaseOrderItem.PurchaseOrderItem != '00000'
// then
// case when _PODOWNPAYTSTSCALCFLD.NetPrice > 0
// then case when I_PurchaseOrderItem._PurchaseOrder.PurchaseOrderDate < $session.system_date
// then '1'
// else '2'
// end
// else '1'
// end
// else case when I_PurchaseOrderItem.PurchaseOrderItem = '00000'
// then '0'
// else '1'
// end
// end
// end
// end as PurchasingDocumentStatus
}
/*+[internal] {
"BASEINFO":
{
"FROM ":
[
"I_PURCHASEORDER",
"I_PURCHASEORDERITEM",
"P_PODOWNPAYTSTSCALCFLD"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/
Depth:
1
2
3
4
5
All
Reload
P_PODOWNPAYTSTSCALCFINAL view