Technical Articles
New ADT feature – Creating ABAP CDS objects with reference to tables or other CDS views
Updates:
- added prerequisites section
Prerequisites
- ADT 3.12 or later
- SAP S/4 HANA 1909 or later
- SAP Cloud Platform ABAP Environment
Feature overview
With the latest ADT version (3.12) a feature became available that I have been waiting for a long time.
Though it has been listed in “What’s new in SAP Cloud Platform” it could happen that this useful feature would not get the attention it deserves.
” …When creating, for example, a data definition, you can now refer to an existing CDS object or database table. This enables you to insert all elements of a referenced object in your new CDS object to be created.”
But its actually not a feature that is only available for SAP Cloud Platform.
It is also available for SAP S/4HANA 1909 and higher.
It does unfortunately not work with older releases (I tested 740, 750 and 751).
So when you now right-click on a table and select “New Data Defintion” from the context menu.
In the next window the New Data Definition dialog opens that now offers the new input field Referenced Object.
Since I started the wizard from the context menu of a table the field is prefilled with the table name /DMO/TRAVEL.
In the following you can select the template that you want to use. I am using here the new view entity type that does not require to create a DDIC structure alongside with the CDS view.
and volià, (surprise, surprise) the DDL source code editor opens with all fields of the table filled in the define section.
—- LAB-PREVIEW —-
With an upcoming version of the ADT tools this wizard will be enhanced such, that it will also add aliases for the abap field names of a table.
The result will then look like this.
define view entity ztravel as select from /DMO/TRAVEL {
key travel_id as TravelId,
agency_id as AgencyId,
customer_id as CustomerId,
...
—- LAB-PREVIEW —-
That seems really useful for consumption views!
Interesting that it does not depend on the backend release, so I might be able to use it on 7.4. I remember seeing a similar feature in the autocomplete dropdown when adding new fields manually to "Insert all fields of table/view ...". That one however is dependent on the backend as I do not have it on 7.4.
Hi André,
unfortunatelly it depends on the backend version:
7.50

7.52
Cheers, Uwe
I'll check this.
It doesn't work neither on 7.50 nor on S/4 HANA on premise 1909.
So it seems to be SAP Cloud Platform only. Maybe you should edit your post.
Kind regards
Kai
Which ADT version do you use?
I tested in successfully with a demo system running on SAP S/4 HANA FPS00.
And I used the latest ADT 3.12 installation available for customers via the ADT update site.
I have to confirm that it doesn't work for 740, 750 and 751.
But it works for SAP S/4HANA 1909 (=754).
For me I didn't work till we upgraded to S/4 2020 (755) but thanks a lot for sharing!
Yes, I believe it is only applicable on S/4HANA 2020 (755).
ABAP CDS in Release 7.55 -> https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abennews-755-abap_cds.htm#!ABAP_MODIFICATION_2@2@
I tried on 1909 (754) Developer Edition, it doesn't work.
Very useful! Thanks Andre for sharing !!
This is definitely a useful feature esp when creating consumption views that spawn out of SAP Standard views. We have this feature available in both 1709 and 1909 versions so I'm inclined to side with @Andre Fischer on this being an ADT feature independent of the S4 HANA back-end release.
It deserves a real attention as you mentioned! Thanks for creating awareness on us of this new feature!
Best,
Merve
Really like this. Would love to see more wizards where you can enter the table names and select whether you want a join (and what type) or an association. You can also select from the fields to set the join/association ON conditions. This could then auto-populate the CDS. Less "admin" type programming. Hope this is not considered a criticism, you guys are doing a great job.
Very useful!! Thanks for sharing
With ADT 3.12 the field “Referenced Object” can be used starting with backend release 7.52.
Cool!
Hi Andre,
i used the view creation with alias to create a basic view.
Now when i am creating a consumption view based on my basic view this gives activation errors
due to the alias as it is not known?
Any idea on this?
Kind regards
Robert
Can you please provide more details ?
Which release of ADT tools do you use?
What is the release of your backend?
What is the exact error message?
And please post this as a question in the Q&A section. It's fine to post the link here.
Hi Andre,
it let to this problem
https://help.sap.com/viewer/cc0c305d2fab47bd808adcad3ca7ee9d/1809BW.001/en-US/563f9fa4c9c24b579cfd7f8397f78f2a.html
as we would like to generate a BOPF Object for it.
We are on S/4 2020 - no FP - NO RAP 🙁
ADT is up-to-date 3.24.0
Kind regards
Robert
As I said. Please create a question. The comment section of a blog is not the place to discuss such detailed problems.
And again you should provide more details because without the same there is no point anybody can help you.
Hi Andre,
i created now a https://answers.sap.com/questions/13595112/cds-activation-not-possible-because-of-semantic-ke.htmlquestion as it is blocking our development for weeks.
Can you please help us here?
Kind regards
Robert