// DEPRECATED //
// Performance Improvements ER9K8AU9LH 7.2021, replaced by P_CrExpFiMain1 //
//@EndUserText.label : 'FI Credit Exposure - Main Segment'
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.sqlViewName : 'PCREXPFIMAIN'
@VDM.private:true
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck: #NOT_REQUIRED
@AbapCatalog.compiler.compareFilter:true
define view P_CrExpFiMain
with parameters
P_ExchangeRateDate : vdm_v_exchange_rate_date,
@Consumption.defaultValue : 'M'
P_ExchangeRateType : kurst
// Get all open items
as select from I_OperationalAcctgDocItem as _AccountingDocument
// and the corresponding customer data
inner join I_Customer on _AccountingDocument.Customer = I_Customer.Customer
// Mapping between Credit Control Area and Credit Segment
association [0..1] to I_CreditControlArea as _CreditControlArea on $projection.CreditControlArea = _CreditControlArea.CreditControlArea
// Main Credit Segment Configuration
association [0..1] to I_CreditManagementSegment as _CreditSegment on _CreditSegment.CrdtSgmtIsMainCreditSegment = 'X'
{
// 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,
// Check Exposure Category
case
when _AccountingDocument.SpecialGLCode <> ''
// Special Exposure
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,
// Credit Segment Currency
@Semantics.currencyCode: true
// _CreditSegment.CreditSegmentCurrency as CreditSegmentCurrency,
_CreditSegment.CreditSegmentCurrency as MainCreditSegmentCurrency,
// Credit Exposure
@Semantics.amount.currencyCode : 'MainCreditSegmentCurrency'
currency_conversion(
amount => AmountInTransactionCurrency,
source_currency => TransactionCurrency,
target_currency => _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 : 'MainCreditSegmentCurrency'
currency_conversion(
amount => HedgedAmount,
source_currency => _AccountingDocument.CreditControlAreaCurrency,
target_currency => _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
}
where
FinancialAccountType = 'D'
and _AccountingDocument.CreditControlArea is not initial
and _CreditControlArea._CreditControlArea2Segment.CreditSegment <> ''
and (
ClearingDate = '00000000'
)
and (
(
_AccountingDocument.SpecialGLCode != ''
and _AccountingDocument._SpecialGLCode.CreditLimitIsChecked = 'X'
)
or _AccountingDocument.SpecialGLCode = ''
)
and _CreditControlArea._CreditControlArea2Segment._CreditSegment.CrdtSgmtIsAddedToMainSgmt = 'X'
and (
_AccountingDocument._PaymentDifferenceReason.IsDisputed = ''
or _AccountingDocument._PaymentDifferenceReason.IsDisputed is initial
or _AccountingDocument._PaymentDifferenceReason.IsDisputed is null
)
Depth:
1
2
3
4
5
All
Reload