cancel
Showing results for 
Search instead for 
Did you mean: 

Query CDS view with table as input

Khushdeep
Explorer
0 Kudos

Hi Expert,

I have a requirement where I have to pass table as input to CDS View and query it.

similar to ABAP query like this:

select * from table_name for all entries in input_table where column_name1 = input_table-column_name into table result_table.

here in above query, as we provide input_table as an input based on which , the matching rows are queried.

So in CDS View, is there a similar SQL query where I can pass a table as an input.

Regards,

Khushdeep

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member194416
Contributor
0 Kudos

Hi Khushdeep,

I am using CDS's for quite some time, I can not really imagine such case that you mentioned. In my opinion instead of using a internal table as input you may try to put the logic which creates the internal table in your CDS using joins etc or If you will call the view via ABAP you can use  below alternative in ABAP Select ( Open SQL ) to have for all entries logic.

"Select * from cds_view for all entries in internal table"

Regards,

Gungor

pfefferf
Active Contributor
0 Kudos

Hello Khushdeep,

in a CDS view the table name cannot be specified in a dynamic way. The only - very ugly and therefore not recommend - option would be the usage of a CDS table function available since NW 7.50 ().

You could pass the table name and do a dynamic select. But the interface of the table functions of course must still have a fix interface.

Regards,

Florian