@AbapCatalog.sqlViewName: 'FMLV_RELIND'
@ClientHandling.algorithm: #AUTOMATED
@Metadata.ignorePropagatedAnnotations: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #M
@ObjectModel.usageType.dataClass: #MIXED
@AbapCatalog.compiler.compareFilter: true
@EndUserText.label: 'ML Relevant Indicators'
// ATTENTION: to be used only in scenarios where CKMLCT is still reliable
// - parallel accounting = OFF
// - during migration / XPRA phase
// The following CDS view create the ML relevant indicators which are no longer persisted in the FINSC_LD_CMP.
define view Fml_Relind as
select from finsc_ld_cmp as f
// Join FINSC_LD_CMP entry with 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 FINSC_ACTVE_APPL (Take only ledger for active application), I_Ledger can not be used here due to client handling
inner join finsc_actve_appl as appl
on f.mandt = appl.mandt
// Join to FINSC_LEDGER (Take only Standard Ledger), I_Ledger can not be used here due to client handling
inner join finsc_ledger as l
on f.mandt = l.mandt
and f.rldnr = l.rldnr
and l.ledger_type = ' '
and l.appl = appl.appl
and l.subappl = appl.subappl
// Try to add ML curtp to H-Group
left outer join Fml_Curtp_Bukrs as mlh
on f.mandt = mlh.mandt
and f.bukrs = mlh.bukrs
and f.curtph = mlh.curtp
// Try to add ML curtp to K-Group
left outer join Fml_Curtp_Bukrs as mlk
on f.mandt = mlk.mandt
and f.bukrs = mlk.bukrs
and f.curtpk = mlk.curtp
// Try to add ML curtp to O-Group
left outer join Fml_Curtp_Bukrs as mlo
on f.mandt = mlo.mandt
and f.bukrs = mlo.bukrs
and f.curtpo = mlo.curtp
// Try to add ML curtp to V-Group
left outer join Fml_Curtp_Bukrs as mlv
on f.mandt = mlv.mandt
and f.bukrs = mlv.bukrs
and f.curtpv = mlv.curtp
// Try to add ML curtp to B-Group
left outer join Fml_Curtp_Bukrs as mlb
on f.mandt = mlb.mandt
and f.bukrs = mlb.bukrs
and f.curtpb = mlb.curtp
// Try to add ML curtp to C-Group
left outer join Fml_Curtp_Bukrs as mlc
on f.mandt = mlc.mandt
and f.bukrs = mlc.bukrs
and f.curtpc = mlc.curtp
// Try to add ML curtp to D-Group
left outer join Fml_Curtp_Bukrs as mld
on f.mandt = mld.mandt
and f.bukrs = mld.bukrs
and f.curtpd = mld.curtp
// Try to add ML curtp to E-Group
left outer join Fml_Curtp_Bukrs as mle
on f.mandt = mle.mandt
and f.bukrs = mle.bukrs
and f.curtpe = mle.curtp
// Try to add ML curtp to F-Group
left outer join Fml_Curtp_Bukrs as mlf
on f.mandt = mlf.mandt
and f.bukrs = mlf.bukrs
and f.curtpf = mlf.curtp
// Try to add ML curtp to G-Group
left outer join Fml_Curtp_Bukrs as mlg
on f.mandt = mlg.mandt
and f.bukrs = mlg.bukrs
and f.curtpg = mlg.curtp
{
key f.rldnr as rldnr,
key f.bukrs as bukrs,
// 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":
[
"FML_CURTP_BUKRS",
"FINSC_ACTVE_APPL",
"FINSC_LD_CMP",
"FINSC_LEDGER",
"T001"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/