on 2023 Nov 10 7:10 AM
Dear community,
the following problem. My business case is to build a monitor like QM12 for company specific notifications. QMEL and QMSM data are display.
The user can filter by sales data, QMEL data, IHPA(notification partner) and QMSM (task partner) and task and notification status, so joins from QMSM and QMEL on table JEST.
Depending on the user input, I have to check JEST or /and IHPA, if the partner or status should be filtered or not.
So i planned to create a CDS View with assocations to only join to the appropriate tables when necessary.
I haved created following CDS View: (/wue/sop_complaints_salesrep is for sales data)
define view /wue/sop_complaints
as select from qmel as _notification
inner join qmsm as _tasks
on _notification.qmnum = _tasks.qmnum
association [1] to /wue/sop_complaints_salesrep as _sales_rep on _sales_rep.kunnr = _notification.kunum
association [1] to ihpa as _notification_partner on _notification.objnr = _notification_partner.objnr
association [1] to jest as _object_status_notification on _notification.objnr = _object_status_notification.objnr
association [1] to jest as _object_status_task on _tasks.objnr = _object_status_task.objnr
{
_notification.qmnum, _notification.qmart, _notification.erdat, _notification.ernam,
_notification.qmcod, _notification.qmtxt, _notification.matnr, _notification.zzartbez,
_notification.rkmng, _notification.lifnum, _notification.kunum, _notification.qmdat,
_notification.zzvbeln_vf as vbeln_vf,
_notification.zzbrutto_fi as brutto_fi,
_notification.zzmansp as mansp, _notification.vkorg, _notification.objnr,
_notification.kunum as customer,
_tasks.manum, _tasks.matxt, _tasks.parnr, _tasks.indtx,
_tasks.parvw as qmsm_parvw,
_tasks.parnr as qmsm_parnr,
_tasks.objnr as task_objnr,
_sales_rep,
_notification_partner,
_object_status_notification,
_object_status_task
}
where qmgrp = 'FCL'
and qmart = 'FC'
The problem is, if i write ONE select statement on this CDS View with the ranges from the selection screen (GUI) i have to check the assocations like this:
select distinct
qmnum, qmart, erdat, manum, ernam, qmcod, matxt, qmtxt, matnr, zzartbez,
rkmng, lifnum, kunum, parnr, qmdat, vbeln_vf, brutto_fi, mansp
from /wue/sop_complaints
where \_sales_rep-bukrs in @it_company_codes
and \_sales_rep-vtweg in @is_select_options-vtweg
and \_sales_rep-distr in @is_select_options-distr
and \_sales_rep-saber in @is_select_options-saber
and \_sales_rep-nlnum in @is_select_options-nlnum
and \_sales_rep-vknumbl in @is_select_options-vknumb
and \_sales_rep-bezir in @is_select_options-bezir
and \_sales_rep-vknum in @is_select_options-vknum
and \_sales_rep-rfuko in @is_select_options-zrfuko
and \_sales_rep-regio in @is_select_options-zregio
and \_sales_rep-rstan in @is_select_options-zrstan
and \_sales_rep-rgbtn in @is_select_options-zrgbtn
and vkorg in @is_select_options-vkorg
and qmnum in @is_select_options-notifications
and customer in @it_customers
and ernam in @is_select_options-creators
and erdat in @is_select_options-creation_dates
and qmsm_parnr in @it_task_partner
and qmsm_parvw in @it_task_partner_function
into table @rt_notifications.<br>
... just the example with \_sales_rep the other associations are missing here.
The result of my trace is, although all of the ranges are initial in my test, the join on the corresponding association is done.
Is there any possiblity to solve this problem and not write 10 select statements on this CDS View with 15 IF statements to check before?
Thanks in advance
Julian
Request clarification before answering.
User | Count |
---|---|
104 | |
39 | |
6 | |
5 | |
5 | |
3 | |
3 | |
2 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.