Contributed by: Mohsin Ahmed Mohammed, Senior SAP ABAP/HANA Consultant @ CapGemini
By now, we all have pretty good clarity that CDS Views, AMDP and Open SQL are not competitors to each other. They all help us to achieve the ‘Code to Data’ Paradigm shift. They are different tools for the same team and they all can co-exist.
Yes, all these are used for fetching data from Database. But we have to use the appropriate tool based on the requirements. Remember, if a needle (read SQL) can do your job then why worry about a sword (read CDS / AMDP). Similarly, if the job can be done ONLY by the needle then you cannot achieve the same result using the sword. After all, “Discretion is the better part of valor“. 🙂
Below is some basic guideline to determine the most appropriate “Code to Data” Technique.
i) Only ONE result set can be returned from a CDS View
ii) CDS views amount to least amount of coding with the ability to be reused in multiple objects across developments. In another word, it’s a database artifact that can be consumed across objects/applications
iii) It uses IDA class of SAP GUI hence much faster (kind of paging technique )
Interdependent SQL queries which will be used across applications (programs/object) are the best example for choosing CDS Views
i) Independent SQL Statement those are not often used in other objects
ii) MULTIPLE result sets are needed
iii) Powerful features of native SQL such as currency conversion and CE functions can be leveraged.
i) If the SQL queries are for the specific object and won’t be needed elsewhere (not reusable)
We cannot create an official guide to determine the Order of Preference for Code Push down. 🙂 But, practically they can have the below order:
1) Open SQL or CDS views
What about the order of preference between Open SQL Vs. CDS?
When it comes to reusability, large feature set and domain-specific consumption of data models, then we should go for ABAP CDS. If CDS Views and SQL can achieve the same functionality, then go ahead with the CDS View (which is already there in the system).
If a CDS does not exist and you need this SQL only in one program, do not take the hassle of creating a CDS which would never be used again in another application. Just go ahead and write your Open SQL.
Please note: Both Open SQL and CDS are OPEN to any underlying database i.e. they are Platform Independent. And therefore they are the first choice.
Also Read: Are Native SQL and Open SQL Competitors?
If you still doubt our above justification and explanation, then the below Flow Chart from SAP would help you make the better judgment with confidence. 😛
Before we close, as mentioned in our earlier article New Age Open SQL ABAP 740, at the end of the day, whichever one works best for your project, team and application, use it. The end user would not see any difference in usability and result. It is all about maintenance and knowledge of your technical team members.
If you want to get such useful articles directly to your inbox, please SUBSCRIBE. We respect your privacy and take protecting it seriously.
If you liked this post, please hit the share buttons and like us on facebook.
Do you have anything to add to this article? Have you faced any issue using Open SQL, CDS View or AMDP? Do you want to share any real project requirement or solutions? Please do not hold back. Please leave your thoughts in the comment section.
Thank you very much for your time!!
You might like to check the Popular and Effective Tutorials in SAPYard
1. ABAP for SAP HANA Tutorials
2. ABAP Web Dynpro Tutorials
3. GOS Tutorial
4. OOPs ABAP Tutorial
5. HANA Tutorial
6. SAP Netweaver and OData Tutorial
7. SAP Adobe Form Tutorial
8. SAP Fiori Tutorial
9. SAPUI5 Tutorial
About the Author: Mohsin Ahmed Mohammed
Mohsin is a Computer Science Engineer by education and profession, with more than 10 years of experience in SAP. Currently, he is working at Capgemini as a Senior Technical Consultant. He loves watching movies and his favorites in the recent past are Whiplash, Bajirao Mastani. He is very fond of long drives. Not only does he experiment with ABAP, HANA, OData etc at work but also experiments at his kitchen with new and crazy recipes.
Find more about him on LinkedIn.