// DEPRECATED //
// Performance Improvements ER9K8AU9LH 7.2021, replaced by P_CrExpFi1 //
//@EndUserText.label: 'FI Credit Exposure'
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.sqlViewName: 'PCREXPFI'
@VDM.private:true
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck: #NOT_REQUIRED
@AbapCatalog.compiler.compareFilter:true
define view P_CrExpFi
with parameters
P_ExchangeRateDate : vdm_v_exchange_rate_date,
@Consumption.defaultValue: 'M'
P_ExchangeRateType : kurst
as select from I_OperationalAcctgDocItem as _AccountingDocument
// Link with Customer
inner join I_Customer on _AccountingDocument.Customer = I_Customer.Customer
// Link with Credit Control Area/Credit Segment mapping
association [0..1] to I_CreditControlArea as _CreditControlArea on $projection.CreditControlArea = _CreditControlArea.CreditControlArea
// Link to exposure type customizing
association [1..1] to I_CreditExposureCategory as _CreditExposureCategory on $projection.CreditExposureCategory = _CreditExposureCategory.CreditExposureCategory
{
// Business Partner
I_Customer._CustomerToBusinessPartner._BusinessPartner.BusinessPartner as BusinessPartner,
// Credit Segment
_CreditControlArea._CreditControlArea2Segment.CreditSegment as CreditSegment,
'Y' as xBseg,
// Credit Control Area
_AccountingDocument.CreditControlArea,
// Original Customer
_AccountingDocument.Customer,
// Accounting Document Number
_AccountingDocument.AccountingDocument,
// Fiscal Year
_AccountingDocument.FiscalYear,
// Special G/L Indicator
_AccountingDocument.SpecialGLCode,
// Check if value is relevant for Credit Management - T074U-KLIMP
_AccountingDocument._SpecialGLCode.CreditLimitIsChecked,
// Case Exposure Category
case
// Special Exposure
when _AccountingDocument.SpecialGLCode <> ''
then '300'
// FI Exposure
else '200'
end as CreditExposureCategory,
// Document Type
FinancialAccountType,
// Transaction Currency
@Semantics.currencyCode: true
TransactionCurrency,
// Amount in Transaction Currency
@Semantics.amount.currencyCode: 'TransactionCurrency'
AmountInTransactionCurrency,
//===========================================================
// Currency Conversion to Display Currency
//===========================================================
@Semantics.currencyCode: true
_CreditControlArea._CreditControlArea2Segment._CreditSegment.CreditSegmentCurrency as CreditSegmentCurrency,
// @EndUserText.label: 'Credit Limit'
@Semantics.amount.currencyCode: 'CreditSegmentCurrency'
currency_conversion(
amount => AmountInTransactionCurrency,
source_currency => TransactionCurrency,
target_currency => _CreditControlArea._CreditControlArea2Segment._CreditSegment.CreditSegmentCurrency,
exchange_rate_date => $parameters.P_ExchangeRateDate,
exchange_rate_type => $parameters.P_ExchangeRateType,
error_handling => 'FAIL_ON_ERROR',
decimal_shift => #CDSBoolean.true,
round => #CDSBoolean.true ) as CreditExposure,
// Hedged Exposure
@Semantics.amount.currencyCode: 'CreditSegmentCurrency'
currency_conversion(
amount => HedgedAmount,
source_currency => _AccountingDocument.CreditControlAreaCurrency,
target_currency => _CreditControlArea._CreditControlArea2Segment._CreditSegment.CreditSegmentCurrency,
exchange_rate_date => $parameters.P_ExchangeRateDate,
exchange_rate_type => $parameters.P_ExchangeRateType,
error_handling => 'FAIL_ON_ERROR',
decimal_shift => #CDSBoolean.true,
round => #CDSBoolean.true ) as HedgedExposure,
// Publish associations
_CreditExposureCategory,
_CreditControlArea
}
where
FinancialAccountType = 'D'
and _AccountingDocument.CreditControlArea is not initial
and _CreditControlArea._CreditControlArea2Segment.CreditSegment <> ''
and _CreditControlArea._CreditControlArea2Segment._CreditSegment.CreditSegmentCurrency <> ''
and(
ClearingDate = '00000000'
)
and(
(
_AccountingDocument.SpecialGLCode != ''
and _AccountingDocument._SpecialGLCode.CreditLimitIsChecked = 'X'
)
or _AccountingDocument.SpecialGLCode = ''
)
and(
_AccountingDocument._PaymentDifferenceReason.IsDisputed = ''
or _AccountingDocument._PaymentDifferenceReason.IsDisputed is initial
or _AccountingDocument._PaymentDifferenceReason.IsDisputed is null
)
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_BUSINESSPARTNER",
"I_CREDITCONTROLAREA",
"I_CREDITCONTROLAREA2SEGMENT",
"I_CREDITMANAGEMENTSEGMENT",
"I_CUSTOMER",
"I_CUSTOMERTOBUSINESSPARTNER",
"I_OPERATIONALACCTGDOCITEM",
"I_PAYMENTDIFFERENCEREASON",
"I_SPECIALGLCODE"
],
"ASSOCIATED":
[
"I_CREDITCONTROLAREA",
"I_CREDITEXPOSURECATEGORY"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/