In the previous article on how to add value help to fields in the SAP Fiori Elements application, we have added the value help function to the selection field in the Fiori Elements application by annotation.
In this article, we will make the agent field more readable by adding the Agency Name to the ID using the Text Association.
The CDS Association is just a specification for join, always in the same place in the syntax.
The main advantage of associations is reuse: Once an association is specified, multiple associations can be easily concatenated into a path.
To actually do it.
Add the text association code on lines 9 and 13 below:
@AbapCatalog.sqlViewName: 'ZCTRAVELJERRY' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: 'Consumption view from /DMO/I_TRAVEL_U' @Metadata.allowExtensions: true @Search.searchable: true define view Z_C_TRAVEL_DATA_JERRY as select from /DMO/I_Travel_U association [1..1] to /DMO/I_Agency as _Agency on $projection.AgencyID = _Agency.AgencyID { key TravelID, @ObjectModel.text.association: '_Agency' AgencyID, CustomerID, BeginDate, EndDate, BookingFee, TotalPrice, CurrencyCode, @Search.defaultSearchElement: true @Search.fuzzinessThreshold: 0.90 Memo, Status, LastChangedAt, /* Associations */ _Agency, _Booking, _Currency, _Customer}
Agency ID and Agency Name are shown in two separate columns:
Agency ID and Agency Name are combined into one column to show:
More of Jerry’s original articles can be found on “Wang Zixi “: