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