@AbapCatalog.sqlViewName: 'FAAVDOCITCP03'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'KFC DOC_IT aggregation'
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #X
@ObjectModel.usageType.sizeCategory: #XXL
define view FAA_SDM_DOCIT_CP03
as select from faat_doc_it as doc_it
left outer join faac_kfc_spec as kfc_spec on kfc_spec.movcat = doc_it.movcat
and kfc_spec.slalittype = doc_it.slalittype
{
key doc_it.bukrs,
key doc_it.gjahr,
key doc_it.anlkl,
key case
when kfc_spec.key_figure_code is null then 'NULL'
else kfc_spec.key_figure_code
end as key_figure_code,
key cast( '10' as fis_selected_currency_branch ) as SelectedCurrencyBranch,
@Semantics.currencyCode: true
key cast( doc_it.rhcur as vdm_v_display_currency ) as DisplayCurrency,
@Semantics.amount.currencyCode: 'DisplayCurrency'
cast( sum( doc_it.hsl ) as farp_amount_display_crcy ) as AmountInDisplayCurrency
}
where
doc_it.sdm_status = '19'
group by
doc_it.bukrs,
doc_it.gjahr,
doc_it.anlkl,
kfc_spec.key_figure_code,
doc_it.rhcur
union select from faat_doc_it as doc_it
left outer join faac_kfc_spec as kfc_spec on kfc_spec.movcat = doc_it.movcat
and kfc_spec.slalittype = doc_it.slalittype
{
key doc_it.bukrs,
key doc_it.gjahr,
key doc_it.anlkl,
key case
when kfc_spec.key_figure_code is null then 'NULL'
else kfc_spec.key_figure_code
end as key_figure_code,
key cast( '30' as fis_selected_currency_branch ) as SelectedCurrencyBranch,
@Semantics.currencyCode: true
key cast( doc_it.rkcur as vdm_v_display_currency ) as DisplayCurrency,
@Semantics.amount.currencyCode: 'DisplayCurrency'
cast( sum( doc_it.ksl ) as farp_amount_display_crcy ) as AmountInDisplayCurrency
}
where
doc_it.sdm_status = '19'
group by
doc_it.bukrs,
doc_it.gjahr,
doc_it.anlkl,
kfc_spec.key_figure_code,
doc_it.rkcur
union select from faat_doc_it as doc_it
left outer join faac_kfc_spec as kfc_spec on kfc_spec.movcat = doc_it.movcat
and kfc_spec.slalittype = doc_it.slalittype
{
key doc_it.bukrs,
key doc_it.gjahr,
key doc_it.anlkl,
key case
when kfc_spec.key_figure_code is null then 'NULL'
else kfc_spec.key_figure_code
end as key_figure_code,
key cast( 'F1' as fis_selected_currency_branch ) as SelectedCurrencyBranch,
@Semantics.currencyCode: true
key cast( doc_it.rocur as vdm_v_display_currency ) as DisplayCurrency,
@Semantics.amount.currencyCode: 'DisplayCurrency'
cast( sum( doc_it.osl ) as farp_amount_display_crcy ) as AmountInDisplayCurrency
}
where
doc_it.sdm_status = '19'
group by
doc_it.bukrs,
doc_it.gjahr,
doc_it.anlkl,
kfc_spec.key_figure_code,
doc_it.rocur
union select from faat_doc_it as doc_it
left outer join faac_kfc_spec as kfc_spec on kfc_spec.movcat = doc_it.movcat
and kfc_spec.slalittype = doc_it.slalittype
{
key doc_it.bukrs,
key doc_it.gjahr,
key doc_it.anlkl,
key case
when kfc_spec.key_figure_code is null then 'NULL'
else kfc_spec.key_figure_code
end as key_figure_code,
key cast( 'F2' as fis_selected_currency_branch ) as SelectedCurrencyBranch,
@Semantics.currencyCode: true
key cast( doc_it.rvcur as vdm_v_display_currency ) as DisplayCurrency,
@Semantics.amount.currencyCode: 'DisplayCurrency'
cast( sum( doc_it.vsl ) as farp_amount_display_crcy ) as AmountInDisplayCurrency
}
where
doc_it.sdm_status = '19'
group by
doc_it.bukrs,
doc_it.gjahr,
doc_it.anlkl,
kfc_spec.key_figure_code,
doc_it.rvcur