Skip to Content
Technical Articles

New ADT feature – Creating ABAP CDS objects with reference to tables or other CDS views

With the latest ADT version 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.

Since this is an ADT feature that does not depend on the backend release you can also use it SAP S/4HANA and SAP ECC.

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

8 Comments
You must be Logged on to comment or reply to a post.
  • 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.

  • 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.

  • 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.