ABAP CDS – Join Example
Let’s check an example of Join in ABAP CDS View. Follow the steps from this blog to create the CDS, if you don’t know how to do that.
@AbapCatalog.sqlViewName: 'ZJOINCDS' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #NOT_REQUIRED @VDM.viewType: #BASIC @EndUserText.label: 'Example of Join in CDS' @ObjectModel.representativeKey: 'Material' define view ZJOIN_MARA_MAKT as select from mara inner join makt on mara.matnr = makt.matnr { key mara.matnr as Material, makt.maktx as MaterialDescription, mara.matkl as MaterialGroup, mara.meins as Uom } where makt.spras = $session.system_language
Instead of using the names of the table while selecting fields, you can also use a table alias (like normal Join). Note the session variables names are limited to language, client, date and user at the time of writing this blog.