I have defined a CDS view which is used for the value help of a smartfield.
define view entity ZZHU_CDS_ORDERTYPE as select from tvak
left outer join tvakt on tvak.auart = tvakt.auart
{
@Consumption.valueHelpDefinition: [{entity: { name: 'Z_C_SODOCTYPEVH',
element: 'OrderType'} }]
@EndUserText.label: 'Sales Order Type'
@ObjectModel.filter.enabled: true
@ObjectModel.text.element: ['Text']
@UI.textArrangement: #TEXT_FIRST
key tvak.auart as OrderType,
tvakt.bezei as Text
}
The XML view with the smartfield looks like this:
<sf:SmartField id="idOrderType" entitySet="ZZHU_CDS_ORDERTYPE" value="{OrderType}">
<sf:configuration>
<sf:Configuration id="_IDGenConfiguration2" displayBehaviour="idAndDescription" />
</sf:configuration>
</sf:SmartField>
And the annotation:
<EntityType Name="ZZHU_CDS_ORDERTYPEType" sap:label="Sales Order Type" sap:content-version="1">
<Key>
<PropertyRef Name="OrderType"/>
</Key>
<Property Name="OrderType" Type="Edm.String" Nullable="false" MaxLength="4"
sap:display-format="UpperCase" sap:filter-restriction="single-value" sap:text="Text"
sap:label="Sales Order Type" sap:quickinfo="Sales Document Type" sap:value-
list="standard"/>
<Property Name="Text" Type="Edm.String" MaxLength="20" sap:label="Description"
sap:quickinfo="Sales Document Type Description"/>
</EntityType>
So nothing fancy at all, but I do not get the smartfield to display key AND description, it only displays the key. Any help is appreciated. Thanks!