P_FinTransFlowWithTwoDirection

DDL: P_FINTRANSFLOWWITHTWODIRECTION SQL: PFINTRSFLOWTWOD Type: view COMPOSITE

P_FinTransFlowWithTwoDirection is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (R_FinTransFlow, R_FinTransCashFlowActivity) and exposes 6 fields with key fields CompanyCode, FinancialTransaction.

Data Sources (2)

SourceAliasJoin Type
R_FinTransFlow Flow inner
R_FinTransCashFlowActivity Main from

Parameters (1)

NameTypeDefault
P_KeyDate vdm_v_key_date

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PFINTRSFLOWTWOD view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
AbapCatalog.preserveKey true view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.sizeCategory #XL view
VDM.viewType #COMPOSITE view
VDM.private true view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (6)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode R_FinTransFlow CompanyCode
KEY FinancialTransaction R_FinTransFlow FinancialTransaction
FinancialInstrProductCategory R_FinTransCashFlowActivity FinancialInstrProductCategory
FinTransFlowNomAmtCrcy R_FinTransFlow FinTransFlowNomAmtCrcy
FinancialTransactionDirection R_FinTransFlow FinancialTransactionDirection
FinTransFlowPaytAmtDirection R_FinTransFlow FinTransFlowPaytAmtDirection
@AbapCatalog.sqlViewName: 'PFINTRSFLOWTWOD'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@AbapCatalog.preserveKey: true
@ObjectModel.usageType.serviceQuality: #X
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.sizeCategory: #XL
@VDM.viewType: #COMPOSITE
@VDM.private:true
@ClientHandling.algorithm: #SESSION_VARIABLE

define view P_FinTransFlowWithTwoDirection   
  with parameters
  
    @Environment.systemField: #SYSTEM_DATE
    P_KeyDate   : vdm_v_key_date
  as select from R_FinTransCashFlowActivity as Main
  inner join R_FinTransFlow as Flow on Main.CompanyCode                 = Flow.CompanyCode
                                   and Main.FinancialTransaction        = Flow.FinancialTransaction
                                   and Main.FinancialInstrumentActivity = Flow.FinancialInstrumentActivity
                                   
{     
  key Flow.CompanyCode               as CompanyCode,
  key Flow.FinancialTransaction      as FinancialTransaction,
  Main.FinancialInstrProductCategory,  
  cast( case when Flow.FinTransFlowPaytAmtDirection = '+'
            then Flow.FinTransFlowNomAmt 
            else Flow.FinTransFlowNomAmt * -1
            end as ftr_flow_norminal_amount )
                                     as FinTransFlowNomAmt,
  Flow.FinTransFlowNomAmtCrcy,
  Flow.FinancialTransactionDirection as FinancialTransactionDirection,
  Flow.FinTransFlowPaytAmtDirection,
  case when Main.FinancialInstrProductCategory = '600'
       then Flow.FinTransFlowSource
       end as FinTransFlowSource
}
where
    (
    Flow.FinTransFlowPostingBlkgReason <> '2'
    and Flow.FinTransFlowPostingBlkgReason <> '4'
    and Flow.FinTransFlowPostingBlkgReason <> '5'
    and Flow.FinTransFlowPostingBlkgReason <> '6'
    and Flow.FinTransFlowPostingStatus <> '3'
    and Flow.FinTransFlowPostingStatus <> '4'
    and (
        (
            Flow.FinTransFlowCategory = '10'
            or Flow.FinTransFlowCategory = '11'
            or Flow.FinTransFlowCategory = '12' // repayment

            or Flow.FinTransFlowCategory = '13' // Installment Repayment

            or Flow.FinTransFlowCategory = '14' // annuity repayment

            or Flow.FinTransFlowCategory = '15' // Capitalization

            or Flow.FinTransFlowCategory = '16' // Capitalized Payment 

        )
        and Flow.FinTransFlowPaymentDate <= $parameters.P_KeyDate
        and Main.FinancialInstrProductCategory = '620'
    )
    )
    or (
        Main.FinancialInstrProductCategory = '600'
        and ( Flow.FinTransFlowSource = 'LEA2' or Flow.FinTransFlowSource = 'LEA1' )
    )