Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Use Select Options for CDS views in ABAP (Open SQL)

former_member195698
Active Contributor
0 Kudos
5,060

Hello,

I am new to CDS views in ABAP Dictionary so not sure whether my question is basic or complicated.

I want to create a CDS view in ABAP by joining 5-6 tables based on certain conditions and then retrieve the information from this view in my Report by passing the Select Options defined in the Report selection screen.

My Queries

a. Is the CDS view similar to a Normal Database view ?

b. Can I use IN select-option in my Open SQL statement to fetch information from CDS view ... e.g

   SELECT f1 f2 f3 from CDS-View into Internal-Table where f1 in so_f1

c. Is it possible to have a CDS view and code it similar to Procedure in HANA where I can make join on 2 tables and get the results in a Temp table and then again join the Temp table and a third table and fetch the results in Temp2 table?

d. If point c. is not possible in CDS view then my question is How can I pass a Select option (multiple options) to a AMDP Procedure and use that in my query to fetch the information from database

Regards,

Abhishek

1 ACCEPTED SOLUTION

sundaresan_k
Advisor
Advisor
0 Kudos
700

Dear Abhishek,

  1. Yes, the CDS views are similar to normal database views you create from the ABAP dictionary but with much more advanced features
  2. Yes, you can use the normal Open SQL syntax and all normal Open SQL constructs to select data from a ABAP CDS view. Note that when selecting from CDS entities in OPEN SQL, the new OPEN SQL syntax must be used. For more information about the new OPEN SQL syntax, see the ABAP keyword documentation
  3. You can not code a CDS view similar to coding in a HANA Procedure. But with the support for expressions, joins and associations and other built-in functions you may be able achieve the intended result with CDS. For more information please refer to the documentation on Keywords and Additions supported in CDS
  4. If you still need to use AMDP and want to understand more on how to pass SELECT-OPTIONs to a HANA Procedure this document might be helpful to you.

You can find more information and follow more discussions on ABAP on HANA related topics in the dedicated ABAP on HANA SCN Community

Hope this information is helpful.

Best regards

Sundar

2 REPLIES 2

Kiran_Valluru
Active Contributor
0 Kudos
700

Hi,

As far I knew there is no provision for Select options in CDS View. Instead you can have Input parameters in CDS view.

So, you can create 2 input parameters( one for passing low value and the other for high value) And then in the where clause use <field_name> >= low_value and <field_name> <= high_value.

And you can consume that CDS view in another CDS view or in openSQL.

hope this helps,

Regards,

Kiran

sundaresan_k
Advisor
Advisor
0 Kudos
701

Dear Abhishek,

  1. Yes, the CDS views are similar to normal database views you create from the ABAP dictionary but with much more advanced features
  2. Yes, you can use the normal Open SQL syntax and all normal Open SQL constructs to select data from a ABAP CDS view. Note that when selecting from CDS entities in OPEN SQL, the new OPEN SQL syntax must be used. For more information about the new OPEN SQL syntax, see the ABAP keyword documentation
  3. You can not code a CDS view similar to coding in a HANA Procedure. But with the support for expressions, joins and associations and other built-in functions you may be able achieve the intended result with CDS. For more information please refer to the documentation on Keywords and Additions supported in CDS
  4. If you still need to use AMDP and want to understand more on how to pass SELECT-OPTIONs to a HANA Procedure this document might be helpful to you.

You can find more information and follow more discussions on ABAP on HANA related topics in the dedicated ABAP on HANA SCN Community

Hope this information is helpful.

Best regards

Sundar