ABAP CDS Filtering ile ilgili kod.
Ön koşullar
1. ABAP CDS yaratma
2. SAP EPM
3. ABAP CDS Associations
Senaryo
Faturanın ilk kalem tutarını ve sadece 01 müşteri rolüne sahip olan müşterileri listeleyen ayrı bir fatura raporu.
Base CDS View
@AbapCatalog.sqlViewName: 'ZZXB_V_ASSFILTBS'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Association filter base CDS örneği'
define view zzxb_cdsv_filter_base as
select from snwd_so_inv_head as invoice_header
association[1..*] to snwd_so_inv_item as invoice_items
on $projection.header_guid = invoice_items.parent_key
{
invoice_header.so_guid as order_guid,
invoice_header.node_key as header_guid,
invoice_items
}
Consumer CDS View
@AbapCatalog.sqlViewName: 'ZZXB_V_ASSFILTCS'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Association filter consumer CDS örneği'
define view zzxb_cdsv_filter_consumer as
select from snwd_so as so
association [1] to snwd_bpa as bpa
on so.buyer_guid = bpa.node_key
association [0..1] to zzxb_cdsv_filter_base as filter_base
on so.node_key = filter_base.order_guid
{
key so.so_id as order_id,
bpa[ bp_role = '01' ].company_name as customer_name,
filter_base.invoice_items[ inv_item_pos = '0000000010'].gross_amount,
filter_base.invoice_items[ inv_item_pos = '0000000010'].currency_code
}