FCO_MIG_COEP11

DDL: FCO_MIG_COEP11 SQL: FCOV_MIG_COEP11 Type: view

CO Delta Entries - Statistical Line Items

FCO_MIG_COEP11 is a CDS View that provides data about "CO Delta Entries - Statistical Line Items" in SAP S/4HANA. It reads from 5 data sources (t000, t006, t006, tj01, tka01).

Data Sources (5)

SourceAliasJoin Type
t000 t000 inner
t006 t6meinb left_outer
t006 t6meinh left_outer
tj01 tj01 inner
tka01 tka01 inner

Annotations (3)

NameValueLevelField
AbapCatalog.sqlViewName FCOV_MIG_COEP11 view
EndUserText.label CO Delta Entries - Statistical Line Items view
ObjectModel.usageType.serviceQuality #P view
@AbapCatalog.sqlViewName: 'FCOV_MIG_COEP11'
@EndUserText.label: 'CO Delta Entries - Statistical Line Items'
@ObjectModel.usageType.serviceQuality: #P
define view FCO_MIG_COEP11 as
select
       coep.mandt, coep.lednr, coep.objnr, coep.gjahr, '11' as wrttp, coep.versn,
       coep.kstar, coep.hrkft, coep.vrgng,
       case when xcosp = 'X' then coep.vbund else '      ' end as vbund,
       case when xcosp = 'X' then coep.pargb else '    ' end as pargb,
       coep.beknz,
       @Semantics.currencyCode coep.twaer,
       coep.meinh,
       coep.beltp,
       coep.timestmp,
       coep.bukrs, coep.fkber, coep.segment, coep.geber, coep.grant_nbr, coep.budget_pd, coep.perio,
       case when xcoss = ''    then '                      '
            when parob is null then '                      '
            when parob = ''    then '                      '
            when parob = 'OR'  then paccasty
            when parob = 'OP'  then paccasty
            else parob1
       end as parob,
       case when xcoss = 'X' then uspob else '                      ' end as uspob,
       -wtgbtr as wtgbtr,
       -wogbtr as wogbtr,
       -wkgbtr as wkgbtr,
       -wkfbtr as wkfbtr,
       -pagbtr as pagbtr,
       -pafbtr as pafbtr,
       -megbtr as megbtr,
       -mefbtr as mefbtr,
       '  ' as accasty,
       '  ' as paccasty,
       // calculate DRCRK by sign of amount (FI logic). For zero amounts, use COEP BEKNZ

       case when wkgbtr = 0 or wtgbtr = 0 or wogbtr = 0 then case when beknz = 'S' then 'S'
                                                                        else 'H'
                                                                   end
                                                              else case when wkgbtr > 0 or wtgbtr > 0 or wogbtr > 0 then 'S'
                                                                        else 'H'
                                                                   end
       end as drcrk,
       // quantity incomplete logic

      case when coep.mvflg = '' and coep.megbtr = 0 and coep.mefbtr = 0
           then case when coep.meinb = coep.meinh or t6meinh.dimid = t6meinb.dimid then '0'
                     else '1'
                end
           else case when coep.mvflg = 'Y' then '1'
                     when coep.mvflg = '' and coep.megbtr = 0 and coep.mefbtr = 0 then '1'
                     else '0'
                end
      end as muvflg
    from coep
    inner join tj01
       on tj01.vrgng = coep.vrgng
    inner join t000 on t000.mandt = coep.mandt
    inner join tka01 on tka01.mandt = coep.mandt and tka01.kokrs = coep.kokrs
    left outer join t006 as t6meinb
       on t6meinb.mandt = coep.mandt
      and t6meinb.msehi = coep.meinb
    left outer join t006 as t6meinh
       on t6meinh.mandt = coep.mandt
      and t6meinh.msehi = coep.meinh
//    inner join v_co_max_bak_gj_view as maxgj

//       on maxgj.mandt = coep.mandt

    where tj01.wtkat = 'A'
      and (wrttp = '11' or wrttp = 'U1')
//      and gjahr <= maxgj.gjahr_max

      // ALE logic: see include LKAUPF01, starting with line 39

      and ( logsyso = ''
         or logsyso = t000.logsys
         or ( ( accasty = 'KS' or accasty = 'KL' ) and ( tka01.logsystem = t000.logsys or
                                                         tka01.logsystem = '' ) ) )
// Comments:

// This view selects statistical line items

// for fiscal years, where statistical totals are selected as well

// (gjahr <= maxgj.gjahr_max) and turns the sign of the key figures

// (-wtgbtr as wtgbtr, etc.);

// When collecting results of this view with FCO_MIG_BACK11

// we get deltas for archived statistical line items;


/*+[internal] {
"BASEINFO":
{
"FROM":
[
"COEP",
"T000",
"T006",
"TJ01",
"TKA01"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"VERSION":0
}
}*/