In the previous article the fields of the SAP Fiori Elements application, we have added the value help function to the selection field of the Fiori Elements application through annotations.
This article uses Text Association to add Agency Name to ID, we will make the agent field more readable.
CDS association is just a specification for joins, and is always in the same position in the grammar.
The main advantage of associations is reuse: once an association is specified, multiple associations can be easily connected to one path.
To carry out the actual operation.
Add the code related to text association on lines 9 and 13 of the following figure:
@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
}
In the Fiori Elements application before adding text association, Agency ID and Agency Name are displayed separately in two columns:
The effect after using text association: Agency ID and Agency Name merged into one column shows:
More original articles by Jerry, all in: "Wang Zixi":
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。