V_COSX_ACDOCA_VIEW

DDL: V_COSX_ACDOCA SQL: V_COSX_ACDOCA Type: view

COSP/COSS data on ACDOCA wo delta logic

V_COSX_ACDOCA_VIEW is a CDS View that provides data about "COSP/COSS data on ACDOCA wo delta logic" in SAP S/4HANA. It reads from 4 data sources (t000, tj01, tka01, finsc_cmp_versnc).

Data Sources (4)

SourceAliasJoin Type
t000 s inner
tj01 t inner
tka01 tk inner
finsc_cmp_versnc v inner

Annotations (6)

NameValueLevelField
AbapCatalog.sqlViewName V_COSX_ACDOCA view
AbapCatalog.compiler.compareFilter true view
EndUserText.label COSP/COSS data on ACDOCA wo delta logic view
Metadata.ignorePropagatedAnnotations true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ObjectModel.usageType.serviceQuality #P view
@AbapCatalog.sqlViewName: 'V_COSX_ACDOCA'
@AbapCatalog.compiler.compareFilter: true
@EndUserText.label: 'COSP/COSS data on ACDOCA wo delta logic'

//@ClientHandling.algorithm: #SESSION_VARIABLE

@Metadata.ignorePropagatedAnnotations: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ObjectModel.usageType.serviceQuality: #P

define view V_COSX_ACDOCA_VIEW as

  select
           key a.rclnt      as mandt,
           key '00'         as lednr,
           key a.objnr      as objnr,
           key a.ryear      as gjahr, -- gjahr as GJAHR
           key '04'         as WRTTP, 
           key v.versn      as versn,       --- default: '000'     
           key a.racct      as kstar,
           key a.hrkft      as hrkft,
           key a.vrgng      as vrgng,        
           key a.rassc      as vbund,
           key a.sbusa      as pargb,
           key a.co_beknz   as beknz,
           key a.rwcur      as twaer,
           
           case when parobsrc = '1' then parob1 else case when parobsrc = '2' then paccasty else '' end end as PAROB, 
           uspob,

           a.poper          as perio,
 --          a.rvunit         as meinh,
           co_meinh         as meinh,
     

          case         
            when wkgbtr   = 'KSL'  then rkcur
            when wkgbtr   = 'HSL'  then rhcur   
            when wkgbtr   = 'OSL'  then rocur            
            when wkgbtr   = 'VSL'  then rvcur
            when wkgbtr   = 'BSL'  then rbcur
            when wkgbtr   = 'CSL'  then rccur
            when wkgbtr   = 'DSL'  then rdcur
            when wkgbtr   = 'ESL'  then recur
            when wkgbtr   = 'FSL'  then rfcur
            when wkgbtr   = 'GSL'  then rgcur
            else             ''  
          end as kwaer, 

          case 
--            when rco_ocur <> ''  and  tk.xwbuk = ''  then rco_ocur
            when wogbtr   = 'CO_OSL'  then rco_ocur             
            when wogbtr   = 'KSL'  then rkcur
            when wogbtr   = 'HSL'  then rhcur   
            when wogbtr   = 'OSL'  then rocur            
            when wogbtr   = 'VSL'  then rvcur
            when wogbtr   = 'BSL'  then rbcur
            when wogbtr   = 'CSL'  then rccur
            when wogbtr   = 'DSL'  then rdcur
            when wogbtr   = 'ESL'  then recur
            when wogbtr   = 'FSL'  then rfcur
            when wogbtr   = 'GSL'  then rgcur
            else                        ''
          end as owaer,  
          
 
          case     
--            when rco_ocur <> '' and  tk.xwbuk = ''  then co_osl 
            when wogbtr   = 'CO_OSL'  then co_osl
            when wogbtr   = 'KSL'  then ksl
            when wogbtr   = 'HSL'  then hsl   
            when wogbtr   = 'OSL'  then osl            
            when wogbtr   = 'VSL'  then vsl
            when wogbtr   = 'BSL'  then bsl
            when wogbtr   = 'CSL'  then csl
            when wogbtr   = 'DSL'  then dsl
            when wogbtr   = 'ESL'  then esl
            when wogbtr   = 'FSL'  then fsl
            when wogbtr   = 'GSL'  then gsl
            else                        0  
          end as wogbtr,  

          case wtgbtr
            when 'WSL'  then wsl        
            when 'WSL2' then wsl2
            when 'WSL3' then wsl3            
            else             0  
          end as wtgbtr,          

          case wkgbtr          
            when 'KSL'  then ksl
            when 'HSL'  then hsl             
            when 'OSL'  then osl            
            when 'VSL'  then vsl
            when 'BSL'  then bsl
            when 'CSL'  then csl
            when 'DSL'  then dsl
            when 'ESL'  then esl
            when 'FSL'  then fsl
            when 'GSL'  then gsl
            else             0  
          end as wkgbtr,  
                              
          case  wkfbtr
            when 'KFSL'   then kfsl
            when 'KFSL2'  then kfsl2
            when 'KFSL3'  then kfsl3  
            else               0        
          end as wkfbtr,
                                    

          case  pagbtr
            when 'PSL'  then psl
            when 'PSL2' then psl2
            when 'PSL3' then psl3  
            else             0        
          end as pagbtr,
                    
          case  pafbtr
            when 'PFSL'  then pfsl
            when 'PFSL2' then pfsl2
            when 'PFSL3' then pfsl3  
            else             0        
          end as pafbtr,
          
          
--          vmsl  as MEGBTR,
--          vmfsl as MEFBTR,
          co_megbtr  as megbtr,
          co_mefbtr  as mefbtr,           
          msl   as MBGBTR,
          mfsl  as MBFBTR,


           cast(a.muvflg as abap.int1) as muvflg,

           a.beltp          as beltp,
           a.rbukrs         as bukrs,
           a.rfarea         as fkber,
           a.segment        as segment,
           a.rfund          as geber,
           a.rgrant_nbr     as grant_nbr,
           a.rbudget_pd     as budget_pd,
-----------------------------------------
           timestamp  --- calculation on higher level


    from         acdoca            as a
    inner join   finsc_cmp_versnc  as v   on  v.mandt  = a.rclnt
                                         and  v.bukrs  = a.rbukrs
                                         and  v.rldnr  = a.rldnr

    inner join tj01         as t  on     t.vrgng = a.vrgng                       --- only actuals relevant for primary postings
                                     and ( t.xcosp = 'X' or t.xcoss = 'X' )      --- the given WHERE condition should be sufficient 
                                     --- redundant check: and t.wtkat = 'A'
    inner join tka01        as tk on     tk.mandt   = a.rclnt                    --- check logical system for relevanz for totals
                                     and tk.kokrs    = a.kokrs
    inner join t000         as s  on     s.mandt    = a.rclnt
                                     and ( s.logsys   = a.logsyso
                                           or a.logsyso  = ''
                                           or (    ( a.accasty = 'KS'        or a.accasty = 'KL'  )
                                               and ( s.logsys = tk.logsystem or tk.logsystem = '' )
                                              )
                                         )
    where (   a.co_buzei <> '000'   or                                            --- CO document numbers ; ... where a.co_belnr <> ''  is redundant
            ( a.mig_source = 'C'  and a.bstat = 'C'      )                        --- actuals + statisticals from CO balances migration
          ) 
           and  a.accasty <> ''                                                   --- actuals only  
           and  a.objnr   <> ''                                                   --- in case CO has been archived OBJNR is initial!
      ;


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