Skip to Content
Author's profile photo Rahul Anand

SAP HANA ABAP: CDS/AMDP – The Real Picture

CDS and AMDP have been talk of the town since long time. SAP HANA Developers are trying their level best to try their hands on both of these artifacts. Not to mention they face a lot of challenges while achieving all their reporting requirements using these, which were being done at ABAP layer( SE38 ) previously


  1. In understanding what’s the difference between the performance of a simple select query which is written at the ABAP Layer and the same select query written at the DB layer using CDS or AMDP using SQL Script Code.
  • If we consider the ease of programming, for the ABAP developers its always an easy task       to write the code at SE38 SAP GUI using Open SQL. And after ABAP New Syntax ( NW 7.4 Onwards ) ease of programming at ABAP layer has taken a drastic up-gradation.
  • We can perform most of the magic which SQL Script code provides at the ABAP layer itself using ABAP New Syntax.
  • Ultimately both the select queries( ABAP Layer query, SQL Script query) get executed at the DB Layer only. The only difference which I could perceive is that we are writing the code at DB Layer using SQLScript and in case of Open SQL its at ABAP Layer.
  1. If I want to use CDS for reporting, how I am going to handle the select option which        we declare at ABAP Layer. Although SAP has provided this feature to handle the parameters which we declare at (Selection Screen ) in CDS.

           Most of us who are acquainted with CDS knows , whenever we create a CDS, two types                                  views are created:

  • DDL SQL View ( Which is a Data Dictionary Object, we can view is using SE11 transaction at SAP GUI just like other traditional Views of Data Dictionary ). However, in a non-editable form.
  • CDS View Entity (We cannot open it using SE11 Transaction, can only be viewed at   ADT ABAP perspective at eclipse environment. This is the main CDSview entity.

           This question is always asked that “How to handle Select-Options in CDS? “There are two                            ways, one of which is 99% correct:

  • CDS views are just like another Data Dictionary Object in ABAP repository, so you can directly write a select query on the CDS view with where clause using in operator in case you want to filter the records from the CDS view based on a select-option. This way is   same as selecting from a table with where condition in SE38 programming.
  • Define a CDS view with parameters, having two parameters of the same type.For eg: if we need to handle a select option of type matnr. Then CDS view should have two parameter of type matnr. And in the where condition in the SQL script code of CDS write:      

  • Pass the low value of select option declared at the selection screen  to one of the CDS parameter and the high value to another parameter. There is just one issue with this method, that it will not handle the Select option if the user enters multiple values in the select option using single value entry tab at selection-screen.
  1.  In case of AMDP,you can find many blogs sharing a way out to handle select-options using dynamic where clause. We can create dynamic where clause using the class Cl_SHDB_SELTAB, however SAP Note 2124672 has to be applied to make this class available. Even if this class is not available you can use CL_LIB_SELTAB to create a dynamic where clause to be passed to the AMDP method. Although the latter is an obsolete class.

                        ex_data =  APPLY_FILTER ( :ex_data, :so_werks );

  •   where so_werks is the dynamic where clause created on SE38 using the above mentioned   class. And ex_data is the final output table.
  •   We write SQLScript code inside the AMDP method. There, if we compare the select on a          single table and APPLY_FILTER clause. The question arises, which works faster. If we have    to select from a single table on the basis of a single where clause. We can use both:

  1.  If I want to develop a complex report, where 6-7 tables and a couple of business logic is involved, considering the newly introduced features of New ABAP Syntax, should we use CDS or AMDP. Or, should we follow the traditional approach SE38, Open SQL Programming.
  •  If I am well acquainted with SQL Script programming paradigm and can leverage all the rich    operators and feature of SQL Script I would go for AMDP or CDS. And if I am well versed with  the usage of Annotations / Semantics and SQL Script I would prefer CDS. If I am a beginner I  would definitely prefer Open SQL traditional approach if the performance is not the top level    priority.

Still there is a lot to explore!

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Shivam Shukla
      Shivam Shukla

      Awesome blog - Very helpful , Keep publishing on ABAP on HANA




      Author's profile photo P. Bhagaban
      P. Bhagaban

      nice bro.


      Author's profile photo Monika Patel
      Monika Patel

      Great blog. Thx for sharing

      Author's profile photo Rahul Anand
      Rahul Anand
      Blog Post Author

      Thank you!


      Author's profile photo Douglas Santos
      Douglas Santos

      Excellent. I’m an enthusiast with ABAP New Syntax. Where can we get more information on how to create a report using AMDP or CDS?

      Hugs, Douglas

      Author's profile photo Rahul Anand
      Rahul Anand
      Blog Post Author

      Hi Douglas.

      Although there are a lot of information available over the internet, here are couple of links

      which would be helpful to start with:

      1. ABAP New Syntax:
      2. CDS/ AMDP:

      Please let me know if you need any more help.


      Author's profile photo rahul reddy
      rahul reddy

      How to handle the Select-Options in CDS view?

      Author's profile photo Joachim Rees
      Joachim Rees

      Well, thats mentioned right in the blog?!

      In short:  select from CDS just as you would from a DB table:

      Select * from [my_cds]
      where matnr in so_mta


      Author's profile photo Joachim Rees
      Joachim Rees

      I don't like this approach:

      Define a CDS view with parameters, having two parameters of the same type.For eg: if we need to handle a select option of type matnr. Then CDS view should have two parameter of type matnr. And in the where condition in the SQL script code of CDS write:

      1. the drawback you mentioned (it doesn't represent the full features of select option)
      2. with the > and < given in you screenshot, you wouldn't hit the full reange (1 to 8 would onle result in 2 to 7) -> it should be >= and <= .
      Author's profile photo Neha Ankush
      Neha Ankush

      Really Nice Blog ! I want to ask that we can also achieve Select-options in CDS using Table Functions ?