cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to select data from a Dynamic table in CDS view ABAP

former_member462348
Participant
0 Kudos
1,935

Hi Expats

have a requirement to perform a select on a dynamic table in CDS view.

Table has name like /01/MDG/SID(SID is the systemID in suffix) so that table name gets changed in QA and PROD based on the system ID.

So in this case, how I can perform a select data from this table using CDS view ? My Final table name will be /01/MDG/DEV, where DEV represent the Development system ID.

when this object is moved to QA, it has a table name like /01/MDG/QAS.

The requirement is to achieve this using CDS view.

Thanks
Rufus Samuel

Accepted Solutions (0)

Answers (1)

Answers (1)

SvenS
Participant
0 Kudos

Normally in ABAP you were able to use SY-SYSID, however if I remember correctly this is not possible anymore in CDS views, only session variables left are client, user, language and date. If I remember correctly we can use a lookup of table TADIR based on the Object = 'SYST' and PGMID = 'HEAD' to get the system of our current environment fetching the SRCSYSTEM column.

With another customer the environment names didn't align with the system names, so we had to hard code an if else to set the name (not the prettiest solution, but it did the job).