Skip to Content
-1

Field name inside CDS

Nov 08, 2017 at 04:27 PM

71

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Horst Keller
Nov 08, 2017 at 05:21 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Nov 10, 2017 at 04:34 PM
0

Thank you .

Share
10 |10000 characters needed characters left characters exceeded