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: 

Field name inside CDS

former_member182337
Participant
0 Kudos
731

Hello,

How can i get run time information of the field name inside CDS. For example: Select a.matnr from mara as a .... I know the field name is Matnr but my requirement is to look the field ( Note : Field and not its value) in another table and if that exists the value should be replaced something like this

select a.matnr....from ( case when a.matnr ( select field from 'TABLE' where fieldname = a.matnr ) then ' Table value' else a.matnr

I can hardcode the fieldname as 'MATNR' in the sub select but the problem is i have more than 200 fields and then i have to do the select as many times. Is there a way to identify the field name without having to hardcode .

Thanks.

Prem

1 ACCEPTED SOLUTION

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos
215

No. ABAP CDS SQL is static. And there are also no subqueries in ABAP CDS.

For things like that, try to use SQLScript in CDS table functions or use the dynamic clauses of Open SQL.

2 REPLIES 2

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos
216

No. ABAP CDS SQL is static. And there are also no subqueries in ABAP CDS.

For things like that, try to use SQLScript in CDS table functions or use the dynamic clauses of Open SQL.

former_member182337
Participant
0 Kudos
215

Thank you .