08-14-2017 4:49 AM
Hi,
Can someone help me to select TOP N rows in ABAP CDS select statement. I tried LIMIT and TOP but doesnt work.
08-14-2017 5:12 AM
Hi Theerthan,
TOP and LIMIT statements are not supported in ABAP CDS views. You could alternatively use CDS Table Function(which calls a Abap ManagedProcedure function ) where these statements are supported .However you should make sure that your DB is HANA..
BR
Arshad
08-14-2017 5:12 AM
Hi Theerthan,
TOP and LIMIT statements are not supported in ABAP CDS views. You could alternatively use CDS Table Function(which calls a Abap ManagedProcedure function ) where these statements are supported .However you should make sure that your DB is HANA..
BR
Arshad
04-09-2018 5:33 PM
Doesn't it seem awful that your brand-new CDS promoted as hell, doesn't support such simple thing?
Good old OpenSQL supports this from early releases, I do not understand the profit of CDS.
03-03-2021 3:58 AM
dezmond06
I couldn't agree more. 2 years later and I am here looking for the same solution and there still seems to be nothing. There are some workarounds using table functions but it is just embarrassing that there is no "select single" or "select up to n rows" within ABAP CDS.
I am busy trying to refine a piece of work that has taken us months. It returns multiple records for a material one for each barcode. I only need one record for one barcode, the first one. But it can't be done. All the work is in a heirarchy of CDS Views so I cannot use the open SQL call in my program to implement the restriction. I feel like SAP said: "Trust us, do it all in CDS" and now after months of work they're going to say: "Yeah, everything... well except for that one basic requirement that everyone will need at some point." It is really frustrating.
03-27-2018 11:12 AM
A workaround for you, my friend
https://blogs.sap.com/2018/03/27/select-top-n-up-to-n-rows-order-by-in-a-abap-cds/
03-03-2021 3:52 AM
Have to say this is an enormous amount of work just because we're missing "select single" or "select up to 5 rows".
02-05-2021 12:54 PM
If you are using table control, then I would suggest you to use 'growing' properties (growing, growingThreshold etc.).