Fins_Rev_Rec_Flow

DDL: FINS_REV_REC_FLOW SQL: FINSRR_FLOW Type: view

Flow of documents

Fins_Rev_Rec_Flow is a CDS View that provides data about "Flow of documents" in SAP S/4HANA. It reads from 1 data source (bkpf).

Data Sources (1)

SourceAliasJoin Type
bkpf k left_outer

Annotations (8)

NameValueLevelField
AbapCatalog.sqlViewName FINSRR_FLOW view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
EndUserText.label Flow of documents view
ClientDependent true view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.dataClass #MIXED view
@AbapCatalog.sqlViewName: 'FINSRR_FLOW'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Flow of documents'
@ClientDependent: true

@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.dataClass: #MIXED

//List from acdoca with

//- Number of (other) Business Transactions

//- Number of real time event based revenue recognition transactions

//- Number of target rev. event based revenue recognition transactions

//- Number of closing event based revenue recognition transactions

//- Number of excluded Business Transactions

//- Number partial real time event based revenue recognition transactions

//The numbers are documented per reference document, journal entry document, business transaction type, ledger and account assignment

//Each document item counts with the number 1

//Selects from ACDOCA and BKPF


define view Fins_Rev_Rec_Flow as 

select distinct 
a.awtyp,
a.awsys,
aworg,
awref,
awitem,
a.awtyp_rev,
a.aworg_rev,
a.awref_rev,
a.rldnr,
rbukrs,
a.gjahr as docyear,
a.belnr,
a.bttype,

cast( case accasty when 'PR' then ps_pspid when 'PD' then ps_pspid else ' ' end as ps_pspid ) as ps_pspid,
cast( case accasty when 'PR' then ps_posid else ' ' end as ps_posid ) as ps_posid,
cast( case accasty when 'PR' then ps_psp_pnr else ' ' end as ps_posnr ) as ps_psp_pnr,
cast( case accasty when 'OR' then aufnr else ' ' end as aufnr ) as aufnr,
cast( case accasty when 'VB' then kdauf when 'VK' then kdauf when 'EO' then kdauf else ' ' end as vbeln_va ) as kdauf,
cast( case accasty when 'VB' then kdpos when 'EO' then kdpos else ' ' end as posnr_va ) as kdpos,
cast( case accasty when 'SC' then service_contract_id when 'SV' then service_contract_id else ' ' end as fco_srvcontract_id ) as service_contract_id,
cast( case accasty when 'SC' then service_contract_item_id when 'SV' then service_contract_item_id else ' ' end as fco_srvcontract_item_id ) as service_contract_item_id,
cast( case accasty when 'SC' then service_doc_id when 'SV' then service_doc_id else ' ' end as fco_srvdoc_id ) as service_doc_id,
cast( case accasty when 'SC' then service_doc_item_id when 'SV' then service_doc_item_id else ' ' end as fco_srvdoc_item_id ) as service_doc_item_id,
cast( case accasty when 'PJ' then vtkey when 'EO' then vtkey else ' ' end as vtkey_kk ) as vtkey,
cast( case accasty when 'PJ' then vtpos when 'EO' then vtpos else ' ' end as vtpos_kk ) as vtpos,

solution_order_id,
accasty,

cast( case a.vrgng when '' then a.vorgn when 'COIE' then a.vorgn when 'COIN' then a.vorgn else a.vrgng end as fins_trr_bttype ) as bttype_tec,

// Number of (other) Business Transactions:

cast( case bttype when 'RFCV' then 0 else ( case vorgn when 'TBRR' then 0 when 'TBCS' then 0 when 'GLYC' then 0 when 'OCCP' then 0 when 'OCTP' then 0 else (case slalittype when '08010' then 0 else 1 end) end ) end as fins_trr_no_of_ot ) as no_of_ot,
// Number of (other) Business Transactions for Downpayments:

cast( case vorgn when 'TBRR' then 0 else (case slalittype when '08010' then 1 else 0 end) end as fins_trr_no_of_ot_dp ) as no_of_ot_dp,
// Number of real time event based revenue recogn. transactions:

cast( case a.awtyp when 'TBRR' then 0 else (case vorgn when 'TBRR' then (case slalittype when '08202' then 0 else 1 end) else 0 end ) end as fins_trr_no_of_rr) as no_of_rr,
// Number of target rev. event based rev. recogn. transactions:

cast( case vorgn when 'TBRR' then (case slalittype when '08202' then 1 else 0 end) else 0 end as fins_trr_no_of_rrtr ) as no_of_rrtr,  -- mostly realtime
// Number of closing event based revenue recogn. transactions: 

cast( case a.awtyp when 'TBRR' then 1 else 0 end as fins_trr_no_of_rrev ) as no_of_rrev,
// Number of excluded Business Transactions:

cast( case bttype when 'RFCV' then 1 else ( case vorgn when 'TBCS' then 1  when 'GLYC' then 1 when 'OCCP' then 1 when 'OCTP' then 1 else 0 end ) end as fins_trr_no_of_ex ) as no_of_ex, -- excluded stuff, consider class CL_FINS_TRR_CONTROL
// Number partial real time event based revenue recogn. trans.:

cast( case coalesce( k.trr_partial_ind , ' ' ) when ' ' then 0 else 1 end as fins_trr_no_of_pa ) as no_of_pa,

fiscyearper,
a.budat,
a.bldat,
timestamp,
k.cpudt,
k.cputm,
k.usnam,
a.kokrs

from acdoca as a
left outer join bkpf as k on k.mandt = a.rclnt
                          and k.bukrs = a.rbukrs
                          and k.belnr = a.belnr
                          and k.gjahr = a.gjahr
where accasty = 'PR' or
      accasty = 'OR' or
      accasty = 'VB' or
      accasty = 'SC' or
      accasty = 'SV' or
      accasty = 'EO' and kdauf <> ' ' and kdpos <> '000000' or  
      accasty = 'PJ' or
      accasty = 'EO' and vtkey <> ' ' and vtpos <> '000000' or
      accasty = 'PD' or
      accasty = 'VK' or
      accasty = 'SZ'
      
;

/*+[internal] {
"BASEINFO":
{
"FROM":
[
"ACDOCA",
"BKPF"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/