@AbapCatalog.preserveKey: true
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.sqlViewName: 'NSDM_V_MCHB'
@EndUserText.label: 'MCHB Compatibility View'
@DataAging.noAgingRestriction: 'false'
@ObjectModel.usageType.sizeCategory: 'L'
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@ClientHandling.algorithm: #AUTOMATED
@AccessControl.authorizationCheck: #NOT_ALLOWED
@AbapCatalog.viewEnhancementCategory: #PROJECTION_LIST
define view nsdm_e_mchb
as select from mchb as t
left outer to one join nsdm_e_mchb_diff as m on t.mandt = m.mandt
and t.matnr = m.matnr
and t.werks = m.werks
and t.lgort = m.lgort
and t.charg = m.charg
{
key t.mandt,
key t.matnr,
key t.werks,
key t.lgort,
key t.charg,
t.lvorm,
t.ersda,
t.ernam,
t.laeda,
t.aenam,
case
when m.gjper = '0000000'
or m.gjper is null then
t.lfgja
else
cast(substring(m.gjper, 1, 4) as abap.numc(4))
end as lfgja,
case
when m.gjper = '0000000'
or m.gjper is null then
t.lfmon
else
cast(substring(m.gjper, 6, 2) as abap.numc(2))
end as lfmon,
t.sperc,
case when m.clabs is null then 0 else m.clabs end as clabs, // vvv note 2249780
case when m.cumlm is null then 0 else m.cumlm end as cumlm,
case when m.cinsm is null then 0 else m.cinsm end as cinsm,
case when m.ceinm is null then 0 else m.ceinm end as ceinm,
case when m.cspem is null then 0 else m.cspem end as cspem,
case when m.cretm is null then 0 else m.cretm end as cretm,
case when m.cvmla is null then 0 else m.cvmla end as cvmla,
case when m.cvmum is null then 0 else m.cvmum end as cvmum,
case when m.cvmin is null then 0 else m.cvmin end as cvmin,
case when m.cvmei is null then 0 else m.cvmei end as cvmei,
case when m.cvmsp is null then 0 else m.cvmsp end as cvmsp,
case when m.cvmre is null then 0 else m.cvmre end as cvmre, // ^^^ note 2249780
t.kzicl,
t.kzicq,
t.kzice,
t.kzics,
t.kzvcl,
t.kzvcq,
t.kzvce,
t.kzvcs,
t.herkl,
t.chdll,
t.chjin,
'X' as chrue,
t.sgt_scat,
/* Fields for EA-RETAIL(Fashion)
*/
' ' as fsh_season_year,
' ' as fsh_season,
' ' as fsh_collection,
' ' as fsh_theme,
t.fsh_salloc_qty,
case when m./cwm/clabs is null then 0 else m./cwm/clabs end as /cwm/clabs, // note 2413597
case when m./cwm/cinsm is null then 0 else m./cwm/cinsm end as /cwm/cinsm, // note 2413597
case when m./cwm/ceinm is null then 0 else m./cwm/ceinm end as /cwm/ceinm, // note 2413597
case when m./cwm/cspem is null then 0 else m./cwm/cspem end as /cwm/cspem, // note 2413597
case when m./cwm/cretm is null then 0 else m./cwm/cretm end as /cwm/cretm, // note 2413597
case when m./cwm/cumlm is null then 0 else m./cwm/cumlm end as /cwm/cumlm, // note 2413597
case when m./cwm/cvmla is null then 0 else m./cwm/cvmla end as /cwm/cvmla, // note 2413597
case when m./cwm/cvmin is null then 0 else m./cwm/cvmin end as /cwm/cvmin, // note 2413597
case when m./cwm/cvmei is null then 0 else m./cwm/cvmei end as /cwm/cvmei, // note 2413597
case when m./cwm/cvmsp is null then 0 else m./cwm/cvmsp end as /cwm/cvmsp, // note 2413597
case when m./cwm/cvmre is null then 0 else m./cwm/cvmre end as /cwm/cvmre, // note 2413597
case when m./cwm/cvmum is null then 0 else m./cwm/cvmum end as /cwm/cvmum // note 2413597
}