Skip to Content
avatar image
-1
Former Member

Field name inside CDS

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Nov 08, 2017 at 05:21 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 10, 2017 at 04:34 PM

    Thank you .

    Add comment
    10|10000 characters needed characters exceeded