V_COSS_LVP_2_VIEW

DDL: V_COSS_LVP_2 SQL: V_COSS_LVP_2 Type: view

COSS totals: all currencies/valuations - 1

V_COSS_LVP_2_VIEW is a CDS View that provides data about "COSS totals: all currencies/valuations - 1" in SAP S/4HANA. It reads from 4 data sources (finsc_cmp_versnc, finsc_curtype, finsc_ld_cmp, tka09).

Data Sources (4)

SourceAliasJoin Type
finsc_cmp_versnc b left_outer
finsc_curtype c inner
finsc_ld_cmp m inner
tka09 v left_outer

Annotations (6)

NameValueLevelField
AbapCatalog.sqlViewName V_COSS_LVP_2 view
AbapCatalog.compiler.compareFilter true view
EndUserText.label COSS totals: all currencies/valuations - 1 view
Metadata.ignorePropagatedAnnotations true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ObjectModel.usageType.serviceQuality #P view
@AbapCatalog.sqlViewName: 'V_COSS_LVP_2'
@AbapCatalog.compiler.compareFilter: true
@EndUserText.label: 'COSS totals: all currencies/valuations - 1'
//@ClientHandling.type: #CLIENT_DEPENDENT 

//@ClientHandling.algorithm: #AUTOMATED

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

define view V_COSS_LVP_2_VIEW as

  select
           key a.bukrs,           
           key a.rldnr,
           key c.valutyp,           
           key a.objnr,
           key a.gjahr,
--           key '04'         as wrttp,
           key a.kstar,
--           key a.hrkft      as hrkft,
           key a.vrgng,
           key a.uspob,             
           key a.beknz,
           key a.twaer,
           key a.perio,
           
           case 
             when b.versn is null then '  '
             else                      b.versn
           end                as versn,                   
           a.meinh,

--         value fields
           case  
//             when m.curtph <> c.curtype then 0

             when c.legal_curtype <> '10'                   then 0 
             when ( b.wtgbtr = 'WSL'  and c.valutyp = '0' ) then wsl
             when ( b.wtgbtr = 'WSL2' and c.valutyp = '1' ) then wsl2
             when ( b.wtgbtr = 'WSL3' and c.valutyp = '2' ) then wsl3
             else                                           0
           end as wtgbtr,

           case
//             when m.curtph <> c.curtype then 0

             when c.legal_curtype <> '10'                                then 0 
             when ( a.xwbuk = ''  )  and  (   ( bstat =  'C' and co_osl <> 0 )
                                           or ( bstat <> 'C' and rco_ocur <> '' ) )
                                                                         then co_osl
//             when ( b.wogbtr is not null  and  b.wogbtr = 'HSL' )  then hsl

//             when ( b.wogbtr is not null  and  b.wogbtr = 'OSL' )  then osl

//             when ( b.wogbtr is not null  and  b.wogbtr = 'VSL' )  then vsl

//             when ( b.wogbtr is not null  and  b.wogbtr = 'BSL' )  then bsl

//             when ( b.wogbtr is not null  and  b.wogbtr = 'CSL' )  then csl

//             when ( b.wogbtr is not null  and  b.wogbtr = 'DSL' )  then dsl

//             when ( b.wogbtr is not null  and  b.wogbtr = 'ESL' )  then esl

//             when ( b.wogbtr is not null  and  b.wogbtr = 'FSL' )  then fsl

//             when ( b.wogbtr is not null  and  b.wogbtr = 'GSL' )  then gsl

//             when ( b.wogbtr is not null  and  b.wogbtr = 'KSL' )  then ksl

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtph )  then hsl

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtpo )  then osl

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtpv )  then vsl

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtpb )  then bsl 

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtpc )  then csl

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtpd )  then dsl

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtpe )  then esl

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtpf )  then fsl 

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtpg )  then gsl

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtpk )  then ksl  

             when ( c.legal_curtype = '10'  and  c.curtype = m.curtph )  then hsl
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtpo )  then osl
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtpv )  then vsl
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtpb )  then bsl 
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtpc )  then csl
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtpd )  then dsl
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtpe )  then esl
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtpf )  then fsl 
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtpg )  then gsl
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtpk )  then ksl               
             else                                                        0
           end  as wogbtr,    
           
           case             
             when ( a.xwbuk = ''  )  and  (   ( bstat =  'C' and co_osl <> 0 )
                                           or ( bstat <> 'C' and rco_ocur <> '' ) )
                                    then rco_ocur
//             when ( b.wogbtr is not null  and  b.wogbtr = 'HSL' )  then rhcur

//             when ( b.wogbtr is not null  and  b.wogbtr = 'OSL' )  then rocur

//             when ( b.wogbtr is not null  and  b.wogbtr = 'VSL' )  then rvcur

//             when ( b.wogbtr is not null  and  b.wogbtr = 'BSL' )  then rbcur

//             when ( b.wogbtr is not null  and  b.wogbtr = 'CSL' )  then rccur

//             when ( b.wogbtr is not null  and  b.wogbtr = 'DSL' )  then rdcur

//             when ( b.wogbtr is not null  and  b.wogbtr = 'ESL' )  then recur

//             when ( b.wogbtr is not null  and  b.wogbtr = 'FSL' )  then rfcur

//             when ( b.wogbtr is not null  and  b.wogbtr = 'GSL' )  then rgcur

//             when ( b.wogbtr is not null  and  b.wogbtr = 'KSL' )  then rkcur

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtph )  then rhcur

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtpo )  then rocur

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtpv )  then rvcur

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtpb )  then rbcur 

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtpc )  then rccur

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtpd )  then rdcur

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtpe )  then recur

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtpf )  then rfcur

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtpg )  then rgcur

//             when ( b.wogbtr is     null  and  c.legal_curtype = '10'  and  c.curtype = m.curtpk )  then rkcur                                     

             
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtph )  then rhcur
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtpo )  then rocur
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtpv )  then rvcur
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtpb )  then rbcur 
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtpc )  then rccur
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtpd )  then rdcur
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtpe )  then recur
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtpf )  then rfcur
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtpg )  then rgcur
             when ( c.legal_curtype = '10'  and  c.curtype = m.curtpk )  then rkcur                                                  
             else                                                        ''
           end  as rocur,    
           

           case  
//             when m.curtpk <> c.curtype then 0       

             when c.legal_curtype <> a.kokrs_curtyp                                then 0    
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtph )  then hsl
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtpo )  then osl
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtpv )  then vsl
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtpb )  then bsl 
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtpc )  then csl
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtpd )  then dsl
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtpe )  then esl
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtpf )  then fsl
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtpg )  then gsl
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtpk )  then ksl   
             else                                                                  0
           end as wkgbtr,
           case  
//             when m.curtpk <> c.curtype then 0

             when c.legal_curtype <> '10'   then 0               
             when b.wkfbtr = 'KFSL'         then kfsl
             when b.wkfbtr = 'KFSL2'        then kfsl2
             when b.wkfbtr = 'KFSL3'        then kfsl3
            else                            0
           end as wkfbtr,
           
           case 
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtph )  then rhcur
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtpo )  then rocur
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtpv )  then rvcur
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtpb )  then rbcur 
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtpc )  then rccur
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtpd )  then rdcur
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtpe )  then recur
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtpf )  then rfcur
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtpg )  then rgcur
             when ( c.legal_curtype = a.kokrs_curtyp  and  c.curtype = m.curtpk )  then rkcur              
             else                                                                  ''             
           end as rkcur,

           rocur as racur,
           rvcur,           
           rbcur,           
           rccur,
           rdcur,
           recur,
           rfcur,
           rgcur,
           rhcur,

           case                                         --- Amount in Freely Defined Currency 1
             when  ( c.legal_curtype = '10'  or  c.legal_curtype = a.kokrs_curtyp ) then 0 
             when m.curtpo = c.curtype then osl
             else                           0
           end as wagbtr,
           case                                         --- Amount in Freely Defined Currency 2
             when  ( c.legal_curtype = '10'  or  c.legal_curtype = a.kokrs_curtyp ) then 0           
             when m.curtpv = c.curtype then vsl
             else                           0
           end as wvgbtr,
           case                                         --- Amount in Freely Defined Currency 3
             when  ( c.legal_curtype = '10'  or  c.legal_curtype = a.kokrs_curtyp ) then 0           
             when m.curtpb = c.curtype then bsl
             else                           0
           end as wbgbtr,
           case                                         --- Amount in Freely Defined Currency 4
             when  ( c.legal_curtype = '10'  or  c.legal_curtype = a.kokrs_curtyp ) then 0           
             when m.curtpc = c.curtype then csl
             else                           0
           end as wcgbtr,
           case                                         --- Amount in Freely Defined Currency 5
             when  ( c.legal_curtype = '10'  or  c.legal_curtype = a.kokrs_curtyp ) then 0           
             when m.curtpd = c.curtype then dsl
             else                           0
           end as wdgbtr,
           case                                         --- Amount in Freely Defined Currency 6
             when  ( c.legal_curtype = '10'  or  c.legal_curtype = a.kokrs_curtyp ) then 0           
             when m.curtpe = c.curtype then esl
             else                           0
           end as wegbtr,    
           case                                         --- Amount in Freely Defined Currency 7
             when  ( c.legal_curtype = '10'  or  c.legal_curtype = a.kokrs_curtyp ) then 0           
             when m.curtpf = c.curtype then fsl
             else                           0
           end as wfgbtr,   
           case                                         --- Amount in Freely Defined Currency 8
             when  ( c.legal_curtype = '10'  or  c.legal_curtype = a.kokrs_curtyp ) then 0           
             when m.curtpg = c.curtype then gsl
             else                           0
           end as wggbtr,
           case                                         --- Amount in Company Currency          
             when m.curtph = c.curtype then hsl
             else                           0
           end as whgbtr,        
//           case                                         --- Amount in Company Currency

//             when  ( c.legal_curtype = '10'  or  c.legal_curtype = a.kokrs_curtyp ) then 0           

//             when m.curtph = c.curtype then hsl

//             else                           0

//           end as whgbtr, 

                                 
           
           case  
//             when m.curtpk <> c.curtype then 0

             when c.legal_curtype <> '10'   then 0               
             when b.pagbtr = 'PSL'          then psl
             when b.pagbtr = 'PSL2'         then psl2
             when b.pagbtr = 'PSL3'         then psl3
             else                           0
           end as pagbtr,    
           case  
//             when m.curtpk <> c.curtype then 0

             when c.legal_curtype <> '10'   then 0               
             when b.pafbtr = 'PFSL'         then pfsl
             when b.pafbtr = 'PFSL2'        then pfsl2
             when b.pafbtr = 'PFSL3'        then pfsl3
             else                           0
           end as pafbtr,  

           case  
            when m.curtpk = c.curtype  then vmsl
            else                            0  
           end as megbtr,
           case  
            when m.curtpk = c.curtype  then vmfsl
            else                            0  
           end as mefbtr,
           
           case  
            when m.curtpk = c.curtype  then msl
            else                            0  
           end as mbgbtr,
           case  
            when m.curtpk = c.curtype  then mfsl
            else                            0  
           end as mbfbtr,           


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

           bstat
-----------------------------------------


    from         V_COSS_LVP_1_VIEW as a                                                       
    left outer join   finsc_cmp_versnc  as b    on  b.bukrs   = a.bukrs
                                               and  b.rldnr   = a.rldnr
    left outer join   tka09             as v    on  v.kokrs   = a.kokrs
                                               and  v.versn   = b.versn                                            
    inner      join   finsc_curtype     as c    on  ( c.rldnr   = a.rldnr  or  c.rldnr = '' )
                                               and  ( v.valutyp is null    or c.valutyp = v.valutyp )
    inner      join   finsc_ld_cmp      as m    on  m.rldnr   = a.rldnr  
                                               and  m.bukrs   = a.bukrs     
                                               and (    c.curtype = m.curtph 
                                                     or c.curtype = m.curtpk
                                                     or c.curtype = m.curtpo
                                                     or c.curtype = m.curtpv
                                                     or c.curtype = m.curtpb
                                                     or c.curtype = m.curtpc
                                                     or c.curtype = m.curtpd
                                                     or c.curtype = m.curtpe
                                                     or c.curtype = m.curtpf
                                                     or c.curtype = m.curtpg
                                                    )
      ;

/*+[internal] {
"BASEINFO":
{
"FROM":
[
"V_COSS_LVP_1_VIEW",
"FINSC_CMP_VERSNC",
"FINSC_CURTYPE",
"FINSC_LD_CMP",
"TKA09"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/