on 2020 Jun 16 9:40 AM
I know we can pass Select options from ABAP to CDS using table function and AMDP approach,
But as we know there are advantages of using core CDS and I was wondering that is there any approach where I can pass my select option to CDS view and consume it in CDS view only
Request clarification before answering.
Hello amit316chauhan
Condition generated from Select Options is passed to the DB server and handled on the DB side. Records are not filtered in the application server. Please read the SAP Help documentation when not sure.
I see no reason why the same thing shouldn't happen when querying data from a CDS view.
Kind regards,You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I Aggre that the condition passed is executed at DB layer
SELECT *
FROM z_cds_view
INTO TABLE @DATA(lt_result)
where field1 in s_field1. (Here Where Clause will be executed at DB level)
In Above code Complete z_cds_view will gets executed(lets say it retrieve 1Mil records) without filter first and then its result(1M records) will be filtered again (at DB level) by passing s_field1.
So the performance could have been improved if there would have been a way to pass select option directly at DB level, can you please comment on same?
Kind Regards
The WHERE condition will be applied by DB the way the optimizer can deal with the situation.
It will not pass non-matching records to the application server.
If it will process many records or not depends on a number of factors:
Here is an ugly but functional workaround. Assuming that you have a select option for BUKRS;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not exactly that, but putting data into temporary tables and joining via GUID's is something doable. We did that occasionally (before the era of CDS Views) when we needed to use SELECT SUM and FOR ALL ENTRIES together.
1) You also need to cleanse the old entries from time to time.
2) The table would be a Z-table, not a standard table.
amit316chauhan,
If you are looking for an alternate approach for using select option inside CDS other than AMDP, well i don't think you have a better approach.
On the other hand when you query upon a CDS using select query you can very well use the Select options on them just like how you use up on a back end table.
Are you expecting something else other than this? if so please explain.
Regards!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I understood the concept of applying select option in calling level at ABAP layer<br>
SELECT *
FROM z_cds_view
INTO TABLE @DATA(lt_result)
where field1 in s_field1.
here complete z_cds_view will be executed without any where clause at DB level woudn't it affect the performance, rather than paassing a filter directly to CDS?
amit316chauhan,
In that case CDS with table functions is the only known method so far.
Regards!
amit316chauhan,
When you apply a select option in CDS you are only applying the filter on ABAP layer after projecting the data from database, similar to what we do with normal Database tables in ABAP.
But with CDS with table functions we are pushing down the filter to the DB Layer.
So Yes, CDS with table functions has better performance.
Regards!
User | Count |
---|---|
80 | |
30 | |
10 | |
8 | |
7 | |
7 | |
6 | |
6 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.