@AbapCatalog.sqlViewName: 'MDCV_V_T399D'
@EndUserText.label: 'Compatibility View for T399D'
@AccessControl.authorizationCheck: #NOT_REQUIRED
--@AbapCatalog.buffering: {status: #ACTIVE, type: #SINGLE}
@ClientHandling.algorithm: #AUTOMATED
@ObjectModel.usageType: {serviceQuality: #C, sizeCategory: #S, dataClass: #CUSTOMIZING}
define view MDCV_E_T399D as
select from t001w as t001w
left outer to one join t399d as t399d
on t001w.werks = t399d.werks
left outer to one join MDCV_E_NRIV( p_object : 'PLAF' ) as nrplaf -- get internal number ranges for PLAF
on nrplaf.object = 'PLAF'
left outer to one join MDCV_E_NRIV( p_object : 'BANF' ) as nrbanf -- get internal number ranges for BANF
on nrbanf.object = 'BANF'
left outer to one join MDCV_E_NRIV( p_object : 'MDTB' ) as nrmdtb -- get internal number ranges for MDTB
on nrmdtb.object = 'MDTB'
left outer to one join MDCV_E_NRIV( p_object : 'RESB' ) as nrresb -- get internal number ranges for RESB
on nrresb.object = 'RESB'
left outer to one join MDCV_E_NRIV( p_object : 'MDSM' ) as nrmdsm -- get internal number ranges for MDSM
on nrmdsm.object = 'MDSM'
left outer to one join MDCV_E_T003O( p_auart : 'PP01' ) as aupp01 -- check existence of PP01 in T003O
on aupp01.auart = 'PP01'
left outer to one join MDCV_E_T003O( p_auart : 'PI01' ) as aupi01 -- check existence of PI01 in T003O
on aupi01.auart = 'PI01'
left outer to one join t441r as pprule -- check existence of PP in T441R
on pprule.prreg = 'PP'
left outer to one join t441r as borule -- check existence of BO in T441R
on borule.prreg = 'BO'
left outer to one join MDCV_E_TCS41 as selid -- get selection ID for production BOMs
on tline = 1
{
key t001w.werks as werks,
case when t399d.fixpa is null then cast('X' as fixpa preserving type) else fixpa end as fixpa, -- default 'X'
case when t399d.fixba is null then cast('X' as fixba preserving type) else fixba end as fixba, -- default 'X'
case when t399d.fixbe is null then cast('X' as fixbe preserving type) else fixbe end as fixbe, -- default 'X'
case when t399d.umthz is null then cast('999' as umthz preserving type) else umthz end as umthz, -- default 999
case when t399d.vwvor is null then cast('00' as vwvor preserving type) else vwvor end as vwvor, -- default 0
case when t399d.vwver is null then cast('00' as vwver preserving type) else vwver end as vwver, -- default 0
case when t399d.plahz is null then cast('999' as plahz preserving type) else plahz end as plahz, -- default 999
coalesce (t399d.nkpaf, nrplaf.rangenr) as nkpaf, -- internal number range for PLAF
coalesce (t399d.nkban, nrbanf.rangenr) as nkban, -- internal number range for BANF
case when t399d.psban is null then cast('00010' as psban preserving type) else psban end as psban, -- default 10
coalesce (t399d.nkdis, nrmdtb.rangenr) as nkdis, -- internal number range for MDTB
coalesce (t399d.nkres, nrresb.rangenr) as nkres, -- internal number range for RESB
case when t399d.psres is null then cast('0100' as psres preserving type) else psres end as psres, -- default 100
case when t399d.bztek is null then cast('00' as bztek preserving type) else bztek end as bztek, -- default 0
case when t399d.erekg is null then cast(' ' as erekg ) else erekg end as erekg, -- default space
case when t399d.erdsg is null then cast(' ' as erdsg ) else erdsg end as erdsg, -- default space
case when t399d.mxbst is null then cast('999' as mxbst preserving type) else mxbst end as mxbst, -- default '999' --> could be replaced by a hard-coded program check
case when t399d.mxpla is null then cast('000' as mxpla preserving type) else mxpla end as mxpla, -- default '0' --> could be replaced by a hard-coded program check or no restriction at all
anzls, -- not needed
mxsta, -- not needed
coalesce (t399d.cslid, selid.cslid) as cslid, -- selection ID for production BOM
case when t399d.ktage is null then cast('X' as ktage preserving type) else ktage end as ktage, -- default 'X' --> alternative solution required (personalization)
case when t399d.kwoch is null then cast('X' as kwoch preserving type) else kwoch end as kwoch, -- default 'X' --> alternative solution required (personalization)
case when t399d.kmona is null then cast('X' as kmona preserving type) else kmona end as kmona, -- default 'X' --> alternative solution required (personalization)
case when t399d.kflpr is null then cast(' ' as kflpr preserving type) else kflpr end as kflpr, -- default ' ' --> alternative solution required (personalization)
case when t399d.kmrpp is null then cast(' ' as kmrpp preserving type) else kmrpp end as kmrpp, -- default ' ' --> alternative solution required (personalization)
case when t399d.mrrpp is null then cast(' ' as mrppp ) else mrrpp end as mrrpp, -- default ' ' --> alternative solution required (personalization)
case when t399d.krast is null then cast(' ' as krast preserving type) else krast end as krast, -- default ' ' --> alternative solution required (personalization)
case when t399d.prast is null then cast(' ' as prast ) else prast end as prast, -- default ' ' --> alternative solution required (personalization)
case when t399d.fixfa is null then cast('X' as fixfa preserving type) else fixfa end as fixfa, -- default 'X'
aplsl, -- not needed
lifkz, -- not needed
/*case when t399d.gterm is null then cast('X' as gterm) else gterm end as gterm, -- default 'X' --> does it make sense to switch this off? */
cast('X' as gterm preserving type) as gterm, -- constant 'X'
case when t399d.kzdrb is null then '3' else kzdrb end as kzdrb, -- default '3' --> not need in PMC
kntbe, -- unused
case when t399d.kntbu is null then cast('U' as kntbu preserving type) else kntbu end as kntbu, -- default 'U'
case when t399d.ktdbu is null then cast('U' as ktdbu preserving type) else ktdbu end as ktdbu, -- default 'U'
kzmal, -- not needed --> currently not supported
case when t399d.kzumb is null then cast('X' as kzumb preserving type) else kzumb end as kzumb, -- default 'X'
case when t399d.fixqm is null then cast('X' as fixqm preserving type) else fixqm end as fixqm, -- default 'X'
case when t399d.xfan1 is null then cast('X' as xfan1 preserving type) else xfan1 end as xfan1, -- default 'X'
xfan2, -- unused
case when t399d.xfan3 is null then cast(' ' as xfan3) else xfan3 end as xfan3, -- default space
coalesce (t399d.prreg, pprule.prreg) as prreg, -- default PP if it exists in T441R
coalesce (t399d.auart, aupp01.auart) as auart, -- default PP01 if it exists in T003O
case when t399d.fixla is null then cast('X' as fixla preserving type) else fixla end as fixla, -- default 'X'
coalesce (t399d.rprrg, borule.prreg) as rprrg, -- default BO if it exists in T441R
case when t399d.fedis is null then cast(' ' as fedis) else fedis end as fedis, -- default space
case when t399d.refwk is null then cast(' ' as refwk) else refwk end as refwk, -- default space
simpl, -- not needed
case when t399d.selfe is null then cast('X' as selfa preserving type) else selfe end as selfe, -- default 'X' --> shortage definition in FIORI apps
case when t399d.selbe is null then cast('X' as selbe preserving type) else selbe end as selbe, -- default 'X' --> shortage definition in FIORI apps
case when t399d.selqm is null then cast('X' as selqm preserving type) else selqm end as selqm, -- default 'X' --> shortage definition in FIORI apps
case when t399d.selba is null then cast('X' as selba preserving type) else selba end as selba, -- default 'X' --> shortage definition in FIORI apps
case when t399d.selpa is null then cast('X' as selpl preserving type) else selpa end as selpa, -- default 'X' --> shortage definition in FIORI apps
case when t399d.selzr is null then cast('X' as selzr preserving type) else selzr end as selzr, -- default 'X' --> shortage definition in FIORI apps
coalesce (t399d.nksbd, nrmdsm.rangenr) as nksbd, -- internal number range for MDSM
case when t399d.vertr is null then cast(' ' as vertr) else vertr end as vertr, -- default space
coalesce (t399d.auar2, aupi01.auart) as auar2, -- default PI01 if it exists in T003O
coalesce (t399d.nksaf, nrplaf.rangenr) as nksaf, -- internal number range for PLAF
case when t399d.wakhz is null then cast('000' as wakhz preserving type) else wakhz end as wakhz, -- default 0
case when t399d.exsgt is null then cast(' ' as exsgt) else exsgt end as exsgt, -- default space --> parameter in planning transactions
case when t399d.besal is null then cast(' ' as besal) else besal end as besal, -- default space
case when t399d.kastl is null then cast('X' as kastl preserving type) else kastl end as kastl, -- default 'X' --> not needed in PMC/maintainable in OP?
nkcrq, -- not needed
case when t399d.serep is null then cast(' ' as serep) else serep end as serep, -- default space
ikdpl, -- unused
case when t399d.selsb is null then cast(' ' as selsb) else selsb end as selsb, -- default space --> shortage definition in FIORI apps
case when t399d.nfvbc is null then cast('X' as nfvbc preserving type) else nfvbc end as nfvbc, -- default 'X'
case when t399d.compm is null then cast('X' as decompx preserving type) else compm end as compm, -- default 'X'
dbepl, -- unused
case when t399d.selpz is null then cast('X' as selpz preserving type) else selpz end as selpz, -- default 'X' --> shortage definition in FIORI apps
case when t399d.sella is null then cast('X' as sella preserving type) else sella end as sella, -- default 'X' --> shortage definition in FIORI apps
case when t399d.sbuff is null then cast(' ' as md_sbuff) else sbuff end as sbuff, -- default space
case when t399d.seliw is null then cast(' ' as seliw) else seliw end as seliw, -- default space --> Switch DIMP_GENERAL
dsada, -- unused? --> Switch DIMP_GENERAL
case when t399d.evapr is null then cast(' ' as md_evapr) else evapr end as evapr -- default space --> shortage profile in FIORI apps
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"MDCV_E_NRIV",
"MDCV_E_T003O",
"MDCV_E_TCS41",
"T001W",
"T399D",
"T441R"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/