Skip to Content
Technical Articles
Author's profile photo Andre Fischer

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 —-

Assigned tags

      15 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Fabian Lupa
      Fabian Lupa

      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.

      Author's profile photo Uwe Fetzer
      Uwe Fetzer

      Hi André,

      unfortunatelly it depends on the backend version:

      7.50

      7.52
      Cheers, Uwe

      Author's profile photo Andre Fischer
      Andre Fischer
      Blog Post Author

      I'll check this.

      Author's profile photo Kai Sicker
      Kai Sicker

      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

      Author's profile photo Andre Fischer
      Andre Fischer
      Blog Post Author

      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.

       

      Author's profile photo Andre Fischer
      Andre Fischer
      Blog Post Author

      I have to confirm that it doesn't work for 740, 750 and 751.

      But it works for SAP S/4HANA 1909 (=754).

      Author's profile photo Kai Sicker
      Kai Sicker

      For me I didn't work till we upgraded to S/4 2020 (755) but thanks a lot for sharing!

      Author's profile photo Idi Kurniawan
      Idi Kurniawan

      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.

       

       

      Author's profile photo Vijay Sharma
      Vijay Sharma

      Very useful! Thanks Andre for sharing !!

      Author's profile photo Meera R Corera
      Meera R Corera

      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.

      Author's profile photo Makbule Merve Gul
      Makbule Merve Gul

      It deserves a real attention as you mentioned! Thanks for creating awareness on us of this new feature!

       

      Best,

      Merve

      Author's profile photo Martin Coetzee
      Martin Coetzee

      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.

      Author's profile photo Chau Nguyen Phuc
      Chau Nguyen Phuc

      Very useful!! Thanks for sharing

      Author's profile photo Matthias Becker
      Matthias Becker

      With ADT 3.12 the field “Referenced Object” can be used starting with backend release 7.52.

      We plan to enhance ADT in a later version so that it will work starting with backend release 7.50. The context menu functionality will however only be available for backends as of 7.52 release.
      Author's profile photo Andre Fischer
      Andre Fischer
      Blog Post Author

      Cool!