@AbapCatalog.sqlViewName: 'PFINTRSMANAGE'
@EndUserText.label: 'Manage Financial Transactions'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@AbapCatalog.preserveKey: true
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.sizeCategory: #L
@VDM.viewType: #COMPOSITE
@VDM.private:true
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_FinancialTransactionManage
with parameters
@Environment.systemField: #SYSTEM_DATE
P_KeyDate : vdm_v_key_date
as select from I_FinancialTransaction as FinancialTransaction
left outer to one join P_FinTransManageCashFlow ( P_KeyDate: $parameters.P_KeyDate ) as TransFlow on FinancialTransaction.CompanyCode = TransFlow.CompanyCode
and FinancialTransaction.FinancialTransaction = TransFlow.FinancialTransaction
left outer to one join P_FinTransMainIntrstCondition ( P_KeyDate: $parameters.P_KeyDate ) as TransCondition on FinancialTransaction.CompanyCode = TransCondition.CompanyCode
and FinancialTransaction.FinancialTransaction = TransCondition.FinancialTransaction
left outer to one join P_FinTransCapFloorCondition as CFCondition on FinancialTransaction.CompanyCode = CFCondition.CompanyCode
and FinancialTransaction.FinancialTransaction = CFCondition.FinancialTransaction
and FinancialTransaction.FinInstrLastActiveActivity = CFCondition.FinancialInstrumentActivity
and FinancialTransaction.FinancialInstrProductCategory = '610'
left outer to one join P_FinTransManageOption as Option on FinancialTransaction.CompanyCode = Option.CompanyCode
and FinancialTransaction.FinancialTransaction = Option.FinancialTransaction
left outer to one join P_FinTransManageFacility ( P_KeyDate: $parameters.P_KeyDate ) as Facility on FinancialTransaction.CompanyCode = Facility.CompanyCode
and FinancialTransaction.FinancialTransaction = Facility.FinancialTransaction
left outer to one join P_FinTransManageReference as Reference on FinancialTransaction.TreasuryFinancialObject = Reference.TreasuryFinancialObject
left outer to one join P_FinTransCshSettlmtFlw as CashSettlementFlow on FinancialTransaction.CompanyCode = CashSettlementFlow.CompanyCode
and FinancialTransaction.FinancialTransaction = CashSettlementFlow.FinancialTransaction
left outer to one join P_FinTransPremFlw as PremiumFlow on FinancialTransaction.CompanyCode = PremiumFlow.CompanyCode
and FinancialTransaction.FinancialTransaction = PremiumFlow.FinancialTransaction
left outer to one join R_FinTransSecurityQuantityFlow as SecurityMainFlow on FinancialTransaction.CompanyCode = SecurityMainFlow.CompanyCode
and FinancialTransaction.FinancialTransaction = SecurityMainFlow.FinancialTransaction
and FinancialTransaction.FinInstrLastActiveActivity = SecurityMainFlow.FinancialInstrumentActivity
{
key FinancialTransaction.CompanyCode,
key FinancialTransaction.FinancialTransaction,
FinancialTransaction.TreasuryFinancialObject,
cast ( concat( FinancialTransaction.CompanyCode, concat('/', cast( ltrim( FinancialTransaction.FinancialTransaction, '0' ) as tb_rfha ) ) ) as ftr_fin_trans_nmbr_with_cocode ) as FinTransWithCompanyCode,
cast ( FinancialTransaction.CreatedByUser as cruser preserving type ) as CreatedByUser,
cast ( FinancialTransaction.FinTransCreationDate as ftr_creation_date preserving type ) as FinTransCreationDate,
cast ( FinancialTransaction.FinTransCreationTime as createtime preserving type ) as FinTransCreationTime,
// cast( dats_tims_to_tstmp(FinancialTransaction.FinTransCreationDate, FinancialTransaction.FinTransCreationTime, abap_system_timezone($session.client, 'NULL'), $session.client, 'NULL') as ftr_creation_date_time ) as CreationDateTime,
LastChangedByUser,
cast ( FinancialTransaction.LastChangeDate as chdate preserving type) as LastChangeDate,
cast ( FinancialTransaction.FinInstrumentLastChangedTime as ftr_last_changed_time preserving type) as FinInstrumentLastChangedTime,
// cast( dats_tims_to_tstmp(FinancialTransaction.LastChangeDate, FinancialTransaction.FinInstrumentLastChangedTime, abap_system_timezone($session.client, 'NULL'), $session.client, 'NULL') as ftr_last_change_date_time ) as LastChangeDateTime,
TreasuryContractType,
FinancialTransaction.FinancialInstrProductCategory,
FinancialTransaction.FinancialInstrumentProductType,
_FinancialInstrProdType._FinancialInstrProdTypeSuplmnt.TradeFinanceCategory,
cast ( _FinancialInstrProdType._FinancialInstrProdTypeSuplmnt.TreasurySettlementType as ftr_prod_settlfl preserving type ) as TreasurySettlementType,
FinancialTransaction.FinInstrTransactionCategory,
FinancialInstrTransactionType,
FinInstrLastActiveActivity, // not expose in C_FinancialTransactionManage View
_CurrentActivity._ActivityCategory2.FinTransGenActivityCategory as FinTransGenActivityCategory,
_CurrentActivity._ActivityCategory2.FinancialInstrActivityCategory,
FinancialTransaction.Counterparty,
Portfolio,
FinancialInstrumentAssignment,
FinancialInstrumentReference,
FinancialInstrCharacteristic,
TreasuryValuationClass,
HedgingClassification,
HedgeRequestIdentifier,
ProfitCenter,
CostCenter,
FinancialTransaction.WBSElementInternalID,
Segment,
OnBehalfOfCompany,
TreasuryFacilityCompanyCode,
TreasuryFacility,
FinancialInstrumentStatus,
FuturesAccount,
FinTransIsRiskMitigating,
FinancialTransaction.TermStartDate,
_CurrentActivity.FinTransActyConclusionDate,
_CurrentActivity.Trader,
_CurrentActivity.FinInstrExternalReference,
cast( case when _CurrentActivity.FinTransNoticeDate is not initial
then _CurrentActivity.FinTransNoticeDate
else _CurrentActivity.TermEndDate
end as tb_delfz ) as TermEndDate,
TreasuryFinanceProject,
// EMIR
FinancialTransaction.ClassificationOfFinInstr,
FinancialTransaction.UniqueProductIdentifier,
FinancialTransaction.InternationalSecuritiesIdnNmbr,
FinancialTransaction.ReportTrackingNumber,
cast ( case when ( FinancialTransaction.FinancialInstrProductCategory = '760' and Option.FinancialInstrProductCategory = '600' )
then Option.OptionUndrlgTradedCurrency
when ( FinancialTransaction.FinancialInstrProductCategory = '760' and Option.FinancialInstrProductCategory = '620' )
then Option.FinInstrumentOutgoingCurrency
when ( FinancialTransaction.FinancialInstrProductCategory = '760' and Option.OptnUndrlgTreasuryContractType = '2' )
then Option.QuotationCurrency
else FinancialTransaction.TransactionCurrency
end as ftr_transaction_currency preserving type ) as TransactionCurrency,
cast ( case when FinancialTransaction.FinancialInstrProductCategory = '600' and FinancialTransaction.TransactionCurrency = TransFlow.FinTransFlowNomAmtCrcy then abs ( TransFlow.FinTransFlowNomAmt )
when FinancialTransaction.FinancialInstrProductCategory = '600' and FinancialTransaction.TransactionCurrency = TransFlow.FinInstrumentIncomingCurrency then TransFlow.FinInstrIncomingNominalAmount
when FinancialTransaction.TreasuryContractType = '2' then SecurityMainFlow.MarketValInPaytCurrency
when FinancialTransaction.FinancialInstrProductCategory = '760' and Option.FinancialInstrProductCategory = '600' then Option.OptionUndrlgTradedAmount
when FinancialTransaction.FinancialInstrProductCategory = '760' and Option.FinancialInstrProductCategory = '620' then Option.FinInstrOutgoingNominalAmount
when FinancialTransaction.FinancialInstrProductCategory = '760' and Option.OptnUndrlgTreasuryContractType = '2' then Option.MarketValueInQtanCurrency
when FinancialTransaction.FinancialInstrProductCategory = '560' then Facility.TotalAmountInTransactionCrcy
else abs( TransFlow.FinTransFlowNomAmt )
end as ftr_transaction_amount ) as AmountInTransactionCurrency,
//interest rate related
//nominal amount
cast ( case
when (FinancialTransaction.FinancialInstrProductCategory = '510'
or FinancialTransaction.FinancialInstrProductCategory = '520'
or FinancialTransaction.FinancialInstrProductCategory = '530'
or FinancialTransaction.FinancialInstrProductCategory = '540'
or FinancialTransaction.FinancialInstrProductCategory = '550'
or FinancialTransaction.FinancialInstrProductCategory = '580'
or FinancialTransaction.FinancialInstrProductCategory = '610'
or FinancialTransaction.FinancialInstrProductCategory = '620'
or FinancialTransaction.FinancialInstrProductCategory = '630')
then abs( TransFlow.FinTransFlowNomAmt )
when FinancialTransaction.TreasuryContractType= '2'
then SecurityMainFlow.FinTransTradedNomAmt
when (FinancialTransaction.FinancialInstrProductCategory = '760' and Option.OptnUndrlgTreasuryContractType = '2')
then Option.FinTransFlowNomAmt
end as ftr_nominal_amount ) as FinTransFlowNomAmt,
case
when (FinancialTransaction.FinancialInstrProductCategory = '510'
or FinancialTransaction.FinancialInstrProductCategory = '520'
or FinancialTransaction.FinancialInstrProductCategory = '530'
or FinancialTransaction.FinancialInstrProductCategory = '540'
or FinancialTransaction.FinancialInstrProductCategory = '550'
or FinancialTransaction.FinancialInstrProductCategory = '580'
or FinancialTransaction.FinancialInstrProductCategory = '610'
or FinancialTransaction.FinancialInstrProductCategory = '620'
or FinancialTransaction.FinancialInstrProductCategory = '630' )
then TransFlow.FinTransFlowNomAmtCrcy
when FinancialTransaction.TreasuryContractType= '2'
then SecurityMainFlow.FinTransFlowNomAmtCrcy
when (FinancialTransaction.FinancialInstrProductCategory = '760' and Option.OptnUndrlgTreasuryContractType = '2')
then Option.FinTransFlowNomAmtCrcy
end as FinTransFlowNomAmtCrcy,
cast ( case
when (FinancialTransaction.FinancialInstrProductCategory = '620')
then abs( TransFlow.FinTransFlowNomAmt )
when (FinancialTransaction.FinancialInstrProductCategory = '760')
then Option.FinInstrOutgoingNominalAmount
end as ftr_outgoing_nominal_amount ) as FinInstrOutgoingNominalAmount,
cast( case
when (FinancialTransaction.FinancialInstrProductCategory = '620')
then FinancialTransaction.FinInstrumentOutgoingCurrency
when (FinancialTransaction.FinancialInstrProductCategory = '760' and Option.FinancialInstrProductCategory = '620')
then Option.FinInstrumentOutgoingCurrency
end as tb_wgschf1) as FinInstrumentOutgoingCurrency,
cast ( case
when (FinancialTransaction.FinancialInstrProductCategory = '620')
then abs( TransFlow.FinInstrIncomingNominalAmount )
when (FinancialTransaction.FinancialInstrProductCategory = '760')
then Option.FinInstrIncomingNominalAmount
end as ftr_incoming_nominal_amount ) as FinInstrIncomingNominalAmount,
cast( case
when (FinancialTransaction.FinancialInstrProductCategory = '620')
then FinancialTransaction.FinInstrumentIncomingCurrency
when (FinancialTransaction.FinancialInstrProductCategory = '760' and Option.FinancialInstrProductCategory = '620')
then Option.FinInstrumentIncomingCurrency
end as tb_wgschf2) as FinInstrumentIncomingCurrency,
cast( case
when FinancialTransaction.TreasuryContractType = '2' then SecurityMainFlow.MarketValInPaytCurrency
else TransFlow.FinTransFlowPaytAmt
end as ftr_payment_amount ) as FinTransFlowPaytAmt,
cast( case
when FinancialTransaction.TreasuryContractType = '2' then SecurityMainFlow.PaymentCurrency
else TransFlow.FinTransFlowPaytAmtCrcy
end as ftr_flow_payment_amount_crcy ) as FinTransFlowPaytAmtCrcy,
cast( case
when FinancialTransaction.TreasuryContractType = '2' then SecurityMainFlow.FinTransFlowPaymentDate
end as ftr_flow_payment_date preserving type ) as FinTransFlowPaymentDate,
TransCondition.FinConditionInterestCategory,
TransCondition.InterestCalculationMethod,
TransCondition.ConditionPercentageRate,
TransCondition.InterestReference,
// TransCondition.CreditLineIdentifier,
CFCondition.FinCndnUpperLimitPctgRate,
CFCondition.FinCndnLowerLimitPctgRate,
cast ( case
when (FinancialTransaction.FinancialInstrProductCategory = '620')
then TransCondition.FinConditionInterestCategory
when FinancialTransaction.FinancialInstrProductCategory = '760'
then Option.FinInstrOutgCndnIntrstCategory
end as ftr_outgoing_int_cat ) as FinInstrOutgCndnIntrstCategory,
cast ( case
when FinancialTransaction.FinancialInstrProductCategory = '760'
then Option.FinInstrOutgCndnPctgRate
when FinancialTransaction.FinancialInstrProductCategory = '620'
then TransCondition.FinInstrOutgCndnPctgRate
end as ftr_outgoing_pctg_rate) as FinInstrOutgCndnPctgRate,
cast ( case
when FinancialTransaction.FinancialInstrProductCategory = '760'
then Option.FinInstrOutgIntrstReference
when FinancialTransaction.FinancialInstrProductCategory = '620'
then TransCondition.FinInstrOutgIntrstReference
end as ftr_outgoing_int_ref) as FinInstrOutgIntrstReference,
cast(case
when FinancialTransaction.FinancialInstrProductCategory = '760'
then Option.FinInstrOutgIntrstCalcMeth
when FinancialTransaction.FinancialInstrProductCategory = '620'
then TransCondition.FinInstrOutgIntrstCalcMeth
end as ftr_outgoing_int_calc_meth) as FinInstrOutgIntrstCalcMeth,
cast(case
when FinancialTransaction.FinancialInstrProductCategory = '760'
then Option.FinInstrIncgCndnIntrstCategory
when FinancialTransaction.FinancialInstrProductCategory = '620'
then TransCondition.FinInstrIncgCndnIntrstCategory
end as ftr_incoming_int_cat) as FinInstrIncgCndnIntrstCategory,
cast (case
when FinancialTransaction.FinancialInstrProductCategory = '760'
then Option.FinInstrIncgIntrstCalcMeth
when FinancialTransaction.FinancialInstrProductCategory = '620'
then TransCondition.FinInstrIncgIntrstCalcMeth
end as ftr_incoming_int_calc_meth) as FinInstrIncgIntrstCalcMeth,
cast (case
when FinancialTransaction.FinancialInstrProductCategory = '760'
then Option.FinInstrIncgCndnPctgRate
when FinancialTransaction.FinancialInstrProductCategory = '620'
then TransCondition.FinInstrIncgCndnPctgRate
end as ftr_incoming_pctg_rate ) as FinInstrIncgCndnPctgRate,
cast (case
when FinancialTransaction.FinancialInstrProductCategory = '760'
then Option.FinInstrIncgIntrstReference
when FinancialTransaction.FinancialInstrProductCategory = '620'
then TransCondition.FinInstrIncgIntrstReference
end as ftr_incoming_int_ref ) as FinInstrIncgIntrstReference,
cast ( case
when ( FinancialTransaction.FinancialInstrProductCategory = '550'
or FinancialTransaction.FinancialInstrProductCategory = '560'
or FinancialTransaction.FinancialInstrProductCategory = '580' )
then TransCondition.InterestMarkupMarkdownValue
end as tb_zzs ) as InterestMarkupMarkdownValue,
cast ( case
when (FinancialTransaction.FinancialInstrProductCategory = '620')
then TransCondition.InterestMarkupMarkdownValue
when FinancialTransaction.FinancialInstrProductCategory = '760'
then Option.OutgIntrstMarkupMarkdownVal
end as ftr_outg_markup_markdown ) as OutgIntrstMarkupMarkdownVal,
cast ( case
when (FinancialTransaction.FinancialInstrProductCategory = '620')
then TransCondition.IncgIntrstMarkupMarkdownVal
when FinancialTransaction.FinancialInstrProductCategory = '760'
then Option.IncgIntrstMarkupMarkdownVal
end as ftr_incg_markup_markdown ) as IncgIntrstMarkupMarkdownVal,
cast ( case
when (FinancialTransaction.FinancialInstrProductCategory = '630')
then FinancialTransaction.TermStartDate
end as ftr_fra_lead_time_start_date ) as FwdRateAgrmtLeadTmeStrtDte,
TransCondition.FwdRateAgrmtHdgPerdStrtDte,
cast ( case
when (FinancialTransaction.FinancialInstrProductCategory = '630')
then _CurrentActivity.TermEndDate
end as ftr_fra_hedge_end_date ) as FwdRateAgrmtHdgPerdEndDte,
//TF
_CurrentActivity.LetterOfCredit,
_CurrentActivity.TreasuryBeneficiary,
_CurrentActivity.TreasuryAdvisingBank,
_CurrentActivity.TreasuryApplicant,
_CurrentActivity.TreasuryIssuingBank,
_CurrentActivity.BankGuaranteeNumber,
_CurrentActivity.BankGuaranteeType,
//SEC
case
when FinancialTransaction.FinancialInstrProductCategory = '760'
then Option.SecurityClass
else FinancialTransaction.SecurityClass
end as SecurityClass,
case
when FinancialTransaction.FinancialInstrProductCategory = '760'
then Option.SecurityAccount
else FinancialTransaction.SecurityAccount
end as SecurityAccount,
case
when FinancialTransaction.FinancialInstrProductCategory = '760'
then Option.FinTransTradedNumberOfUnits
else SecurityMainFlow.FinTransTradedNumberOfUnits
end as FinTransTradedNumberOfUnits,
case
when FinancialTransaction.FinancialInstrProductCategory = '760'
then Option.FinTransTradedPricePercent
else SecurityMainFlow.FinTransTradedPricePercent
end as FinTransTradedPricePercent,
case
when FinancialTransaction.FinancialInstrProductCategory = '760'
then Option.FinTransTrdPriceCrcyUnitRate
else SecurityMainFlow.FinTransTrdPriceCrcyUnitRate
end as FinTransTrdPriceCrcyUnitRate,
case
when FinancialTransaction.FinancialInstrProductCategory = '760'
then Option.FinTransTradedPriceCrcyUnit
else SecurityMainFlow.FinTransTradedPriceCrcyUnit
end as FinTransTradedPriceCrcyUnit,
case
when FinancialTransaction.FinancialInstrProductCategory = '760'
then Option.FinTransPositionValueDate
else SecurityMainFlow.FinTransPositionValueDate
end as FinTransPositionValueDate,
case
when FinancialTransaction.FinancialInstrProductCategory = '760'
then Option.SecurityExchange
else SecurityMainFlow.SecurityExchange
end as SecurityExchange,
SecurityMainFlow.CalculationDate,
case when FinancialTransaction.FinancialInstrProductCategory = '760' and Option.OptnUndrlgTreasuryContractType = '2'
then Option.MarketValueInQtanCurrency
else SecurityMainFlow.MarketValueInQtanCurrency
end as MarketValueInQtanCurrency,
case when FinancialTransaction.FinancialInstrProductCategory = '760' and Option.OptnUndrlgTreasuryContractType = '2'
then Option.QuotationCurrency
else SecurityMainFlow.QuotationCurrency
end as QuotationCurrency,
//FX
TrsyTradedAmountBuySellCode,
cast ( _CurrentActivity.FinTransFixingDate as ftr_fixing_date preserving type ) as FinTransFixingDate,
_CurrentActivity.ForeignExchangeFixingReference,
cast ( _CurrentActivity.ExchangeRate as ftr_fx_forward_rate preserving type ) as ExchangeRate,
_CurrentActivity.SpotExchangeRate,
_CurrentActivity.SwapExchangeRate,
_CurrentActivity.LiquidityEffectValue,
cast ( case
when FinancialTransaction.FinancialInstrProductCategory = '600' and FinancialTransaction.TrsyTradedAmountBuySellCode = 'S'
then abs ( TransFlow.FinTransFlowNomAmt )
when FinancialTransaction.FinancialInstrProductCategory = '600' and FinancialTransaction.TrsyTradedAmountBuySellCode = 'B'
then TransFlow.FinInstrIncomingNominalAmount
when FinancialTransaction.FinancialInstrProductCategory = '760' and Option.FinancialInstrProductCategory = '600'
then Option.OptionUndrlgTradedAmount
end as ftr_traded_amt_long) as AmountInTradedCurrency,
cast ( case
when FinancialTransaction.FinancialInstrProductCategory = '600' and FinancialTransaction.TrsyTradedAmountBuySellCode = 'S'
then TransFlow.FinTransFlowNomAmtCrcy
when FinancialTransaction.FinancialInstrProductCategory = '600' and FinancialTransaction.TrsyTradedAmountBuySellCode = 'B'
then TransFlow.FinInstrumentIncomingCurrency
when FinancialTransaction.FinancialInstrProductCategory = '760' and Option.FinancialInstrProductCategory = '600'
then Option.OptionUndrlgTradedCurrency
end as ftr_traded_curr) as TradedCurrency,
cast ( case
when FinancialTransaction.FinancialInstrProductCategory = '600' and FinancialTransaction.TrsyTradedAmountBuySellCode = 'S'
then TransFlow.FinInstrIncomingNominalAmount
when FinancialTransaction.FinancialInstrProductCategory = '600' and FinancialTransaction.TrsyTradedAmountBuySellCode = 'B'
then abs ( TransFlow.FinTransFlowNomAmt )
when FinancialTransaction.FinancialInstrProductCategory = '760' and Option.FinancialInstrProductCategory = '600'
then Option.FXOppositeAmount
end as ftr_oppos_amt_long ) as FXOppositeAmount,
cast ( case
when FinancialTransaction.FinancialInstrProductCategory = '600' and FinancialTransaction.TrsyTradedAmountBuySellCode = 'S'
then TransFlow.FinInstrumentIncomingCurrency
when FinancialTransaction.FinancialInstrProductCategory = '600' and FinancialTransaction.TrsyTradedAmountBuySellCode = 'B'
then TransFlow.FinTransFlowNomAmtCrcy
when FinancialTransaction.FinancialInstrProductCategory = '760' and Option.FinancialInstrProductCategory = '600'
then Option.FXOppositeCurrency
end as ftr_oppos_curr ) as FXOppositeCurrency,
case
when FinancialTransaction.FinancialInstrProductCategory = '600'
then _CurrentActivity.CurrencyPair
when FinancialTransaction.FinancialInstrProductCategory = '760' and Option.FinancialInstrProductCategory = '600'
then Option.CurrencyPair
end as CurrencyPair,
cast( case
when FinancialTransaction.FinancialInstrProductCategory = '600'
then _CurrentActivity.TermEndDate
when FinancialTransaction.FinancialInstrProductCategory = '760' and Option.FinancialInstrProductCategory = '600'
then Option.ForeignExchangeValueDate
end as fx_value_date) as ForeignExchangeValueDate,
cast ( CashSettlementFlow.FinTransFlowPaytAmt as tb_cash_settlement_amount preserving type ) as CashSettlementAmount,
cast ( CashSettlementFlow.FinTransFlowPaytAmtCrcy as tb_cash_settlement_currency preserving type ) as CashSettlementCurrency,
cast ( CashSettlementFlow.FinTransFlowPaymentDate as ftr_cash_settlement_payt_date preserving type ) as CashSettlementPaymentDate,
//Option
Option.OptionExpirationDate,
Option.OptionExerciseType,
Option.OptionUnderlyingProductType,
Option.OptionUndrlgTransactionType,
Option.OptionSettlementType,
Option.OptionUndrlgFXStrikeRate,
Option.OptionPutCallCode,
cast ( _CurrentActivity.FinTransExerciseDate as ftr_exercise_date ) as FinTransExerciseDate,
PremiumFlow.PremiumPriceQuotedInPointsRate,
PremiumFlow.PremiumPriceQuotedInPercent,
PremiumFlow.OptionPremiumNotation,
cast ( PremiumFlow.FinTransFlowPaytAmt as ftr_premium_amount ) as FinTransPremiumAmount,
cast ( PremiumFlow.FinTransFlowPaytAmtCrcy as ftr_premium_currency preserving type ) as FinTransPremiumAmountCurrency,
cast ( PremiumFlow.FinTransFlowPaymentDate as ftr_premium_payment_date preserving type ) as FinTransPremiumPaymentDate,
Option.OptionUnderlyingTermStartDate,
Option.OptionUnderlyingTermEndDate,
Option.FinancialTransactionFromExer,
//facility
Facility.TotalAmountInTransactionCrcy,
Facility.CreditLineCurrency,
Facility.FcltyTermEndExceededIsAllowed,
// Reference
Reference.FinTransReferenceCategory,
Reference.FinTransReferenceNumber
}
where
FinancialTransaction.FinancialInstrProductCategory = '510'
or FinancialTransaction.FinancialInstrProductCategory = '520'
or FinancialTransaction.FinancialInstrProductCategory = '530'
or FinancialTransaction.FinancialInstrProductCategory = '540'
or FinancialTransaction.FinancialInstrProductCategory = '550'
or FinancialTransaction.FinancialInstrProductCategory = '560'
or FinancialTransaction.FinancialInstrProductCategory = '580'
or FinancialTransaction.FinancialInstrProductCategory = '600'
or FinancialTransaction.FinancialInstrProductCategory = '610'
or FinancialTransaction.FinancialInstrProductCategory = '620'
or FinancialTransaction.FinancialInstrProductCategory = '630'
or FinancialTransaction.FinancialInstrProductCategory = '760'
or FinancialTransaction.FinancialInstrProductCategory = '850'
or FinancialTransaction.FinancialInstrProductCategory = '860'
or FinancialTransaction.TreasuryContractType = '2'