V_COSS_W11_1_VIEW

DDL: V_COSS_W11_1 SQL: V_COSS_W11_1 Type: view Package: KACC_ERP50

COSS for WRTTP=11 only - part 1

V_COSS_W11_1_VIEW is a CDS View that provides data about "COSS for WRTTP=11 only - part 1" in SAP S/4HANA. It reads from 4 data sources (t000, tj01, tka01, finsc_cmp_versnd). Part of development package KACC_ERP50.

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_W11_1 view
Metadata.ignorePropagatedAnnotations true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ObjectModel.usageType.serviceQuality #P view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
EndUserText.label COSS for WRTTP=11 only - part 1 view
@AbapCatalog.sqlViewName: 'V_COSS_W11_1'

//@ClientHandling.algorithm: #SESSION_VARIABLE

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

@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@EndUserText.label: 'COSS for WRTTP=11 only - part 1'
define view V_COSS_W11_1_VIEW as

  select
           key a.rclnt      as mandt,
           key cast('00' as abap.char( 2 ))         as lednr,
           key a.objnr      as objnr,
           key a.ryear      as gjahr, -- a.gjahr as GJAHR
           key '11'         as wrttp,
           key v.versn      as versn,
           key a.racct      as kstar,
           key a.hrkft      as hrkft,
           key a.vrgng      as vrgng,
           key case when parobsrc = '1' then parob1 else case when parobsrc = '2' then paccasty else '' end end as parob,
           key a.uspob      as uspob,
           key a.co_beknz   as beknz,
           key a.rwcur      as twaer,

           case when v.field_name_buzei = 'CO_BUZEI'  then a.co_buzei
                when v.field_name_buzei = 'CO_BUZEI1' then a.co_buzei1
                when v.field_name_buzei = 'CO_BUZEI2' then a.co_buzei2
                when v.field_name_buzei = 'CO_BUZEI5' then a.co_buzei5
                when v.field_name_buzei = 'CO_BUZEI6' then a.co_buzei6
                when v.field_name_buzei = 'CO_BUZEI7' then a.co_buzei7
                else                                       a.co_buzei
           end              as buzei,

           a.rldnr          as rldnr,
           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 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,

           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,


           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,

           a.mig_source     as mig_source,
           a.bstat          as bstat,
-----------------------------------------
           timestamp  --- calculation on higher level


    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.mig_source = 'C'  and a.bstat = 'C'              --- from CO balances migration
      and a.objnr  <> ''                                     --- should be set in that case
      and a.accasty = ''                                     --- and only for statistical postings
      ;