@AbapCatalog.sqlViewName: 'FMLV_RELIND_BWKE'
@AbapCatalog.compiler.compareFilter: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.ignorePropagatedAnnotations: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ObjectModel.usageType.serviceQuality: #P
@EndUserText.label: 'ML Relevant Indicators per Bwkey'
//--------------------------------------------------------------------------------------------
// Per each valuation area:
// The view shows the ML relevant indicator. The relevant indivator is set in a
// FINSC_LD_CMP - cell ( Ledger / Currency Group ), if the corrspodning currency is a ML
// Currency and if the ledger is a basis ledger and if the fiscal year variant is
// the same as for the compay.
//
// ATTENTION: to be used only in scenarios where CKMLCT is still reliable
// - parallel accounting = OFF
// - during migration / XPRA phase
//--------------------------------------------------------------------------------------------
define view Fml_Relind_Bwkey
as
select from finsc_ld_cmp as f
// Join to T001 entry for correct BUKRS-PERIV
inner join t001 as t on f.mandt = t.mandt
and f.bukrs = t.bukrs
and f.periv = t.periv
// Join to T001K (we need one entry per RLDNR and BWKEY)
inner join t001k as k on f.mandt = k.mandt
and f.bukrs = k.bukrs
// Join to FINSC_LEDGER (Take only Standard Ledger)
inner join I_Ledger as l on f.mandt = l.mandt
and f.rldnr = l.Ledger
and l.LedgerType = ' '
// Try to add ML curtp to H-Group
left outer join ckmlct as mlh on f.mandt = mlh.mandt
and k.bwkey = mlh.bwkey
and f.curtph = mlh.curtp
// Try to add ML curtp to K-Group
left outer join ckmlct as mlk on f.mandt = mlk.mandt
and k.bwkey = mlk.bwkey
and f.curtpk = mlk.curtp
// Try to add ML curtp to O-Group
left outer join ckmlct as mlo on f.mandt = mlo.mandt
and k.bwkey = mlo.bwkey
and f.curtpo = mlo.curtp
// Try to add ML curtp to V-Group
left outer join ckmlct as mlv on f.mandt = mlv.mandt
and k.bwkey = mlv.bwkey
and f.curtpv = mlv.curtp
// Try to add ML curtp to B-Group
left outer join ckmlct as mlb on f.mandt = mlb.mandt
and k.bwkey = mlb.bwkey
and f.curtpb = mlb.curtp
// Try to add ML curtp to C-Group
left outer join ckmlct as mlc on f.mandt = mlc.mandt
and k.bwkey = mlc.bwkey
and f.curtpc = mlc.curtp
// Try to add ML curtp to D-Group
left outer join ckmlct as mld on f.mandt = mld.mandt
and k.bwkey = mld.bwkey
and f.curtpd = mld.curtp
// Try to add ML curtp to E-Group
left outer join ckmlct as mle on f.mandt = mle.mandt
and k.bwkey = mle.bwkey
and f.curtpe = mle.curtp
// Try to add ML curtp to F-Group
left outer join ckmlct as mlf on f.mandt = mlf.mandt
and k.bwkey = mlf.bwkey
and f.curtpf = mlf.curtp
// Try to add ML curtp to G-Group
left outer join ckmlct as mlg on f.mandt = mlg.mandt
and k.bwkey = mlg.bwkey
and f.curtpg = mlg.curtp
{
f.mandt as mandt,
f.rldnr as rldnr,
f.bukrs as bukrs,
k.bwkey as bwkey,
// Determine CURTPH and MLRELINDH
f.curtph as curtph,
case when mlh.curtp is null then ' '
else 'X' end as mlrelindh,
// Determine CURTPK and MLRELINDK
f.curtpk as curtpk,
case when mlk.curtp is null then ' '
else 'X' end as mlrelindk,
// Determine CURTPO and MLRELINDO
f.curtpo as curtpo,
case when mlo.curtp is null then ' '
else 'X' end as mlrelindo,
// Determine CURTPV and MLRELINDV
f.curtpv as curtpv,
case when mlv.curtp is null then ' '
else 'X' end as mlrelindv,
// Determine CURTPB and MLRELINDB
f.curtpb as curtpb,
case when mlb.curtp is null then ' '
else 'X' end as mlrelindb,
// Determine CURTPC and MLRELINDC
f.curtpc as curtpc,
case when mlc.curtp is null then ' '
else 'X' end as mlrelindc,
// Determine CURTPD and MLRELINDD
f.curtpd as curtpd,
case when mld.curtp is null then ' '
else 'X' end as mlrelindd,
// Determine CURTPE and MLRELINDE
f.curtpe as curtpe,
case when mle.curtp is null then ' '
else 'X' end as mlrelinde,
// Determine CURTPF and MLRELINDF
f.curtpf as curtpf,
case when mlf.curtp is null then ' '
else 'X' end as mlrelindf,
// Determine CURTPG and MLRELINDG
f.curtpg as curtpg,
case when mlg.curtp is null then ' '
else 'X' end as mlrelindg
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_LEDGER",
"CKMLCT",
"FINSC_LD_CMP",
"T001",
"T001K"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/