V_COSS_KSII_1_VIEW

DDL: V_COSS_KSII_1 SQL: V_COSS_KSII_1 Type: view

COSS for TA KSII, WRTTP=04 only - 1

V_COSS_KSII_1_VIEW is a CDS View that provides data about "COSS for TA KSII, WRTTP=04 only - 1" in SAP S/4HANA. It reads from 4 data sources (t000, tj01, tka01, finsc_cmp_versnd).

Data Sources (4)

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

Annotations (7)

NameValueLevelField
AbapCatalog.sqlViewName V_COSS_KSII_1 view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
EndUserText.label COSS for TA KSII, WRTTP=04 only - 1 view
Metadata.ignorePropagatedAnnotations true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ObjectModel.usageType.serviceQuality #P view
@AbapCatalog.sqlViewName: 'V_COSS_KSII_1'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey:true 
@EndUserText.label: 'COSS for TA KSII, WRTTP=04 only - 1'

//@ClientHandling.algorithm: #SESSION_VARIABLE

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

define view V_COSS_KSII_1_VIEW as

  select
           key a.objnr          as objnr,
           key a.gjahr          as gjahr,
           key v.versn          as versn,
           key a.racct          as kstar, 
           key a.vrgng          as vrgng,
           key a.uspob          as uspob, 
           key a.co_beknz       as beknz,
           key a.rwcur          as twaer,

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

--         value fields
           case  field_name_wtgbtr_add
             when 'WSL'  then wsl
             when 'WSL2' then wsl2
             when 'WSL3' then wsl3
             else             0
           end as wtgbtr_add,
           case field_name_wtgbtr_subtract
             when 'WSL'  then wsl
             when 'WSL2' then wsl2
             when 'WSL3' then wsl3
             else             0
           end as wtgbtr_subtract,

           case
             when v.set_to_zero = 'X'  then 0
//             when ( tk.xwbuk = ''  )  and  (   ( bstat =  'C' and co_osl <> 0 )

//                                            or ( bstat <> 'C' and rco_ocur <> '' ) )

//                                                 then co_osl

             when field_name_wogbtr_add = 'CO_OSL'  then co_osl                                                 
             when field_name_wogbtr_add = 'HSL'  then hsl
             when field_name_wogbtr_add = 'OSL'  then osl
             when field_name_wogbtr_add = 'VSL'  then vsl
             when field_name_wogbtr_add = 'BSL'  then bsl
             when field_name_wogbtr_add = 'CSL'  then csl
             when field_name_wogbtr_add = 'DSL'  then dsl
             when field_name_wogbtr_add = 'ESL'  then esl
             when field_name_wogbtr_add = 'FSL'  then fsl
             when field_name_wogbtr_add = 'GSL'  then gsl
             when field_name_wogbtr_add = 'KSL'  then ksl
             else                                     0
           end  as wogbtr_add,    --- 1. CO_OSL; 2. HSL
           case field_name_wogbtr_subtract           -- if parallel valuation or COGM is active => HSL is but CO_OSL is not relevant
             when 'HSL'  then hsl
             when 'OSL'  then osl
             when 'CO_OSL'  then co_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
             when 'KSL'  then ksl
             else               0
           end as wogbtr_subtract,

           case  field_name_wkgbtr_add
             when 'KSL'  then ksl
             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
             when 'HSL'  then hsl
             else             0
           end as wkgbtr_add,
           case field_name_wkgbtr_subtract
             when 'KSL'  then ksl
             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
             when 'HSL'  then hsl
             else             0
           end as wkgbtr_subtract,

           case  field_name_wkfbtr_add
             when 'KFSL'   then kfsl
             when 'KFSL2'  then kfsl2
             when 'KFSL3'  then kfsl3
            else               0
           end as wkfbtr_add,
           case field_name_wkfbtr_subtract
             when 'KFSL'   then kfsl
             when 'KFSL2'  then kfsl2
             when 'KFSL3'  then kfsl3
             else               0
           end as wkfbtr_subtract,

           case  field_name_pagbtr_add
             when 'PSL'  then psl
             when 'PSL2' then psl2
             when 'PSL3' then psl3
             else             0
           end as pagbtr_add,
           case field_name_pagbtr_subtract
             when 'PSL'  then psl
             when 'PSL2' then psl2
             when 'PSL3' then psl3
             else             0
           end as pagbtr_subtract,

           case  field_name_pafbtr_add
             when 'PFSL'  then pfsl
             when 'PFSL2' then pfsl2
             when 'PFSL3' then pfsl3
             else             0
           end as pafbtr_add,
           case field_name_pafbtr_subtract
             when 'PFSL'  then pfsl
             when 'PFSL2' then pfsl2
             when 'PFSL3' then pfsl3
             else             0
           end as pafbtr_subtract,           

           case             
//             when ( tk.xwbuk = ''  )  and  (   ( bstat =  'C' and co_osl <> 0 )

//                                           or ( bstat <> 'C' and rco_ocur <> '' ) )

//                                    then rco_ocur

             when field_name_wogbtr_add = 'CO_OSL'  then rco_ocur                                     
             when field_name_wogbtr_add = 'HSL'  then rhcur
             when field_name_wogbtr_add = 'OSL'  then rocur
             when field_name_wogbtr_add = 'VSL'  then rvcur
             when field_name_wogbtr_add = 'BSL'  then rbcur
             when field_name_wogbtr_add = 'CSL'  then rccur
             when field_name_wogbtr_add = 'DSL'  then rdcur
             when field_name_wogbtr_add = 'ESL'  then recur
             when field_name_wogbtr_add = 'FSL'  then rfcur
             when field_name_wogbtr_add = 'GSL'  then rgcur
             when field_name_wogbtr_add = 'KSL'  then rhcur
             else                        ''
           end  as rocur,    

           case  field_name_wkgbtr_add
             when 'KSL'  then rkcur
             when 'OSL'  then rocur
             when 'VSL'  then rvcur
             when 'BSL'  then rbcur
             when 'CSL'  then rccur
             when 'DSL'  then rdcur
             when 'ESL'  then recur
             when 'FSL'  then rfcur
             when 'GSL'  then rgcur
             when 'HSL'  then rhcur
             else             ''
           end as rkcur,
/*
           case
             when v.versn <> '000' or v.set_to_zero = 'X'  then 0
             else                                               msl
           end as MBGBTR,
           case
             when v.versn <> '000' or v.set_to_zero = 'X'  then 0
             else                                               mfsl
           end as MBFBTR,
*/  
           case
             when v.versn <> '000' or v.set_to_zero = 'X'  then 0
             else                                               co_megbtr  -- vmsl
           end as MEGBTR,
           case
             when v.versn <> '000' or v.set_to_zero = 'X'  then 0
             else                                               co_mefbtr  -- vmfsl
           end as MEFBTR         
-----------------------------------------


    from         acdoca            as a
    inner join   finsc_cmp_versnd  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 = ''
                                     and t.xcoss = 'X'
                                     --- 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                             --- actuals with 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.objnr   <> ''                                   --- in case CO has been archive OBJNR is initial!
            and a.accasty <> ''                                   --- actuals only
      ;


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